<!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>[164256] 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/164256">164256</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2014-02-17 16:16:34 -0800 (Mon, 17 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WebKit2] Merge WebProcessMac and WebProcessIOS into WebProcessCocoa
https://bugs.webkit.org/show_bug.cgi?id=128939
Reviewed by Dan Bernstein.
* WebKit2.xcodeproj/project.pbxproj:
Add/remove files/groups.
* WebProcess/WebProcess.h:
Change stopRunLoop() to be AppKit only.
* WebProcess/cocoa: Added.
* WebProcess/cocoa/WebProcessCocoa.mm: Copied from Source/WebKit2/WebProcess/mac/WebProcessMac.mm.
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::initializeProcessName):
(WebKit::WebProcess::platformInitializeProcess):
(WebKit::WebProcess::initializeSandbox):
(WebKit::WebProcess::updateActivePages):
* WebProcess/ios/WebProcessIOS.mm: Removed.
* WebProcess/mac/WebProcessMac.mm: Removed.
Copy mac/WebProcessMac.mm to cocoa/WebProcessCocoa.mm, and add #if USE(APPKIT) where appropriate.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessh">trunk/Source/WebKit2/WebProcess/WebProcess.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebKit2/WebProcess/cocoa/</li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebProcessCocoamm">trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessiosWebProcessIOSmm">trunk/Source/WebKit2/WebProcess/ios/WebProcessIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessmacWebProcessMacmm">trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164255 => 164256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-18 00:08:02 UTC (rev 164255)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-18 00:16:34 UTC (rev 164256)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-02-17 Sam Weinig <sam@webkit.org>
+
+ [WebKit2] Merge WebProcessMac and WebProcessIOS into WebProcessCocoa
+ https://bugs.webkit.org/show_bug.cgi?id=128939
+
+ Reviewed by Dan Bernstein.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ Add/remove files/groups.
+
+ * WebProcess/WebProcess.h:
+ Change stopRunLoop() to be AppKit only.
+
+ * WebProcess/cocoa: Added.
+ * WebProcess/cocoa/WebProcessCocoa.mm: Copied from Source/WebKit2/WebProcess/mac/WebProcessMac.mm.
+ (WebKit::WebProcess::platformInitializeWebProcess):
+ (WebKit::WebProcess::initializeProcessName):
+ (WebKit::WebProcess::platformInitializeProcess):
+ (WebKit::WebProcess::initializeSandbox):
+ (WebKit::WebProcess::updateActivePages):
+ * WebProcess/ios/WebProcessIOS.mm: Removed.
+ * WebProcess/mac/WebProcessMac.mm: Removed.
+ Copy mac/WebProcessMac.mm to cocoa/WebProcessCocoa.mm, and add #if USE(APPKIT) where appropriate.
+
</ins><span class="cx"> 2014-02-17 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Stop using isMainThread() in WebKit2
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (164255 => 164256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-02-18 00:08:02 UTC (rev 164255)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-02-18 00:16:34 UTC (rev 164256)
</span><span class="lines">@@ -481,7 +481,6 @@
</span><span class="cx">                 2DA944AE1884E9BA00ED86DB /* WebInspectorProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */; };
</span><span class="cx">                 2DA944AF1884E9BA00ED86DB /* WebPageProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */; };
</span><span class="cx">                 2DA944B01884E9BA00ED86DB /* WebProcessProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */; };
</span><del>-                2DA944B31884E9EC00ED86DB /* WebProcessIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B21884E9EC00ED86DB /* WebProcessIOS.mm */; };
</del><span class="cx">                 2DA944B91884EA3900ED86DB /* WebBackForwardListProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */; };
</span><span class="cx">                 2DA944BA1884EA3C00ED86DB /* WebPageIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */; };
</span><span class="cx">                 2DA944BD188511E700ED86DB /* NetworkProcessIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */; };
</span><span class="lines">@@ -874,6 +873,7 @@
</span><span class="cx">                 7C3F8C90173AF52D007B7F39 /* PluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */; };
</span><span class="cx">                 7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */; };
</span><span class="cx">                 7C6D37FC172F555F009D2847 /* PageBannerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */; };
</span><ins>+                7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */; };
</ins><span class="cx">                 7C9D1537184584DA009D3918 /* WKBrowsingContextGroupInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9D1536184584DA009D3918 /* WKBrowsingContextGroupInternal.h */; };
</span><span class="cx">                 7CA254EB182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7CB16FEF1724BA23007A0A95 /* com.apple.ist.ds.appleconnect.webplugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE21724B9B5007A0A95 /* com.apple.ist.ds.appleconnect.webplugin.sb */; };
</span><span class="lines">@@ -1033,7 +1033,6 @@
</span><span class="cx">                 BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 BC2E6E8D1141971500A63B1E /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */; };
</span><span class="cx">                 BC2E6E8E1141971500A63B1E /* WorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2E6E7E1141970C00A63B1E /* WorkQueue.h */; };
</span><del>-                BC3065C412592F8900E71278 /* WebProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3065C312592F8900E71278 /* WebProcessMac.mm */; };
</del><span class="cx">                 BC3065FA1259344E00E71278 /* CacheModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3065F91259344E00E71278 /* CacheModel.h */; };
</span><span class="cx">                 BC3066BE125A442100E71278 /* WebProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3066BC125A442100E71278 /* WebProcessMessageReceiver.cpp */; };
</span><span class="cx">                 BC3066BF125A442100E71278 /* WebProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3066BD125A442100E71278 /* WebProcessMessages.h */; };
</span><span class="lines">@@ -2184,7 +2183,6 @@
</span><span class="cx">                 2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebInspectorProxyIOS.mm; path = ios/WebInspectorProxyIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPageProxyIOS.mm; path = ios/WebPageProxyIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebProcessProxyIOS.mm; path = ios/WebProcessProxyIOS.mm; sourceTree = "<group>"; };
</span><del>-                2DA944B21884E9EC00ED86DB /* WebProcessIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebProcessIOS.mm; path = ios/WebProcessIOS.mm; sourceTree = "<group>"; };
</del><span class="cx">                 2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebBackForwardListProxyIOS.mm; path = ios/WebBackForwardListProxyIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPageIOS.mm; path = ios/WebPageIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessIOS.mm; path = NetworkProcess/ios/NetworkProcessIOS.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -2619,6 +2617,7 @@
</span><span class="cx">                 7C3F8C8E173AF52D007B7F39 /* PluginInformation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInformation.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 7C3F8C8F173AF52D007B7F39 /* PluginInformation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInformation.h; sourceTree = "<group>"; };
</span><span class="cx">                 7C6D37FA172F555F009D2847 /* PageBannerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageBannerMac.mm; sourceTree = "<group>"; };
</span><ins>+                7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessCocoa.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 7C9D1536184584DA009D3918 /* WKBrowsingContextGroupInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextGroupInternal.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextPolicyDelegate.h; sourceTree = "<group>"; };
</span><span class="cx">                 7CB16FE21724B9B5007A0A95 /* com.apple.ist.ds.appleconnect.webplugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.ist.ds.appleconnect.webplugin.sb; sourceTree = "<group>"; };
</span><span class="lines">@@ -2791,7 +2790,6 @@
</span><span class="cx">                 BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageLoadTypes.h; sourceTree = "<group>"; };
</span><span class="cx">                 BC2E6E7D1141970C00A63B1E /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 BC2E6E7E1141970C00A63B1E /* WorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueue.h; sourceTree = "<group>"; };
</span><del>-                BC3065C312592F8900E71278 /* WebProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessMac.mm; sourceTree = "<group>"; };
</del><span class="cx">                 BC3065F91259344E00E71278 /* CacheModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheModel.h; sourceTree = "<group>"; };
</span><span class="cx">                 BC3066B9125A436300E71278 /* WebProcess.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebProcess.messages.in; sourceTree = "<group>"; };
</span><span class="cx">                 BC3066BC125A442100E71278 /* WebProcessMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessMessageReceiver.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -3686,14 +3684,6 @@
</span><span class="cx">                         tabWidth = 8;
</span><span class="cx">                         usesTabs = 0;
</span><span class="cx">                 };
</span><del>-                1A6FA01C11E1526300DB1371 /* mac */ = {
-                        isa = PBXGroup;
-                        children = (
-                                BC3065C312592F8900E71278 /* WebProcessMac.mm */,
-                        );
-                        path = mac;
-                        sourceTree = "<group>";
-                };
</del><span class="cx">                 1A6FB7AA11E64B4900DB1371 /* Plugins */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -4242,7 +4232,6 @@
</span><span class="cx">                 2DA944B11884E9DF00ED86DB /* ios */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                2DA944B21884E9EC00ED86DB /* WebProcessIOS.mm */,
</del><span class="cx">                                 3F889D0D1887699C00FEADAF /* WebVideoFullscreenManager.cpp */,
</span><span class="cx">                                 3F889D0E1887699C00FEADAF /* WebVideoFullscreenManager.h */,
</span><span class="cx">                                 3F889D101887710000FEADAF /* WebVideoFullscreenManager.messages.in */,
</span><span class="lines">@@ -4840,6 +4829,14 @@
</span><span class="cx">                         name = OriginData;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><ins>+                7C6E70F818B2D47E00F24E2E /* cocoa */ = {
+                        isa = PBXGroup;
+                        children = (
+                                7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */,
+                        );
+                        path = cocoa;
+                        sourceTree = "<group>";
+                };
</ins><span class="cx">                 7CB16FE11724B9B5007A0A95 /* PlugInSandboxProfiles */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -4889,9 +4886,8 @@
</span><span class="cx">                 BC032D5C10F436D50058C15A /* WebProcess */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                2DA944B11884E9DF00ED86DB /* ios */,
-                                755422C518064FFC0046F6A8 /* OriginData */,
</del><span class="cx">                                 512E352A130B559900ABD19A /* ApplicationCache */,
</span><ins>+                                7C6E70F818B2D47E00F24E2E /* cocoa */,
</ins><span class="cx">                                 3309344B1315B93A0097A7BC /* Cookies */,
</span><span class="cx">                                 512A9754180DF9270039A149 /* Databases */,
</span><span class="cx">                                 BCACC43B16B24C5D00B6E092 /* EntryPoint */,
</span><span class="lines">@@ -4900,10 +4896,11 @@
</span><span class="cx">                                 BC0E5FCB12D696DD0012A72A /* Geolocation */,
</span><span class="cx">                                 51FBB9C1132E079200F327B4 /* IconDatabase */,
</span><span class="cx">                                 BC204EDF11C83E72008F3375 /* InjectedBundle */,
</span><del>-                                1A6FA01C11E1526300DB1371 /* mac */,
</del><ins>+                                2DA944B11884E9DF00ED86DB /* ios */,
</ins><span class="cx">                                 33D3A3BD1339609800709BE4 /* MediaCache */,
</span><span class="cx">                                 5105B0D2162F7A5E00E27709 /* Network */,
</span><span class="cx">                                 31099974146C8AA80029DEB9 /* Notifications (User) */,
</span><ins>+                                755422C518064FFC0046F6A8 /* OriginData */,
</ins><span class="cx">                                 1A6FB7AA11E64B4900DB1371 /* Plugins */,
</span><span class="cx">                                 3336762B130C9978006C9DE2 /* ResourceCache */,
</span><span class="cx">                                 0F59478C187B3B2A00437857 /* Scrolling */,
</span><span class="lines">@@ -8066,7 +8063,6 @@
</span><span class="cx">                                 BC9BA5041697C45300E44616 /* WebKit2Initialize.cpp in Sources */,
</span><span class="cx">                                 33D3A3C1133960B000709BE4 /* WebMediaCacheManager.cpp in Sources */,
</span><span class="cx">                                 33D3A3C81339617900709BE4 /* WebMediaCacheManagerMessageReceiver.cpp in Sources */,
</span><del>-                                2DA944B31884E9EC00ED86DB /* WebProcessIOS.mm in Sources */,
</del><span class="cx">                                 33D3A3BA1339606200709BE4 /* WebMediaCacheManagerProxy.cpp in Sources */,
</span><span class="cx">                                 33D3A3CA1339617900709BE4 /* WebMediaCacheManagerProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 909854EC12BC4E17000AD080 /* WebMemorySampler.cpp in Sources */,
</span><span class="lines">@@ -8122,7 +8118,6 @@
</span><span class="cx">                                 BC306825125A6B9400E71278 /* WebProcessCreationParameters.cpp in Sources */,
</span><span class="cx">                                 1F7506B01859162C00EC0FF7 /* WKWebProcessPlugInScriptWorld.mm in Sources */,
</span><span class="cx">                                 75E749EB180DBB9800088BA6 /* WebOriginDataManagerProxyMessageReceiver.cpp in Sources */,
</span><del>-                                BC3065C412592F8900E71278 /* WebProcessMac.mm in Sources */,
</del><span class="cx">                                 BC3066BE125A442100E71278 /* WebProcessMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 BC111B11112F5E4F00337BAB /* WebProcessProxy.cpp in Sources */,
</span><span class="cx">                                 51032F18180F73BB00961BB7 /* WebToDatabaseProcessConnection.cpp in Sources */,
</span><span class="lines">@@ -8170,6 +8165,7 @@
</span><span class="cx">                                 BCBAACF51452324F0053F82F /* WKBrowsingContextGroup.mm in Sources */,
</span><span class="cx">                                 51290992183ACEAF005522A6 /* WebIDBServerConnection.cpp in Sources */,
</span><span class="cx">                                 BC204EEE11C83EC8008F3375 /* WKBundle.cpp in Sources */,
</span><ins>+                                7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */,
</ins><span class="cx">                                 935EEB9E127761AC003322B8 /* WKBundleBackForwardList.cpp in Sources */,
</span><span class="cx">                                 373D122218A473010066D9CC /* WKFrameHandle.mm in Sources */,
</span><span class="cx">                                 935EEBA0127761AC003322B8 /* WKBundleBackForwardListItem.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (164255 => 164256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.h        2014-02-18 00:08:02 UTC (rev 164255)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h        2014-02-18 00:16:34 UTC (rev 164256)
</span><span class="lines">@@ -256,7 +256,7 @@
</span><span class="cx"> virtual bool shouldTerminate() override;
</span><span class="cx"> virtual void terminate() override;
</span><span class="cx">
</span><del>-#if PLATFORM(MAC) && !PLATFORM(IOS)
</del><ins>+#if USE(APPKIT)
</ins><span class="cx"> virtual void stopRunLoop() override;
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebProcessCocoammfromrev164251trunkSourceWebKit2WebProcessmacWebProcessMacmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm (from rev 164251, trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm) (0 => 164256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm        2014-02-18 00:16:34 UTC (rev 164256)
</span><span class="lines">@@ -0,0 +1,273 @@
</span><ins>+/*
+ * Copyright (C) 2010 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.
+ */
+
+#import "config.h"
+#import "WebProcess.h"
+
+#import "CustomProtocolManager.h"
+#import "SandboxExtension.h"
+#import "SandboxInitializationParameters.h"
+#import "SecItemShim.h"
+#import "WKFullKeyboardAccessWatcher.h"
+#import "WebFrame.h"
+#import "WebInspector.h"
+#import "WebPage.h"
+#import "WebProcessCreationParameters.h"
+#import "WebProcessProxyMessages.h"
+#import <JavaScriptCore/Options.h>
+#import <WebCore/AXObjectCache.h>
+#import <WebCore/FileSystem.h>
+#import <WebCore/Font.h>
+#import <WebCore/LocalizedStrings.h>
+#import <WebCore/MemoryCache.h>
+#import <WebCore/PageCache.h>
+#import <WebCore/WebCoreNSURLExtras.h>
+#import <WebKitSystemInterface.h>
+#import <algorithm>
+#import <dispatch/dispatch.h>
+#import <mach/host_info.h>
+#import <mach/mach.h>
+#import <mach/mach_error.h>
+#import <objc/runtime.h>
+#import <stdio.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static uint64_t memorySize()
+{
+ static host_basic_info_data_t hostInfo;
+
+ static dispatch_once_t once;
+ dispatch_once(&once, ^() {
+ mach_port_t host = mach_host_self();
+ mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT;
+ kern_return_t r = host_info(host, HOST_BASIC_INFO, (host_info_t)&hostInfo, &count);
+ mach_port_deallocate(mach_task_self(), host);
+
+ if (r != KERN_SUCCESS)
+ LOG_ERROR("%s : host_info(%d) : %s.\n", __FUNCTION__, r, mach_error_string(r));
+ });
+
+ return hostInfo.max_mem;
+}
+
+static uint64_t volumeFreeSize(NSString *path)
+{
+ NSDictionary *fileSystemAttributesDictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:path error:NULL];
+ return [[fileSystemAttributesDictionary objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
+}
+
+void WebProcess::platformSetCacheModel(CacheModel cacheModel)
+{
+ RetainPtr<NSString> nsurlCacheDirectory = adoptNS((NSString *)WKCopyFoundationCacheDirectory());
+ if (!nsurlCacheDirectory)
+ nsurlCacheDirectory = NSHomeDirectory();
+
+ // As a fudge factor, use 1000 instead of 1024, in case the reported byte
+ // count doesn't align exactly to a megabyte boundary.
+ uint64_t memSize = memorySize() / 1024 / 1000;
+ uint64_t diskFreeSize = volumeFreeSize(nsurlCacheDirectory.get()) / 1024 / 1000;
+
+ unsigned cacheTotalCapacity = 0;
+ unsigned cacheMinDeadCapacity = 0;
+ unsigned cacheMaxDeadCapacity = 0;
+ double deadDecodedDataDeletionInterval = 0;
+ unsigned pageCacheCapacity = 0;
+ unsigned long urlCacheMemoryCapacity = 0;
+ unsigned long urlCacheDiskCapacity = 0;
+
+ calculateCacheSizes(cacheModel, memSize, diskFreeSize,
+ cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
+ pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity);
+
+
+ memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+ memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
+ pageCache()->setCapacity(pageCacheCapacity);
+
+ NSURLCache *nsurlCache = [NSURLCache sharedURLCache];
+
+ // FIXME: Once there is no loading being done in the WebProcess, we should remove this,
+ // as calling [NSURLCache sharedURLCache] initializes the cache, which we would rather not do.
+ if (usesNetworkProcess()) {
+ [nsurlCache setMemoryCapacity:0];
+ [nsurlCache setDiskCapacity:0];
+ return;
+ }
+
+ [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity];
+ [nsurlCache setDiskCapacity:std::max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn.
+}
+
+void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear)
+{
+ if (cachesToClear == InMemoryResourceCachesOnly)
+ return;
+
+ // If we're using the network process then it is the only one that needs to clear the disk cache.
+ if (usesNetworkProcess())
+ return;
+
+ if (!m_clearResourceCachesDispatchGroup)
+ m_clearResourceCachesDispatchGroup = dispatch_group_create();
+
+ dispatch_group_async(m_clearResourceCachesDispatchGroup, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ [[NSURLCache sharedURLCache] removeAllCachedResponses];
+ });
+}
+
+#if USE(APPKIT)
+static id NSApplicationAccessibilityFocusedUIElement(NSApplication*, SEL)
+{
+ WebPage* page = WebProcess::shared().focusedWebPage();
+ if (!page || !page->accessibilityRemoteObject())
+ return 0;
+
+ return [page->accessibilityRemoteObject() accessibilityFocusedUIElement];
+}
+#endif
+
+void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, IPC::MessageDecoder&)
+{
+#if ENABLE(WEB_PROCESS_SANDBOX)
+ SandboxExtension::consumePermanently(parameters.uiProcessBundleResourcePathExtensionHandle);
+ SandboxExtension::consumePermanently(parameters.localStorageDirectoryExtensionHandle);
+ SandboxExtension::consumePermanently(parameters.databaseDirectoryExtensionHandle);
+ SandboxExtension::consumePermanently(parameters.applicationCacheDirectoryExtensionHandle);
+ SandboxExtension::consumePermanently(parameters.diskCacheDirectoryExtensionHandle);
+#endif
+
+ // When the network process is enabled, each web process wants a stand-alone
+ // NSURLCache, which it can disable to save memory.
+ if (!usesNetworkProcess()) {
+ if (!parameters.diskCacheDirectory.isNull()) {
+ [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
+ initWithMemoryCapacity:parameters.nsURLCacheMemoryCapacity
+ diskCapacity:parameters.nsURLCacheDiskCapacity
+ diskPath:parameters.diskCacheDirectory]).get()];
+ }
+ }
+
+ m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
+ m_presenterApplicationPid = parameters.presenterApplicationPid;
+ m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution;
+ Font::setDefaultTypesettingFeatures(parameters.shouldEnableKerningAndLigaturesByDefault ? Kerning | Ligatures : 0);
+
+ if (!JSC::Options::useJITWasOverridden())
+ JSC::Options::useJIT() = parameters.shouldEnableJIT;
+
+ if (!JSC::Options::useFTLJITWasOverridden())
+ JSC::Options::useFTLJIT() = parameters.shouldEnableFTL;
+
+ setEnhancedAccessibility(parameters.accessibilityEnhancedUserInterfaceEnabled);
+
+#if USE(APPKIT)
+ // rdar://9118639 accessibilityFocusedUIElement in NSApplication defaults to use the keyWindow. Since there's
+ // no window in WK2, NSApplication needs to use the focused page's focused element.
+ Method methodToPatch = class_getInstanceMethod([NSApplication class], @selector(accessibilityFocusedUIElement));
+ method_setImplementation(methodToPatch, (IMP)NSApplicationAccessibilityFocusedUIElement);
+#endif
+}
+
+void WebProcess::initializeProcessName(const ChildProcessInitializationParameters& parameters)
+{
+#if !PLATFORM(IOS)
+ NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Content", "Visible name of the web process. The argument is the application name."), (NSString *)parameters.uiProcessName];
+ WKSetVisibleApplicationName((CFStringRef)applicationName);
+#endif
+}
+
+void WebProcess::platformInitializeProcess(const ChildProcessInitializationParameters&)
+{
+#if USE(APPKIT)
+ WKAXRegisterRemoteApp();
+#endif
+
+#if ENABLE(SEC_ITEM_SHIM)
+ SecItemShim::shared().initialize(this);
+#endif
+}
+
+#if USE(APPKIT)
+void WebProcess::stopRunLoop()
+{
+ ChildProcess::stopNSAppRunLoop();
+}
+#endif
+
+void WebProcess::platformTerminate()
+{
+ if (m_clearResourceCachesDispatchGroup) {
+ dispatch_group_wait(m_clearResourceCachesDispatchGroup, DISPATCH_TIME_FOREVER);
+ dispatch_release(m_clearResourceCachesDispatchGroup);
+ m_clearResourceCachesDispatchGroup = 0;
+ }
+}
+
+void WebProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters)
+{
+#if ENABLE(WEB_PROCESS_SANDBOX)
+ // Need to overide the default, because service has a different bundle ID.
+ NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKView")];
+ sandboxParameters.setOverrideSandboxProfilePath([webkit2Bundle pathForResource:@"com.apple.WebProcess" ofType:@"sb"]);
+
+ ChildProcess::initializeSandbox(parameters, sandboxParameters);
+#else
+ UNUSED_PARAM(parameters);
+ UNUSED_PARAM(sandboxParameters);
+#endif
+}
+
+void WebProcess::updateActivePages()
+{
+#if USE(APPKIT) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+ RetainPtr<CFMutableArrayRef> activePageURLs = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+ for (const auto& iter: m_pageMap) {
+ WebPage* page = iter.value.get();
+ WebFrame* mainFrame = page->mainWebFrame();
+ if (!mainFrame)
+ continue;
+ String mainFrameOriginString;
+ RefPtr<SecurityOrigin> mainFrameOrigin = SecurityOrigin::createFromString(mainFrame->url());
+ if (!mainFrameOrigin->isUnique())
+ mainFrameOriginString = mainFrameOrigin->toRawString();
+ else
+ mainFrameOriginString = URL(URL(), mainFrame->url()).protocol() + ':'; // toRawString() is not supposed to work with unique origins, and would just return "://".
+
+ NSURL *originAsNSURL = [NSURL URLWithString:mainFrameOriginString];
+ // +[NSURL URLWithString:] returns nil when its argument is malformed. It's unclear how we can possibly have a malformed URL here,
+ // but it happens in practice according to <rdar://problem/14173389>. Leaving an assertion in to catch a reproducible case.
+ ASSERT(originAsNSURL);
+ NSString *userVisibleOriginString = originAsNSURL ? userVisibleString(originAsNSURL) : @"(null)";
+
+ CFArrayAppendValue(activePageURLs.get(), userVisibleOriginString);
+ }
+ WKSetApplicationInformationItem(CFSTR("LSActivePageUserVisibleOriginsKey"), activePageURLs.get());
+#endif
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebProcessIOSmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/ios/WebProcessIOS.mm (164255 => 164256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebProcessIOS.mm        2014-02-18 00:08:02 UTC (rev 164255)
+++ trunk/Source/WebKit2/WebProcess/ios/WebProcessIOS.mm        2014-02-18 00:16:34 UTC (rev 164256)
</span><span class="lines">@@ -1,76 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 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.
- */
-
-#import "config.h"
-#import "WebProcess.h"
-
-#import "WebProcessCreationParameters.h"
-#import <WebCore/NotImplemented.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void WebProcess::initializeProcessName(const ChildProcessInitializationParameters&)
-{
- notImplemented();
-}
-
-void WebProcess::initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&)
-{
- notImplemented();
-}
-
-void WebProcess::platformSetCacheModel(CacheModel)
-{
- notImplemented();
-}
-
-void WebProcess::platformClearResourceCaches(ResourceCachesToClear)
-{
- notImplemented();
-}
-
-void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, IPC::MessageDecoder&)
-{
- m_presenterApplicationPid = parameters.presenterApplicationPid;
-}
-
-void WebProcess::platformInitializeProcess(const ChildProcessInitializationParameters&)
-{
- notImplemented();
-}
-
-void WebProcess::platformTerminate()
-{
- notImplemented();
-}
-
-void WebProcess::updateActivePages()
-{
- notImplemented();
-}
-
-} // namespace WebKit
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessmacWebProcessMacmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm (164255 => 164256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm        2014-02-18 00:08:02 UTC (rev 164255)
+++ trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm        2014-02-18 00:16:34 UTC (rev 164256)
</span><span class="lines">@@ -1,265 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 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.
- */
-
-#import "config.h"
-#import "WebProcess.h"
-
-#import "CustomProtocolManager.h"
-#import "SandboxExtension.h"
-#import "SandboxInitializationParameters.h"
-#import "SecItemShim.h"
-#import "WKFullKeyboardAccessWatcher.h"
-#import "WebFrame.h"
-#import "WebInspector.h"
-#import "WebPage.h"
-#import "WebProcessCreationParameters.h"
-#import "WebProcessProxyMessages.h"
-#import <JavaScriptCore/Options.h>
-#import <WebCore/AXObjectCache.h>
-#import <WebCore/FileSystem.h>
-#import <WebCore/Font.h>
-#import <WebCore/LocalizedStrings.h>
-#import <WebCore/MemoryCache.h>
-#import <WebCore/PageCache.h>
-#import <WebCore/WebCoreNSURLExtras.h>
-#import <WebKitSystemInterface.h>
-#import <algorithm>
-#import <dispatch/dispatch.h>
-#import <mach/host_info.h>
-#import <mach/mach.h>
-#import <mach/mach_error.h>
-#import <objc/runtime.h>
-#import <stdio.h>
-
-using namespace WebCore;
-
-const CFStringRef kLSActivePageUserVisibleOriginsKey = CFSTR("LSActivePageUserVisibleOriginsKey");
-
-namespace WebKit {
-
-static uint64_t memorySize()
-{
- static host_basic_info_data_t hostInfo;
-
- static dispatch_once_t once;
- dispatch_once(&once, ^() {
- mach_port_t host = mach_host_self();
- mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT;
- kern_return_t r = host_info(host, HOST_BASIC_INFO, (host_info_t)&hostInfo, &count);
- mach_port_deallocate(mach_task_self(), host);
-
- if (r != KERN_SUCCESS)
- LOG_ERROR("%s : host_info(%d) : %s.\n", __FUNCTION__, r, mach_error_string(r));
- });
-
- return hostInfo.max_mem;
-}
-
-static uint64_t volumeFreeSize(NSString *path)
-{
- NSDictionary *fileSystemAttributesDictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:path error:NULL];
- return [[fileSystemAttributesDictionary objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
-}
-
-void WebProcess::platformSetCacheModel(CacheModel cacheModel)
-{
- RetainPtr<NSString> nsurlCacheDirectory = adoptNS((NSString *)WKCopyFoundationCacheDirectory());
- if (!nsurlCacheDirectory)
- nsurlCacheDirectory = NSHomeDirectory();
-
- // As a fudge factor, use 1000 instead of 1024, in case the reported byte
- // count doesn't align exactly to a megabyte boundary.
- uint64_t memSize = memorySize() / 1024 / 1000;
- uint64_t diskFreeSize = volumeFreeSize(nsurlCacheDirectory.get()) / 1024 / 1000;
-
- unsigned cacheTotalCapacity = 0;
- unsigned cacheMinDeadCapacity = 0;
- unsigned cacheMaxDeadCapacity = 0;
- double deadDecodedDataDeletionInterval = 0;
- unsigned pageCacheCapacity = 0;
- unsigned long urlCacheMemoryCapacity = 0;
- unsigned long urlCacheDiskCapacity = 0;
-
- calculateCacheSizes(cacheModel, memSize, diskFreeSize,
- cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
- pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity);
-
-
- memoryCache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
- memoryCache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
- pageCache()->setCapacity(pageCacheCapacity);
-
- NSURLCache *nsurlCache = [NSURLCache sharedURLCache];
-
- // FIXME: Once there is no loading being done in the WebProcess, we should remove this,
- // as calling [NSURLCache sharedURLCache] initializes the cache, which we would rather not do.
- if (usesNetworkProcess()) {
- [nsurlCache setMemoryCapacity:0];
- [nsurlCache setDiskCapacity:0];
- return;
- }
-
- [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity];
- [nsurlCache setDiskCapacity:std::max<unsigned long>(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn.
-}
-
-void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear)
-{
- if (cachesToClear == InMemoryResourceCachesOnly)
- return;
-
- // If we're using the network process then it is the only one that needs to clear the disk cache.
- if (usesNetworkProcess())
- return;
-
- if (!m_clearResourceCachesDispatchGroup)
- m_clearResourceCachesDispatchGroup = dispatch_group_create();
-
- dispatch_group_async(m_clearResourceCachesDispatchGroup, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[NSURLCache sharedURLCache] removeAllCachedResponses];
- });
-}
-
-static id NSApplicationAccessibilityFocusedUIElement(NSApplication*, SEL)
-{
- WebPage* page = WebProcess::shared().focusedWebPage();
- if (!page || !page->accessibilityRemoteObject())
- return 0;
-
- return [page->accessibilityRemoteObject() accessibilityFocusedUIElement];
-}
-
-void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters& parameters, IPC::MessageDecoder&)
-{
- SandboxExtension::consumePermanently(parameters.uiProcessBundleResourcePathExtensionHandle);
- SandboxExtension::consumePermanently(parameters.localStorageDirectoryExtensionHandle);
- SandboxExtension::consumePermanently(parameters.databaseDirectoryExtensionHandle);
- SandboxExtension::consumePermanently(parameters.applicationCacheDirectoryExtensionHandle);
- SandboxExtension::consumePermanently(parameters.diskCacheDirectoryExtensionHandle);
-
- // When the network process is enabled, each web process wants a stand-alone
- // NSURLCache, which it can disable to save memory.
- if (!usesNetworkProcess()) {
- if (!parameters.diskCacheDirectory.isNull()) {
- [NSURLCache setSharedURLCache:adoptNS([[NSURLCache alloc]
- initWithMemoryCapacity:parameters.nsURLCacheMemoryCapacity
- diskCapacity:parameters.nsURLCacheDiskCapacity
- diskPath:parameters.diskCacheDirectory]).get()];
- }
- }
-
- m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution;
- Font::setDefaultTypesettingFeatures(parameters.shouldEnableKerningAndLigaturesByDefault ? Kerning | Ligatures : 0);
-
- if (!JSC::Options::useJITWasOverridden())
- JSC::Options::useJIT() = parameters.shouldEnableJIT;
-
- if (!JSC::Options::useFTLJITWasOverridden())
- JSC::Options::useFTLJIT() = parameters.shouldEnableFTL;
-
- m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
-
- m_presenterApplicationPid = parameters.presenterApplicationPid;
-
- setEnhancedAccessibility(parameters.accessibilityEnhancedUserInterfaceEnabled);
-
- // rdar://9118639 accessibilityFocusedUIElement in NSApplication defaults to use the keyWindow. Since there's
- // no window in WK2, NSApplication needs to use the focused page's focused element.
- Method methodToPatch = class_getInstanceMethod([NSApplication class], @selector(accessibilityFocusedUIElement));
- method_setImplementation(methodToPatch, (IMP)NSApplicationAccessibilityFocusedUIElement);
-}
-
-void WebProcess::initializeProcessName(const ChildProcessInitializationParameters& parameters)
-{
- NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Content", "Visible name of the web process. The argument is the application name."), (NSString *)parameters.uiProcessName];
- WKSetVisibleApplicationName((CFStringRef)applicationName);
-}
-
-void WebProcess::platformInitializeProcess(const ChildProcessInitializationParameters&)
-{
- WKAXRegisterRemoteApp();
-
-#if ENABLE(SEC_ITEM_SHIM)
- SecItemShim::shared().initialize(this);
-#endif
-}
-
-void WebProcess::stopRunLoop()
-{
- ChildProcess::stopNSAppRunLoop();
-}
-
-void WebProcess::platformTerminate()
-{
- if (m_clearResourceCachesDispatchGroup) {
- dispatch_group_wait(m_clearResourceCachesDispatchGroup, DISPATCH_TIME_FOREVER);
- dispatch_release(m_clearResourceCachesDispatchGroup);
- m_clearResourceCachesDispatchGroup = 0;
- }
-}
-
-void WebProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters)
-{
-#if PLATFORM(IOS)
- UNUSED_PARAM(parameters);
- UNUSED_PARAM(sandboxParameters);
-#else
- // Need to overide the default, because service has a different bundle ID.
- NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKView")];
- sandboxParameters.setOverrideSandboxProfilePath([webkit2Bundle pathForResource:@"com.apple.WebProcess" ofType:@"sb"]);
-
- ChildProcess::initializeSandbox(parameters, sandboxParameters);
-#endif
-}
-
-void WebProcess::updateActivePages()
-{
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
- RetainPtr<CFMutableArrayRef> activePageURLs = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
- for (const auto& iter: m_pageMap) {
- WebPage* page = iter.value.get();
- WebFrame* mainFrame = page->mainWebFrame();
- if (!mainFrame)
- continue;
- String mainFrameOriginString;
- RefPtr<SecurityOrigin> mainFrameOrigin = SecurityOrigin::createFromString(mainFrame->url());
- if (!mainFrameOrigin->isUnique())
- mainFrameOriginString = mainFrameOrigin->toRawString();
- else
- mainFrameOriginString = URL(URL(), mainFrame->url()).protocol() + ':'; // toRawString() is not supposed to work with unique origins, and would just return "://".
-
- NSURL *originAsNSURL = [NSURL URLWithString:mainFrameOriginString];
- // +[NSURL URLWithString:] returns nil when its argument is malformed. It's unclear how we can possibly have a malformed URL here,
- // but it happens in practice according to <rdar://problem/14173389>. Leaving an assertion in to catch a reproducible case.
- ASSERT(originAsNSURL);
- NSString *userVisibleOriginString = originAsNSURL ? userVisibleString(originAsNSURL) : @"(null)";
-
- CFArrayAppendValue(activePageURLs.get(), userVisibleOriginString);
- }
- WKSetApplicationInformationItem(kLSActivePageUserVisibleOriginsKey, activePageURLs.get());
-#endif
-}
-
-} // namespace WebKit
</del></span></pre>
</div>
</div>
</body>
</html>