328ee67f2bf30ea2851dd3ebecd192d99e896857
[WebKit-https.git] / Source / WebKit / WebProcess / cocoa / WebProcessCocoa.mm
1 /*
2  * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import "config.h"
27 #import "WebProcess.h"
28 #import "WebProcessCocoa.h"
29
30 #import "LegacyCustomProtocolManager.h"
31 #import "LogInitialization.h"
32 #import "Logging.h"
33 #import "ObjCObjectGraph.h"
34 #import "SandboxExtension.h"
35 #import "SandboxInitializationParameters.h"
36 #import "SecItemShim.h"
37 #import "SessionTracker.h"
38 #import "WKAPICast.h"
39 #import "WKBrowsingContextHandleInternal.h"
40 #import "WKCrashReporter.h"
41 #import "WKFullKeyboardAccessWatcher.h"
42 #import "WKTypeRefWrapper.h"
43 #import "WKWebProcessPlugInBrowserContextControllerInternal.h"
44 #import "WebFrame.h"
45 #import "WebInspector.h"
46 #import "WebPage.h"
47 #import "WebProcessCreationParameters.h"
48 #import "WebProcessProxyMessages.h"
49 #import "WebsiteDataStoreParameters.h"
50 #import <JavaScriptCore/Options.h>
51 #import <WebCore/AXObjectCache.h>
52 #import <WebCore/CPUMonitor.h>
53 #import <WebCore/FileSystem.h>
54 #import <WebCore/FontCache.h>
55 #import <WebCore/FontCascade.h>
56 #import <WebCore/LocalizedStrings.h>
57 #import <WebCore/LogInitialization.h>
58 #import <WebCore/MemoryRelease.h>
59 #import <WebCore/PerformanceLogging.h>
60 #import <WebCore/RuntimeApplicationChecks.h>
61 #import <WebCore/WebCoreNSURLExtras.h>
62 #import <algorithm>
63 #import <dispatch/dispatch.h>
64 #import <objc/runtime.h>
65 #import <pal/spi/cf/CFNetworkSPI.h>
66 #import <pal/spi/cocoa/LaunchServicesSPI.h>
67 #import <pal/spi/cocoa/QuartzCoreSPI.h>
68 #import <pal/spi/cocoa/pthreadSPI.h>
69 #import <pal/spi/mac/NSAccessibilitySPI.h>
70 #import <pal/spi/mac/NSApplicationSPI.h>
71 #import <runtime/ConfigFile.h>
72 #import <stdio.h>
73
74 #if PLATFORM(IOS)
75 #import <UIKit/UIAccessibility.h>
76 #import <pal/spi/ios/GraphicsServicesSPI.h>
77
78 #if USE(APPLE_INTERNAL_SDK)
79 #import <AXRuntime/AXDefines.h>
80 #import <AXRuntime/AXNotificationConstants.h>
81 #else
82 #define kAXPidStatusChangedNotification 0
83 #endif
84
85 #endif
86
87 #if USE(OS_STATE)
88 #import <os/state_private.h>
89 #endif
90
91 using namespace WebCore;
92
93 namespace WebKit {
94
95 #if PLATFORM(MAC)
96 static const Seconds cpuMonitoringInterval { 8_min };
97 #endif
98
99 void WebProcess::platformSetCacheModel(CacheModel)
100 {
101 }
102
103 #if USE(APPKIT)
104 static id NSApplicationAccessibilityFocusedUIElement(NSApplication*, SEL)
105 {
106     WebPage* page = WebProcess::singleton().focusedWebPage();
107     if (!page || !page->accessibilityRemoteObject())
108         return 0;
109
110     return [page->accessibilityRemoteObject() accessibilityFocusedUIElement];
111 }
112 #endif
113
114 void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& parameters)
115 {
116 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED
117     WebCore::initializeLogChannelsIfNecessary(parameters.webCoreLoggingChannels);
118     WebKit::initializeLogChannelsIfNecessary(parameters.webKitLoggingChannels);
119 #endif
120
121     WebCore::setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier);
122     SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier);
123
124 #if ENABLE(SANDBOX_EXTENSIONS)
125     SandboxExtension::consumePermanently(parameters.uiProcessBundleResourcePathExtensionHandle);
126     SandboxExtension::consumePermanently(parameters.webSQLDatabaseDirectoryExtensionHandle);
127     SandboxExtension::consumePermanently(parameters.applicationCacheDirectoryExtensionHandle);
128     SandboxExtension::consumePermanently(parameters.mediaCacheDirectoryExtensionHandle);
129     SandboxExtension::consumePermanently(parameters.mediaKeyStorageDirectoryExtensionHandle);
130     SandboxExtension::consumePermanently(parameters.javaScriptConfigurationDirectoryExtensionHandle);
131 #if ENABLE(MEDIA_STREAM)
132     SandboxExtension::consumePermanently(parameters.audioCaptureExtensionHandle);
133 #endif
134 #if PLATFORM(IOS)
135     SandboxExtension::consumePermanently(parameters.cookieStorageDirectoryExtensionHandle);
136     SandboxExtension::consumePermanently(parameters.containerCachesDirectoryExtensionHandle);
137     SandboxExtension::consumePermanently(parameters.containerTemporaryDirectoryExtensionHandle);
138 #endif
139 #endif
140
141     if (!parameters.javaScriptConfigurationDirectory.isEmpty()) {
142         String javaScriptConfigFile = parameters.javaScriptConfigurationDirectory + "/JSC.config";
143         JSC::processConfigFile(javaScriptConfigFile.latin1().data(), "com.apple.WebKit.WebContent", parameters.uiProcessBundleIdentifier.latin1().data());
144     }
145
146 #if PLATFORM(MAC)
147     setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier);
148 #endif
149
150     auto urlCache = adoptNS([[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]);
151     [NSURLCache setSharedURLCache:urlCache.get()];
152
153 #if PLATFORM(MAC)
154     WebCore::FontCache::setFontWhitelist(parameters.fontWhitelist);
155 #endif
156
157     m_compositingRenderServerPort = WTFMove(parameters.acceleratedCompositingPort);
158
159     WebCore::registerMemoryReleaseNotifyCallbacks();
160     MemoryPressureHandler::ReliefLogger::setLoggingEnabled(parameters.shouldEnableMemoryPressureReliefLogging);
161
162     setEnhancedAccessibility(parameters.accessibilityEnhancedUserInterfaceEnabled);
163
164 #if USE(APPKIT)
165     [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions" : @YES }];
166
167     // rdar://9118639 accessibilityFocusedUIElement in NSApplication defaults to use the keyWindow. Since there's
168     // no window in WK2, NSApplication needs to use the focused page's focused element.
169     Method methodToPatch = class_getInstanceMethod([NSApplication class], @selector(accessibilityFocusedUIElement));
170     method_setImplementation(methodToPatch, (IMP)NSApplicationAccessibilityFocusedUIElement);
171 #endif
172     
173 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
174     // Need to initialize accessibility for VoiceOver to work when the WebContent process is using NSRunLoop.
175     // Currently, it is also needed to allocate and initialize an NSApplication object.
176     // FIXME: Remove the following line when rdar://problem/36323569 is fixed.
177     [NSApplication sharedApplication];
178     [NSApplication _accessibilityInitialize];
179 #endif
180     
181     _CFNetworkSetATSContext(parameters.networkATSContext.get());
182
183 #if TARGET_OS_IPHONE
184     // Priority decay on iOS 9 is impacting page load time so we fix the priority of the WebProcess' main thread (rdar://problem/22003112).
185     pthread_set_fixedpriority_self();
186 #endif
187 }
188
189 void WebProcess::initializeProcessName(const ChildProcessInitializationParameters& parameters)
190 {
191 #if !PLATFORM(IOS)
192     NSString *applicationName;
193     if (parameters.extraInitializationData.get(ASCIILiteral("inspector-process")) == "1")
194         applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Inspector", "Visible name of Web Inspector's web process. The argument is the application name."), (NSString *)parameters.uiProcessName];
195 #if ENABLE(SERVICE_WORKER)
196     else if (parameters.extraInitializationData.get(ASCIILiteral("service-worker-process")) == "1")
197         applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Service Worker", "Visible name of Service Worker process. The argument is the application name."), (NSString *)parameters.uiProcessName];
198 #endif
199     else
200         applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Web Content", "Visible name of the web process. The argument is the application name."), (NSString *)parameters.uiProcessName];
201     _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName, nullptr);
202 #endif
203 }
204
205 static void registerWithAccessibility()
206 {
207 #if USE(APPKIT)
208     [NSAccessibilityRemoteUIElement setRemoteUIApp:YES];
209 #endif
210 #if PLATFORM(IOS)
211     NSString *accessibilityBundlePath = [(NSString *)GSSystemRootDirectory() stringByAppendingString:@"/System/Library/AccessibilityBundles/WebProcessLoader.axbundle"];
212     NSError *error = nil;
213     if (![[NSBundle bundleWithPath:accessibilityBundlePath] loadAndReturnError:&error])
214         LOG_ERROR("Failed to load accessibility bundle at %@: %@", accessibilityBundlePath, error);
215 #endif
216 }
217
218 #if USE(OS_STATE)
219 void WebProcess::registerWithStateDumper()
220 {
221     os_state_add_handler(dispatch_get_main_queue(), ^(os_state_hints_t hints) {
222
223         @autoreleasepool {
224             os_state_data_t os_state = nil;
225
226             // Only gather state on faults and sysdiagnose. It's overkill for
227             // general error messages.
228             if (hints->osh_api == OS_STATE_API_ERROR)
229                 return os_state;
230
231             // Create a dictionary to contain the collected state. This
232             // dictionary will be serialized and passed back to os_state.
233             auto stateDict = adoptNS([[NSMutableDictionary alloc] init]);
234
235             {
236                 auto memoryUsageStats = adoptNS([[NSMutableDictionary alloc] init]);
237                 for (auto& it : PerformanceLogging::memoryUsageStatistics(ShouldIncludeExpensiveComputations::Yes)) {
238                     auto keyString = adoptNS([[NSString alloc] initWithUTF8String:it.key]);
239                     [memoryUsageStats setObject:@(it.value) forKey:keyString.get()];
240                 }
241                 [stateDict setObject:memoryUsageStats.get() forKey:@"Memory Usage Stats"];
242             }
243
244             {
245                 auto jsObjectCounts = adoptNS([[NSMutableDictionary alloc] init]);
246                 for (auto& it : PerformanceLogging::javaScriptObjectCounts()) {
247                     auto keyString = adoptNS([[NSString alloc] initWithUTF8String:it.key]);
248                     [jsObjectCounts setObject:@(it.value) forKey:keyString.get()];
249                 }
250                 [stateDict setObject:jsObjectCounts.get() forKey:@"JavaScript Object Counts"];
251             }
252
253             auto pageLoadTimes = adoptNS([[NSMutableArray alloc] init]);
254             for (auto& page : m_pageMap.values()) {
255                 if (page->usesEphemeralSession())
256                     continue;
257
258                 NSDate* date = [NSDate dateWithTimeIntervalSince1970:page->loadCommitTime().secondsSinceEpoch().seconds()];
259                 [pageLoadTimes addObject:date];
260             }
261
262             // Adding an empty array to the process state may provide an
263             // indication of the existance of private sessions, which we'd like
264             // to hide, so don't add empty arrays.
265             if ([pageLoadTimes count])
266                 [stateDict setObject:pageLoadTimes.get() forKey:@"Page Load Times"];
267
268             // --- Possibly add other state here as other entries in the dictionary. ---
269
270             // Submitting an empty process state object may provide an
271             // indication of the existance of private sessions, which we'd like
272             // to hide, so don't return empty dictionaries.
273             if (![stateDict count])
274                 return os_state;
275
276             // Serialize the accumulated process state so that we can put the
277             // result in an os_state_data_t structure.
278             NSError* error = nil;
279             NSData* data = [NSPropertyListSerialization dataWithPropertyList:stateDict.get() format:NSPropertyListBinaryFormat_v1_0 options:0 error:&error];
280
281             if (!data) {
282                 ASSERT(data);
283                 return os_state;
284             }
285
286             size_t neededSize = OS_STATE_DATA_SIZE_NEEDED(data.length);
287             os_state = (os_state_data_t)malloc(neededSize);
288             if (os_state) {
289                 memset(os_state, 0, neededSize);
290                 os_state->osd_type = OS_STATE_DATA_SERIALIZED_NSCF_OBJECT;
291                 os_state->osd_data_size = data.length;
292                 strlcpy(os_state->osd_title, "WebContent state", sizeof(os_state->osd_title));
293                 memcpy(os_state->osd_data, data.bytes, data.length);
294             }
295
296             return os_state;
297         }
298     });
299 }
300 #endif
301
302 void WebProcess::platformInitializeProcess(const ChildProcessInitializationParameters&)
303 {
304     registerWithAccessibility();
305
306 #if USE(OS_STATE)
307     registerWithStateDumper();
308 #endif
309
310 #if ENABLE(SEC_ITEM_SHIM)
311     initializeSecItemShim(*this);
312 #endif
313 }
314
315 #if USE(APPKIT)
316 void WebProcess::stopRunLoop()
317 {
318     ChildProcess::stopNSAppRunLoop();
319 }
320 #endif
321
322 void WebProcess::platformTerminate()
323 {
324 }
325
326 RetainPtr<CFDataRef> WebProcess::sourceApplicationAuditData() const
327 {
328 #if PLATFORM(IOS)
329     audit_token_t auditToken;
330     ASSERT(parentProcessConnection());
331     if (!parentProcessConnection() || !parentProcessConnection()->getAuditToken(auditToken))
332         return nullptr;
333     return adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken)));
334 #else
335     return nullptr;
336 #endif
337 }
338
339 void WebProcess::initializeSandbox(const ChildProcessInitializationParameters& parameters, SandboxInitializationParameters& sandboxParameters)
340 {
341 #if ENABLE(WEB_PROCESS_SANDBOX)
342 #if ENABLE(MANUAL_SANDBOXING)
343     // Need to override the default, because service has a different bundle ID.
344 #if WK_API_ENABLED
345     NSBundle *webKit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKWebView")];
346 #else
347     NSBundle *webKit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKView")];
348 #endif
349 #if PLATFORM(IOS)
350     sandboxParameters.setOverrideSandboxProfilePath([webKit2Bundle pathForResource:@"com.apple.WebKit.WebContent" ofType:@"sb"]);
351 #else
352     sandboxParameters.setOverrideSandboxProfilePath([webKit2Bundle pathForResource:@"com.apple.WebProcess" ofType:@"sb"]);
353 #endif
354     ChildProcess::initializeSandbox(parameters, sandboxParameters);
355 #endif
356 #else
357     UNUSED_PARAM(parameters);
358     UNUSED_PARAM(sandboxParameters);
359 #endif
360 }
361
362 #if PLATFORM(MAC)
363
364 static NSURL *origin(WebPage& page)
365 {
366     WebFrame* mainFrame = page.mainWebFrame();
367     if (!mainFrame)
368         return nil;
369
370     URL mainFrameURL(URL(), mainFrame->url());
371     Ref<SecurityOrigin> mainFrameOrigin = SecurityOrigin::create(mainFrameURL);
372     String mainFrameOriginString;
373     if (!mainFrameOrigin->isUnique())
374         mainFrameOriginString = mainFrameOrigin->toRawString();
375     else
376         mainFrameOriginString = makeString(mainFrameURL.protocol(), ':'); // toRawString() is not supposed to work with unique origins, and would just return "://".
377
378     // +[NSURL URLWithString:] returns nil when its argument is malformed. It's unclear when we would have a malformed URL here,
379     // but it happens in practice according to <rdar://problem/14173389>. Leaving an assertion in to catch a reproducible case.
380     ASSERT([NSURL URLWithString:mainFrameOriginString]);
381
382     return [NSURL URLWithString:mainFrameOriginString];
383 }
384
385 #endif
386
387 void WebProcess::updateActivePages()
388 {
389 #if PLATFORM(MAC)
390     auto activePageURLs = adoptNS([[NSMutableArray alloc] init]);
391
392     for (auto& page : m_pageMap.values()) {
393         if (page->usesEphemeralSession())
394             continue;
395
396         if (NSURL *originAsURL = origin(*page))
397             [activePageURLs addObject:userVisibleString(originAsURL)];
398     }
399
400     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), [activePageURLs] {
401         _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), CFSTR("LSActivePageUserVisibleOriginsKey"), (__bridge CFArrayRef)activePageURLs.get(), nullptr);
402     });
403 #endif
404 }
405
406 void WebProcess::updateCPULimit()
407 {
408 #if PLATFORM(MAC)
409     std::optional<double> cpuLimit;
410
411     // Use the largest limit among all pages in this process.
412     for (auto& page : m_pageMap.values()) {
413         auto pageCPULimit = page->cpuLimit();
414         if (!pageCPULimit) {
415             cpuLimit = std::nullopt;
416             break;
417         }
418         if (!cpuLimit || pageCPULimit > cpuLimit.value())
419             cpuLimit = pageCPULimit;
420     }
421
422     if (m_cpuLimit == cpuLimit)
423         return;
424
425     m_cpuLimit = cpuLimit;
426     updateCPUMonitorState(CPUMonitorUpdateReason::LimitHasChanged);
427 #endif
428 }
429
430 void WebProcess::updateCPUMonitorState(CPUMonitorUpdateReason reason)
431 {
432 #if PLATFORM(MAC)
433     if (!m_cpuLimit) {
434         if (m_cpuMonitor)
435             m_cpuMonitor->setCPULimit(std::nullopt);
436         return;
437     }
438
439     if (!m_cpuMonitor) {
440         m_cpuMonitor = std::make_unique<CPUMonitor>(cpuMonitoringInterval, [this](double cpuUsage) {
441             RELEASE_LOG(PerformanceLogging, "%p - WebProcess exceeded CPU limit of %.1f%% (was using %.1f%%) hasVisiblePages? %d", this, m_cpuLimit.value() * 100, cpuUsage * 100, hasVisibleWebPage());
442             parentProcessConnection()->send(Messages::WebProcessProxy::DidExceedCPULimit(), 0);
443         });
444     } else if (reason == CPUMonitorUpdateReason::VisibilityHasChanged) {
445         // If the visibility has changed, stop the CPU monitor before setting its limit. This is needed because the CPU usage can vary wildly based on visibility and we would
446         // not want to report that a process has exceeded its background CPU limit even though most of the CPU time was used while the process was visible.
447         m_cpuMonitor->setCPULimit(std::nullopt);
448     }
449     m_cpuMonitor->setCPULimit(m_cpuLimit.value());
450 #else
451     UNUSED_PARAM(reason);
452 #endif
453 }
454
455 RefPtr<ObjCObjectGraph> WebProcess::transformHandlesToObjects(ObjCObjectGraph& objectGraph)
456 {
457     struct Transformer final : ObjCObjectGraph::Transformer {
458         Transformer(WebProcess& webProcess)
459             : m_webProcess(webProcess)
460         {
461         }
462
463         bool shouldTransformObject(id object) const override
464         {
465 #if WK_API_ENABLED
466             if (dynamic_objc_cast<WKBrowsingContextHandle>(object))
467                 return true;
468
469             if (dynamic_objc_cast<WKTypeRefWrapper>(object))
470                 return true;
471 #endif
472             return false;
473         }
474
475         RetainPtr<id> transformObject(id object) const override
476         {
477 #if WK_API_ENABLED
478             if (auto* handle = dynamic_objc_cast<WKBrowsingContextHandle>(object)) {
479                 if (auto* webPage = m_webProcess.webPage(handle._pageID))
480                     return wrapper(*webPage);
481
482                 return [NSNull null];
483             }
484
485             if (auto* wrapper = dynamic_objc_cast<WKTypeRefWrapper>(object))
486                 return adoptNS([[WKTypeRefWrapper alloc] initWithObject:toAPI(m_webProcess.transformHandlesToObjects(toImpl(wrapper.object)).get())]);
487 #endif
488             return object;
489         }
490
491         WebProcess& m_webProcess;
492     };
493
494     return ObjCObjectGraph::create(ObjCObjectGraph::transform(objectGraph.rootObject(), Transformer(*this)).get());
495 }
496
497 RefPtr<ObjCObjectGraph> WebProcess::transformObjectsToHandles(ObjCObjectGraph& objectGraph)
498 {
499     struct Transformer final : ObjCObjectGraph::Transformer {
500         bool shouldTransformObject(id object) const override
501         {
502 #if WK_API_ENABLED
503             if (dynamic_objc_cast<WKWebProcessPlugInBrowserContextController>(object))
504                 return true;
505
506             if (dynamic_objc_cast<WKTypeRefWrapper>(object))
507                 return true;
508 #endif
509
510             return false;
511         }
512
513         RetainPtr<id> transformObject(id object) const override
514         {
515 #if WK_API_ENABLED
516             if (auto* controller = dynamic_objc_cast<WKWebProcessPlugInBrowserContextController>(object))
517                 return controller.handle;
518
519             if (auto* wrapper = dynamic_objc_cast<WKTypeRefWrapper>(object))
520                 return adoptNS([[WKTypeRefWrapper alloc] initWithObject:toAPI(transformObjectsToHandles(toImpl(wrapper.object)).get())]);
521 #endif
522             return object;
523         }
524     };
525
526     return ObjCObjectGraph::create(ObjCObjectGraph::transform(objectGraph.rootObject(), Transformer()).get());
527 }
528
529 void WebProcess::destroyRenderingResources()
530 {
531 #if !RELEASE_LOG_DISABLED
532     double startTime = monotonicallyIncreasingTime();
533 #endif
534     CABackingStoreCollectBlocking();
535 #if !RELEASE_LOG_DISABLED
536     double endTime = monotonicallyIncreasingTime();
537 #endif
538     RELEASE_LOG(ProcessSuspension, "%p - WebProcess::destroyRenderingResources() took %.2fms", this, (endTime - startTime) * 1000.0);
539 }
540
541 // FIXME: This should live somewhere else, and it should have the implementation in line instead of calling out to WKSI.
542 void _WKSetCrashReportApplicationSpecificInformation(NSString *infoString)
543 {
544     return setCrashReportApplicationSpecificInformation((__bridge CFStringRef)infoString);
545 }
546
547 #if PLATFORM(IOS)
548 void WebProcess::accessibilityProcessSuspendedNotification(bool suspended)
549 {
550     UIAccessibilityPostNotification(kAXPidStatusChangedNotification, @{ @"pid" : @(getpid()), @"suspended" : @(suspended) });
551 }
552 #endif
553
554 } // namespace WebKit