Use getCurrentProcessID over getpid
authordon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jun 2018 22:02:34 +0000 (22:02 +0000)
committerdon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jun 2018 22:02:34 +0000 (22:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186813

Reviewed by Alex Christensen.

* Shared/WebMemorySampler.cpp:
(WebKit::WebMemorySampler::initializeTimers):
(WebKit::WebMemorySampler::stop):
(WebKit::WebMemorySampler::writeHeaders):
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):

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

Source/WebKit/ChangeLog
Source/WebKit/Shared/WebMemorySampler.cpp
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp

index 36d350b..77060a4 100644 (file)
@@ -1,5 +1,19 @@
 2018-06-19  Don Olmstead  <don.olmstead@sony.com>
 
+        Use getCurrentProcessID over getpid
+        https://bugs.webkit.org/show_bug.cgi?id=186813
+
+        Reviewed by Alex Christensen.
+
+        * Shared/WebMemorySampler.cpp:
+        (WebKit::WebMemorySampler::initializeTimers):
+        (WebKit::WebMemorySampler::stop):
+        (WebKit::WebMemorySampler::writeHeaders):
+        * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+        (WebKit::WebSWContextManagerConnection::installServiceWorker):
+
+2018-06-19  Don Olmstead  <don.olmstead@sony.com>
+
         WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations does not invoke callback when Service Workers disabled
         https://bugs.webkit.org/show_bug.cgi?id=186809
 
index 9277189..f6c792c 100644 (file)
@@ -29,7 +29,7 @@
 #if ENABLE(MEMORY_SAMPLER)
 
 #include <stdio.h>
-#include <unistd.h>
+#include <wtf/ProcessID.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
 
@@ -89,7 +89,7 @@ void WebMemorySampler::start(SandboxExtension::Handle&& sampleLogFileHandle, con
 void WebMemorySampler::initializeTimers(double interval)
 {
     m_sampleTimer.startRepeating(1_s);
-    printf("Started memory sampler for process %s %d", processName().utf8().data(), getpid());
+    printf("Started memory sampler for process %s %d", processName().utf8().data(), getCurrentProcessID());
     if (interval > 0) {
         m_stopTimer.startOneShot(1_s * interval);
         printf(" for a interval of %g seconds", interval);
@@ -106,7 +106,7 @@ void WebMemorySampler::stop()
     m_sampleTimer.stop();
     FileSystem::closeFile(m_sampleLogFile);
 
-    printf("Stopped memory sampler for process %s %d\n", processName().utf8().data(), getpid());
+    printf("Stopped memory sampler for process %s %d\n", processName().utf8().data(), getCurrentProcessID());
     // Flush stdout buffer so python script can be guaranteed to read up to this point.
     fflush(stdout);
     m_isRunning = false;
@@ -143,7 +143,7 @@ void WebMemorySampler::initializeSandboxedLogFile(SandboxExtension::Handle&& sam
 
 void WebMemorySampler::writeHeaders()
 {
-    String processDetails = String::format("Process: %s Pid: %d\n", processName().utf8().data(), getpid());
+    String processDetails = String::format("Process: %s Pid: %d\n", processName().utf8().data(), getCurrentProcessID());
 
     CString utf8String = processDetails.utf8();
     FileSystem::writeToFile(m_sampleLogFile, utf8String.data(), utf8String.length());
index faa7e39..2cfb3ca 100644 (file)
@@ -57,6 +57,7 @@
 #include <WebCore/ServiceWorkerJobDataIdentifier.h>
 #include <WebCore/UserAgent.h>
 #include <pal/SessionID.h>
+#include <wtf/ProcessID.h>
 
 #if USE(QUICK_LOOK)
 #include <WebCore/PreviewLoaderClient.h>
@@ -160,7 +161,7 @@ void WebSWContextManagerConnection::installServiceWorker(const ServiceWorkerCont
     auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(pageConfiguration), data, sessionID, String { m_userAgent }, WebProcess::singleton().cacheStorageProvider(), m_storageBlockingPolicy);
     SWContextManager::singleton().registerServiceWorkerThreadForInstall(WTFMove(serviceWorkerThreadProxy));
 
-    LOG(ServiceWorker, "Context process PID: %i created worker thread\n", getpid());
+    LOG(ServiceWorker, "Context process PID: %i created worker thread\n", getCurrentProcessID());
 }
 
 void WebSWContextManagerConnection::setUserAgent(String&& userAgent)