Title: [150094] trunk/Source/WebKit2
Revision
150094
Author
commit-qu...@webkit.org
Date
2013-05-14 17:27:36 -0700 (Tue, 14 May 2013)

Log Message

Add a preference that can disable the fake SYSV SHM shim
https://bugs.webkit.org/show_bug.cgi?id=116127
<rdar://problem/13810524>

Patch by Simon Cooper <scoo...@apple.com> on 2013-05-14
Reviewed by Alexey Proskuryakov.

* PluginProcess/mac/PluginProcessShim.mm:
(WebKit::shim_disabled):
(WebKit::shim_shmdt):
(WebKit::shim_shmat):
(WebKit::shim_shmget):
(WebKit::shim_shmctl):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (150093 => 150094)


--- trunk/Source/WebKit2/ChangeLog	2013-05-15 00:18:02 UTC (rev 150093)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-15 00:27:36 UTC (rev 150094)
@@ -1,3 +1,18 @@
+2013-05-14  Simon Cooper  <scoo...@apple.com>
+
+        Add a preference that can disable the fake SYSV SHM shim
+        https://bugs.webkit.org/show_bug.cgi?id=116127
+        <rdar://problem/13810524>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * PluginProcess/mac/PluginProcessShim.mm:
+        (WebKit::shim_disabled):
+        (WebKit::shim_shmdt):
+        (WebKit::shim_shmat):
+        (WebKit::shim_shmget):
+        (WebKit::shim_shmctl):
+
 2013-05-14  Tim Horton  <timothy_hor...@apple.com>
 
         [wk2] Not updating tiled backing coverage when main frame scrollability changes

Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm (150093 => 150094)


--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm	2013-05-15 00:18:02 UTC (rev 150093)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessShim.mm	2013-05-15 00:27:36 UTC (rev 150094)
@@ -156,8 +156,29 @@
     return descriptorPtr;
 }
 
+static Boolean shim_disabled(void)
+{
+    static Boolean isFakeSHMDisabled;
+
+    static dispatch_once_t once;
+    dispatch_once(&once, ^() {
+        Boolean keyExistsAndHasValidFormat = false;
+        Boolean prefValue = CFPreferencesGetAppBooleanValue(CFSTR("WebKitDisableFakeSYSVSHM"), kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
+
+        if (keyExistsAndHasValidFormat && prefValue)
+            isFakeSHMDisabled = true;
+        else
+            isFakeSHMDisabled = false;
+    });
+
+    return isFakeSHMDisabled;
+}
+
 static int shim_shmdt(const void* sharedAddress)
 {
+    if (shim_disabled())
+        return shmdt(sharedAddress);
+
     FakeSharedMemoryDescriptor* descriptorPtr = findBySharedMemoryAddress(sharedAddress);
     if (!descriptorPtr) {
         errno = EINVAL;
@@ -175,6 +196,9 @@
 
 static void* shim_shmat(int sharedMemoryIdentifier, const void* requestedSharedAddress, int shmflg)
 {
+    if (shim_disabled())
+        return shmat(sharedMemoryIdentifier, requestedSharedAddress, shmflg);
+
     FakeSharedMemoryDescriptor* descriptorPtr = findBySharedMemoryIdentifier(sharedMemoryIdentifier);
     void* mappedAddress = (void*)-1;
 
@@ -200,6 +224,9 @@
 
 static int shim_shmget(key_t key, size_t requestedSizeOfSharedMemory, int sharedMemoryFlags)
 {
+    if (shim_disabled())
+        return shmget(key, requestedSizeOfSharedMemory, sharedMemoryFlags);
+
     FakeSharedMemoryDescriptor* descriptorPtr = shmDescriptorList;
 
     while (descriptorPtr) {
@@ -232,6 +259,9 @@
 
 static int shim_shmctl(int sharedMemoryIdentifier, int cmd, struct shmid_ds* outputDescriptor)
 {
+    if (shim_disabled())
+        return shmctl(sharedMemoryIdentifier, cmd, outputDescriptor);
+
     FakeSharedMemoryDescriptor* descriptorPtr = findBySharedMemoryIdentifier(sharedMemoryIdentifier);
 
     if (!descriptorPtr) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to