<!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 <andersca@apple.com>
+
+ 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 <cdumez@apple.com>
</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 <mach-o/dyld_priv.h>
-
-#else
-
-#import <mach-o/dyld_images.h>
-#import <stdint.h>
-
-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 "C" 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 "ArgumentCoders.h"
</span><del>-#import "DyldSPI.h"
</del><span class="cx"> #import "NetscapePlugin.h"
</span><span class="cx"> #import "PluginProcessCreationParameters.h"
</span><span class="cx"> #import "PluginProcessProxyMessages.h"
</span><span class="lines">@@ -42,6 +41,7 @@
</span><span class="cx"> #import <WebCore/LocalizedStrings.h>
</span><span class="cx"> #import <WebKitSystemInterface.h>
</span><span class="cx"> #import <dlfcn.h>
</span><ins>+#import <mach-o/dyld.h>
</ins><span class="cx"> #import <mach-o/getsect.h>
</span><span class="cx"> #import <mach/mach_vm.h>
</span><span class="cx"> #import <mach/vm_statistics.h>
</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[]) -> const char* {
- for (uint32_t i = 0; i < infoCount; ++i) {
- const char* pathSuffix = "/Silverlight.plugin/Contents/MacOS/CoreCLR.bundle/Contents/MacOS/coreclr";
</del><ins>+ _dyld_register_func_for_add_image([](const struct mach_header* mh, intptr_t vmaddr_slide) {
+ Dl_info imageInfo;
+ if (!dladdr(mh, &imageInfo))
+ return;
</ins><span class="cx">
</span><del>- int pathSuffixLength = strlen(pathSuffix);
- int imageFilePathLength = strlen(info[i].imageFilePath);
</del><ins>+ const char* pathSuffix = "/Silverlight.plugin/Contents/MacOS/CoreCLR.bundle/Contents/MacOS/coreclr";
</ins><span class="cx">
</span><del>- if (imageFilePathLength < 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 < pathSuffixLength)
+ return;
</ins><span class="cx">
</span><del>- unsigned long segmentSize;
- const uint8_t* segmentData = getsegmentdata(info[i].imageLoadAddress, "__DATA", &segmentSize);
- if (!segmentData)
</del><ins>+ if (strcmp(imageInfo.dli_fname + (imageFilePathLength - pathSuffixLength), pathSuffix))
+ return;
+
+ unsigned long segmentSize;
+ const uint8_t* segmentData = getsegmentdata(mh, "__DATA", &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<mach_vm_address_t>(segmentData); addr < reinterpret_cast<mach_vm_address_t>(segmentData) + segmentSize ; addr += size) {
+ kern_return_t kr = mach_vm_region_recurse(mach_task_self(), &addr, &size, &depth, (vm_region_recurse_info_64_t)&info, &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<mach_vm_address_t>(segmentData); addr < reinterpret_cast<mach_vm_address_t>(segmentData) + segmentSize ; addr += size) {
- kern_return_t kr = mach_vm_region_recurse(mach_task_self(), &addr, &size, &depth, (vm_region_recurse_info_64_t)&info, &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 = "<group>"; };
</span><span class="cx">                 1A2D956D12848564001EB962 /* ChildProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcess.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A2D956E12848564001EB962 /* ChildProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildProcess.cpp; sourceTree = "<group>"; };
</span><del>-                1A2E17EE1C6A590C00D04CF6 /* DyldSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DyldSPI.h; sourceTree = "<group>"; };
</del><span class="cx">                 1A30066C1110F4F70031937C /* ResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResponsivenessTimer.h; sourceTree = "<group>"; };
</span><span class="cx">                 1A30EAC5115D7DA30053E937 /* ConnectionMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ConnectionMac.mm; sourceTree = "<group>"; };
</span><span class="cx">                 1A334DEA16DE8B68006A8E38 /* StorageAreaMap.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = StorageAreaMap.messages.in; sourceTree = "<group>"; };
</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>