Title: [238797] trunk/Source/WebKit
Revision
238797
Author
[email protected]
Date
2018-12-03 08:45:42 -0800 (Mon, 03 Dec 2018)

Log Message

[Cocoa] Streamline sandbox code a tiny bit
https://bugs.webkit.org/show_bug.cgi?id=192299

Reviewed by Anders Carlsson.

* Shared/mac/SandboxUtilities.mm:
(WebKit::processHasContainer): Removed separate function, just use the
pathForProcessContainer instead of repeating logic. This costs a tiny
bit of memory allocation overhead the first time this function is called,
but in return we can eliminate a second copy of the code to call
sandbox_container_path_for_pid.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (238796 => 238797)


--- trunk/Source/WebKit/ChangeLog	2018-12-03 16:28:31 UTC (rev 238796)
+++ trunk/Source/WebKit/ChangeLog	2018-12-03 16:45:42 UTC (rev 238797)
@@ -1,3 +1,17 @@
+2018-12-03  Darin Adler  <[email protected]>
+
+        [Cocoa] Streamline sandbox code a tiny bit
+        https://bugs.webkit.org/show_bug.cgi?id=192299
+
+        Reviewed by Anders Carlsson.
+
+        * Shared/mac/SandboxUtilities.mm:
+        (WebKit::processHasContainer): Removed separate function, just use the
+        pathForProcessContainer instead of repeating logic. This costs a tiny
+        bit of memory allocation overhead the first time this function is called,
+        but in return we can eliminate a second copy of the code to call
+        sandbox_container_path_for_pid.
+
 2018-12-03  Eric Carlson  <[email protected]>
 
         [MediaStream] 'devicechange' event when more capture device information are revealed.

Modified: trunk/Source/WebKit/Shared/mac/SandboxUtilities.mm (238796 => 238797)


--- trunk/Source/WebKit/Shared/mac/SandboxUtilities.mm	2018-12-03 16:28:31 UTC (rev 238796)
+++ trunk/Source/WebKit/Shared/mac/SandboxUtilities.mm	2018-12-03 16:45:42 UTC (rev 238797)
@@ -47,23 +47,9 @@
     return sandbox_check_by_audit_token(token, nullptr, SANDBOX_FILTER_NONE);
 }
 
-static bool processHasContainer(pid_t pid)
-{
-    std::array<char, MAXPATHLEN> path;
-
-    if (sandbox_container_path_for_pid(pid, path.data(), path.size()))
-        return false;
-
-    if (!path[0])
-        return false;
-
-    return true;
-}
-
 bool processHasContainer()
 {
-    static bool hasContainer = processHasContainer(getpid());
-
+    static bool hasContainer = !pathForProcessContainer().isEmpty();
     return hasContainer;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to