ChildProcess should take an os_activity
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 May 2015 16:25:32 +0000 (16:25 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 May 2015 16:25:32 +0000 (16:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141781

Reviewed by Ryosuke Niwa.

* DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm:
(DatabaseServiceInitializer):
* NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
(NetworkServiceInitializer):
* PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
(PluginServiceInitializer):
* WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
(WebContentServiceInitializer):
Start an os_activity in the initializer for each XPC service.

* config.h:
Add HAVE_OS_ACTIVITY where available.

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

Source/WebKit2/ChangeLog
Source/WebKit2/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm
Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm
Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm
Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm
Source/WebKit2/config.h

index 7e138b0..4884bed 100644 (file)
@@ -1,3 +1,23 @@
+2015-05-11  Sam Weinig  <sam@webkit.org>
+
+        ChildProcess should take an os_activity
+        https://bugs.webkit.org/show_bug.cgi?id=141781
+
+        Reviewed by Ryosuke Niwa.
+
+        * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm:
+        (DatabaseServiceInitializer):
+        * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
+        (NetworkServiceInitializer):
+        * PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
+        (PluginServiceInitializer):
+        * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
+        (WebContentServiceInitializer):
+        Start an os_activity in the initializer for each XPC service.
+
+        * config.h:
+        Add HAVE_OS_ACTIVITY where available.
+
 2015-05-12  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Fix GTK+ debug build after r184197.
index c52279f..24edae8 100644 (file)
 #import "WKBase.h"
 #import "XPCServiceEntryPoint.h"
 
+#if HAVE(OS_ACTIVITY)
+#include <os/activity.h>
+#endif
+
 using namespace WebKit;
 
 extern "C" WK_EXPORT void DatabaseServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage);
 
 void DatabaseServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage)
 {
+#if HAVE(OS_ACTIVITY)
+    os_activity_t activity = os_activity_start("com.apple.WebKit.Databases", OS_ACTIVITY_FLAG_DEFAULT);
+#endif
+
     XPCServiceInitializer<DatabaseProcess, XPCServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
+
+#if HAVE(OS_ACTIVITY)
+    os_activity_end(activity);
+#endif
 }
index 8ea6e25..e2ed67d 100644 (file)
 #import "WKBase.h"
 #import "XPCServiceEntryPoint.h"
 
+#if HAVE(OS_ACTIVITY)
+#include <os/activity.h>
+#endif
+
 namespace WebKit {
 
 class NetworkServiceInitializerDelegate : public XPCServiceInitializerDelegate {
@@ -53,6 +57,14 @@ void NetworkServiceInitializer(xpc_connection_t connection, xpc_object_t initial
     // the this process don't try to insert the shim and crash.
     EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/SecItemShim.dylib");
 
+#if HAVE(OS_ACTIVITY)
+    os_activity_t activity = os_activity_start("com.apple.WebKit.Networking", OS_ACTIVITY_FLAG_DEFAULT);
+#endif
+
     XPCServiceInitializer<NetworkProcess, NetworkServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
+
+#if HAVE(OS_ACTIVITY)
+    os_activity_end(activity);
+#endif
 #endif
 }
index cdc8add..3a7667b 100644 (file)
 #import "XPCServiceEntryPoint.h"
 #import <wtf/RunLoop.h>
 
+#if HAVE(OS_ACTIVITY)
+#include <os/activity.h>
+#endif
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
 
 namespace WebKit {
@@ -76,6 +80,14 @@ void PluginServiceInitializer(xpc_connection_t connection, xpc_object_t initiali
     // spawned by the PluginProcess don't try to insert the shim and crash.
     EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/PluginProcessShim.dylib");
 
+#if HAVE(OS_ACTIVITY)
+    os_activity_t activity = os_activity_start("com.apple.WebKit.Plugin", OS_ACTIVITY_FLAG_DEFAULT);
+#endif
+
     XPCServiceInitializer<PluginProcess, PluginServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
+
+#if HAVE(OS_ACTIVITY)
+    os_activity_end(activity);
+#endif
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 }
index 194fbcf..337a9da 100644 (file)
 #import <WebCore/WebCoreThreadSystemInterface.h>
 #endif
 
+#if HAVE(OS_ACTIVITY)
+#include <os/activity.h>
+#endif
+
 using namespace WebCore;
 using namespace WebKit;
 
@@ -47,10 +51,18 @@ void WebContentServiceInitializer(xpc_connection_t connection, xpc_object_t init
     // the this process don't try to insert the shim and crash.
     EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/WebProcessShim.dylib");
 
+#if HAVE(OS_ACTIVITY)
+    os_activity_t activity = os_activity_start("com.apple.WebKit.WebContent", OS_ACTIVITY_FLAG_DEFAULT);
+#endif
+
 #if PLATFORM(IOS)
     GSInitialize();
     InitWebCoreThreadSystemInterface();
 #endif // PLATFORM(IOS)
 
     XPCServiceInitializer<WebProcess, XPCServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
+
+#if HAVE(OS_ACTIVITY)
+    os_activity_end(activity);
+#endif
 }
index 16deafb..1c2a9a6 100644 (file)
 #endif
 #endif
 
+#ifndef HAVE_OS_ACTIVITY
+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000)
+#define HAVE_OS_ACTIVITY 1
+#endif
+#endif
+
 #ifndef ENABLE_NETWORK_CACHE
 #if ENABLE(NETWORK_PROCESS) && (PLATFORM(COCOA) || PLATFORM(GTK))
 #define ENABLE_NETWORK_CACHE 1