<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[198352] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198352">198352</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2016-03-17 14:01:21 -0700 (Thu, 17 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove use of dyld_register_image_state_change_handler() in PluginProcessMac.mm
https://bugs.webkit.org/show_bug.cgi?id=155596

Reviewed by Dan Bernstein.

Use _dyld_register_func_for_add_image instead which is API. Use dladdr to find the image path given its header.

* Platform/spi/Cocoa/DyldSPI.h: Removed.
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::platformInitializeProcess):
* WebKit2.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessmacPluginProcessMacmm">trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2PlatformspiCocoaDyldSPIh">trunk/Source/WebKit2/Platform/spi/Cocoa/DyldSPI.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (198351 => 198352)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-17 20:48:28 UTC (rev 198351)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-17 21:01:21 UTC (rev 198352)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-03-17  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Remove use of dyld_register_image_state_change_handler() in PluginProcessMac.mm
+        https://bugs.webkit.org/show_bug.cgi?id=155596
+
+        Reviewed by Dan Bernstein.
+
+        Use _dyld_register_func_for_add_image instead which is API. Use dladdr to find the image path given its header.
+
+        * Platform/spi/Cocoa/DyldSPI.h: Removed.
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::PluginProcess::platformInitializeProcess):
+        * WebKit2.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2016-03-17  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Set the WebContent process's main thread QoS to USER-INTERACTIVE
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformspiCocoaDyldSPIh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/Platform/spi/Cocoa/DyldSPI.h (198351 => 198352)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/spi/Cocoa/DyldSPI.h        2016-03-17 20:48:28 UTC (rev 198351)
+++ trunk/Source/WebKit2/Platform/spi/Cocoa/DyldSPI.h        2016-03-17 21:01:21 UTC (rev 198352)
</span><span class="lines">@@ -1,43 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if USE(APPLE_INTERNAL_SDK)
-
-#import &lt;mach-o/dyld_priv.h&gt;
-
-#else
-
-#import &lt;mach-o/dyld_images.h&gt;
-#import &lt;stdint.h&gt;
-
-enum dyld_image_states {
-    dyld_image_state_bound = 40,
-};
-
-typedef const char* (*dyld_image_state_change_handler)(enum dyld_image_states state, uint32_t infoCount, const struct dyld_image_info info[]);
-
-extern &quot;C&quot; void dyld_register_image_state_change_handler(enum dyld_image_states state, bool batch, dyld_image_state_change_handler handler);
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessmacPluginProcessMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (198351 => 198352)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm        2016-03-17 20:48:28 UTC (rev 198351)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm        2016-03-17 21:01:21 UTC (rev 198352)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;ArgumentCoders.h&quot;
</span><del>-#import &quot;DyldSPI.h&quot;
</del><span class="cx"> #import &quot;NetscapePlugin.h&quot;
</span><span class="cx"> #import &quot;PluginProcessCreationParameters.h&quot;
</span><span class="cx"> #import &quot;PluginProcessProxyMessages.h&quot;
</span><span class="lines">@@ -42,6 +41,7 @@
</span><span class="cx"> #import &lt;WebCore/LocalizedStrings.h&gt;
</span><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><span class="cx"> #import &lt;dlfcn.h&gt;
</span><ins>+#import &lt;mach-o/dyld.h&gt;
</ins><span class="cx"> #import &lt;mach-o/getsect.h&gt;
</span><span class="cx"> #import &lt;mach/mach_vm.h&gt;
</span><span class="cx"> #import &lt;mach/vm_statistics.h&gt;
</span><span class="lines">@@ -490,38 +490,38 @@
</span><span class="cx">         // Silverlight expects the data segment of its coreclr library to be executable.
</span><span class="cx">         // Register with dyld to get notified when libraries are bound, then look for the
</span><span class="cx">         // coreclr image and make its __DATA segment executable.
</span><del>-        dyld_register_image_state_change_handler(dyld_image_state_bound, false, [](enum dyld_image_states state, uint32_t infoCount, const struct dyld_image_info info[]) -&gt; const char* {
-            for (uint32_t i = 0; i &lt; infoCount; ++i) {
-                const char* pathSuffix = &quot;/Silverlight.plugin/Contents/MacOS/CoreCLR.bundle/Contents/MacOS/coreclr&quot;;
</del><ins>+        _dyld_register_func_for_add_image([](const struct mach_header* mh, intptr_t vmaddr_slide) {
+            Dl_info imageInfo;
+            if (!dladdr(mh, &amp;imageInfo))
+                return;
</ins><span class="cx"> 
</span><del>-                int pathSuffixLength = strlen(pathSuffix);
-                int imageFilePathLength = strlen(info[i].imageFilePath);
</del><ins>+            const char* pathSuffix = &quot;/Silverlight.plugin/Contents/MacOS/CoreCLR.bundle/Contents/MacOS/coreclr&quot;;
</ins><span class="cx"> 
</span><del>-                if (imageFilePathLength &lt; pathSuffixLength)
-                    continue;
</del><ins>+            int pathSuffixLength = strlen(pathSuffix);
+            int imageFilePathLength = strlen(imageInfo.dli_fname);
</ins><span class="cx"> 
</span><del>-                if (strcmp(info[i].imageFilePath + (imageFilePathLength - pathSuffixLength), pathSuffix))
-                    continue;
</del><ins>+            if (imageFilePathLength &lt; pathSuffixLength)
+                return;
</ins><span class="cx"> 
</span><del>-                unsigned long segmentSize;
-                const uint8_t* segmentData = getsegmentdata(info[i].imageLoadAddress, &quot;__DATA&quot;, &amp;segmentSize);
-                if (!segmentData)
</del><ins>+            if (strcmp(imageInfo.dli_fname + (imageFilePathLength - pathSuffixLength), pathSuffix))
+                return;
+
+            unsigned long segmentSize;
+            const uint8_t* segmentData = getsegmentdata(mh, &quot;__DATA&quot;, &amp;segmentSize);
+            if (!segmentData)
+                return;
+
+            mach_vm_size_t size;
+            uint32_t depth = 0;
+            struct vm_region_submap_info_64 info = { };
+            mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
+            for (mach_vm_address_t addr = reinterpret_cast&lt;mach_vm_address_t&gt;(segmentData); addr &lt; reinterpret_cast&lt;mach_vm_address_t&gt;(segmentData) + segmentSize ; addr += size) {
+                kern_return_t kr = mach_vm_region_recurse(mach_task_self(), &amp;addr, &amp;size, &amp;depth, (vm_region_recurse_info_64_t)&amp;info, &amp;count);
+                if (kr != KERN_SUCCESS)
</ins><span class="cx">                     break;
</span><span class="cx"> 
</span><del>-                mach_vm_size_t size;
-                uint32_t depth = 0;
-                struct vm_region_submap_info_64 info = { };
-                mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
-                for (mach_vm_address_t addr = reinterpret_cast&lt;mach_vm_address_t&gt;(segmentData); addr &lt; reinterpret_cast&lt;mach_vm_address_t&gt;(segmentData) + segmentSize ; addr += size) {
-                    kern_return_t kr = mach_vm_region_recurse(mach_task_self(), &amp;addr, &amp;size, &amp;depth, (vm_region_recurse_info_64_t)&amp;info, &amp;count);
-                    if (kr != KERN_SUCCESS)
-                        break;
-
-                    mach_vm_protect(mach_task_self(), addr, size, false, info.protection | VM_PROT_EXECUTE);
-                }
</del><ins>+                mach_vm_protect(mach_task_self(), addr, size, false, info.protection | VM_PROT_EXECUTE);
</ins><span class="cx">             }
</span><del>-
-            return nullptr;
</del><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (198351 => 198352)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-03-17 20:48:28 UTC (rev 198351)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-03-17 21:01:21 UTC (rev 198352)
</span><span class="lines">@@ -202,7 +202,6 @@
</span><span class="cx">                 1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */; };
</span><span class="cx">                 1A2D956F12848564001EB962 /* ChildProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2D956D12848564001EB962 /* ChildProcess.h */; };
</span><span class="cx">                 1A2D957012848564001EB962 /* ChildProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2D956E12848564001EB962 /* ChildProcess.cpp */; };
</span><del>-                1A2E17EF1C6A590C00D04CF6 /* DyldSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2E17EE1C6A590C00D04CF6 /* DyldSPI.h */; };
</del><span class="cx">                 1A30066E1110F4F70031937C /* ResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */; };
</span><span class="cx">                 1A30EAC6115D7DA30053E937 /* ConnectionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A30EAC5115D7DA30053E937 /* ConnectionMac.mm */; };
</span><span class="cx">                 1A334DED16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A334DEB16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp */; };
</span><span class="lines">@@ -2131,7 +2130,6 @@
</span><span class="cx">                 1A2D92201281DC1B001EB962 /* PluginProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProxyMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A2D956D12848564001EB962 /* ChildProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcess.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A2D956E12848564001EB962 /* ChildProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildProcess.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                1A2E17EE1C6A590C00D04CF6 /* DyldSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DyldSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A30EAC5115D7DA30053E937 /* ConnectionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ConnectionMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A334DEA16DE8B68006A8E38 /* StorageAreaMap.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = StorageAreaMap.messages.in; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4947,7 +4945,6 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 1A5705101BE410E500874AF1 /* BlockSPI.h */,
</span><del>-                                1A2E17EE1C6A590C00D04CF6 /* DyldSPI.h */,
</del><span class="cx">                                 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */,
</span><span class="cx">                         );
</span><span class="cx">                         path = Cocoa;
</span><span class="lines">@@ -7711,7 +7708,6 @@
</span><span class="cx">                                 51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */,
</span><span class="cx">                                 7C361D731927FA360036A59D /* WebScriptMessageHandler.h in Headers */,
</span><span class="cx">                                 D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */,
</span><del>-                                1A2E17EF1C6A590C00D04CF6 /* DyldSPI.h in Headers */,
</del><span class="cx">                                 1A4832D71A9CDF96008B4DFE /* WebsiteData.h in Headers */,
</span><span class="cx">                                 1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */,
</span><span class="cx">                                 1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */,
</span></span></pre>
</div>
</div>

</body>
</html>