WebKit2 is leaking an xpc_connection per web process it creates
https://bugs.webkit.org/show_bug.cgi?id=132785
<rdar://problem/14912160>

Reviewed by Sam Weinig.

Introduce an IPC::XPCPtr smart pointer class and use it for XPC connections inside Connection::Identifier and Connection itself.

Make sure we always adopt any connections that are created.

* DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm:
(DatabaseServiceInitializer):
* NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
(WebKit::NetworkServiceInitializerDelegate::NetworkServiceInitializerDelegate):
(NetworkServiceInitializer):
* Platform/IPC/Connection.h:
(IPC::Connection::Identifier::Identifier):
(IPC::Connection::xpcConnection):
* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::platformInvalidate):
(IPC::Connection::platformInitialize):
(IPC::Connection::getAuditToken):
* Platform/IPC/mac/XPCPtr.h: Added.
(IPC::XPCPtr::XPCPtr):
(IPC::XPCPtr::~XPCPtr):
(IPC::XPCPtr::get):
(IPC::XPCPtr::operator!):
(IPC::XPCPtr::operator=):
(IPC::adoptXPC):
* PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
(WebKit::PluginServiceInitializerDelegate::PluginServiceInitializerDelegate):
(PluginServiceInitializer):
* Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm:
(WebKit::BootstrapMain):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializerDelegate::XPCServiceInitializerDelegate):
(WebKit::XPCServiceInitializer):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::hasEntitlement):
(WebKit::XPCServiceInitializerDelegate::isClientSandboxed):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm:
(WebKit::XPCServiceEventHandler):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* UIProcess/Launcher/ProcessLauncher.cpp:
(WebKit::ProcessLauncher::didFinishLaunchingProcess):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::connectToService):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
(WebContentServiceInitializer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use xpc_connection_kill for killing child processes where appropriate
https://bugs.webkit.org/show_bug.cgi?id=132788
<rdar://problem/16664185>

Reviewed by Sam Weinig.

* Platform/IPC/Connection.h:
* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::kill):
* Platform/IPC/mac/XPCPtr.h:
(IPC::XPCPtr::operator bool):
* Shared/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::terminate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r168578.
https://bugs.webkit.org/show_bug.cgi?id=132789

Speculative rollout since this appears to break PLT3.
(Requested by kling on #webkit).

Reverted changeset:

"Move Source/WebCore/workers/ code to std::unique_ptr"
https://bugs.webkit.org/show_bug.cgi?id=132401
http://trac.webkit.org/changeset/168578

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168586 268f45cc-cd09-0410-ab3c-d52691b4dbfc