61e062e557a9fe139d1e97589cace66dde345920
[WebKit.git] / Source / WebKit / WebProcess / WebProcess.h
1 /*
2  * Copyright (C) 2010-2018 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 #pragma once
27
28 #include "AuxiliaryProcess.h"
29 #include "CacheModel.h"
30 #if ENABLE(MEDIA_STREAM)
31 #include "MediaDeviceSandboxExtensions.h"
32 #endif
33 #include "PluginProcessConnectionManager.h"
34 #include "ResourceCachesToClear.h"
35 #include "SandboxExtension.h"
36 #include "StorageAreaIdentifier.h"
37 #include "TextCheckerState.h"
38 #include "UserContentControllerIdentifier.h"
39 #include "ViewUpdateDispatcher.h"
40 #include "WebInspectorInterruptDispatcher.h"
41 #include "WebPageProxyIdentifier.h"
42 #include "WebProcessCreationParameters.h"
43 #include "WebSQLiteDatabaseTracker.h"
44 #include "WebSocketChannelManager.h"
45 #include <WebCore/ActivityState.h>
46 #include <WebCore/FrameIdentifier.h>
47 #include <WebCore/NetworkStorageSession.h>
48 #include <WebCore/PageIdentifier.h>
49 #include <WebCore/RegistrableDomain.h>
50 #if PLATFORM(MAC)
51 #include <WebCore/ScreenProperties.h>
52 #endif
53 #include <WebCore/ServiceWorkerTypes.h>
54 #include <WebCore/Timer.h>
55 #include <pal/HysteresisActivity.h>
56 #include <pal/SessionID.h>
57 #include <wtf/Forward.h>
58 #include <wtf/HashCountedSet.h>
59 #include <wtf/HashSet.h>
60 #include <wtf/RefCounter.h>
61 #include <wtf/text/AtomString.h>
62 #include <wtf/text/AtomStringHash.h>
63
64 #if PLATFORM(COCOA)
65 #include <dispatch/dispatch.h>
66 #include <wtf/MachSendRight.h>
67 #endif
68
69 #if PLATFORM(IOS_FAMILY)
70 #include "ProcessTaskStateObserver.h"
71 OBJC_CLASS BKSProcessAssertion;
72 #endif
73
74 #if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
75 #include <WebCore/PlatformDisplayLibWPE.h>
76 #endif
77
78 namespace API {
79 class Object;
80 }
81
82 namespace PAL {
83 class SessionID;
84 }
85
86 namespace WebCore {
87 class ApplicationCacheStorage;
88 class CPUMonitor;
89 class CertificateInfo;
90 class PageGroup;
91 class RegistrableDomain;
92 class ResourceRequest;
93 class UserGestureToken;
94 struct BackForwardItemIdentifier;
95 struct MessagePortIdentifier;
96 struct MessageWithMessagePorts;
97 struct MockMediaDevice;
98 struct PluginInfo;
99 struct PrewarmInformation;
100 struct SecurityOriginData;
101
102 #if ENABLE(SERVICE_WORKER)
103 struct ServiceWorkerContextData;
104 #endif
105 }
106
107 namespace WebKit {
108
109 class EventDispatcher;
110 class GamepadData;
111 class GPUProcessConnection;
112 class InjectedBundle;
113 class LibWebRTCCodecs;
114 class LibWebRTCNetwork;
115 class NetworkProcessConnection;
116 class ObjCObjectGraph;
117 struct ServiceWorkerInitializationData;
118 class StorageAreaMap;
119 class UserData;
120 class WaylandCompositorDisplay;
121 class WebAutomationSessionProxy;
122 class WebCacheStorageProvider;
123 class WebCompiledContentRuleListData;
124 class WebConnectionToUIProcess;
125 class WebFrame;
126 class WebLoaderStrategy;
127 class WebPage;
128 class WebPageGroupProxy;
129 struct UserMessage;
130 struct WebProcessCreationParameters;
131 struct WebProcessDataStoreParameters;
132 class WebProcessSupplement;
133 enum class WebsiteDataType;
134 struct WebPageCreationParameters;
135 struct WebPageGroupData;
136 struct WebPreferencesStore;
137 struct WebsiteData;
138 struct WebsiteDataStoreParameters;
139
140 #if PLATFORM(IOS_FAMILY)
141 class LayerHostingContext;
142 #endif
143
144 class WebProcess
145     : public AuxiliaryProcess
146 #if PLATFORM(IOS_FAMILY)
147     , ProcessTaskStateObserver::Client
148 #endif
149 {
150     WTF_MAKE_FAST_ALLOCATED;
151 public:
152     static WebProcess& singleton();
153     static constexpr ProcessType processType = ProcessType::WebContent;
154
155     template <typename T>
156     T* supplement()
157     {
158         return static_cast<T*>(m_supplements.get(T::supplementName()));
159     }
160
161     template <typename T>
162     void addSupplement()
163     {
164         m_supplements.add(T::supplementName(), makeUnique<T>(*this));
165     }
166
167     WebConnectionToUIProcess* webConnectionToUIProcess() const { return m_webConnection.get(); }
168
169     WebPage* webPage(WebCore::PageIdentifier) const;
170     void createWebPage(WebCore::PageIdentifier, WebPageCreationParameters&&);
171     void removeWebPage(WebCore::PageIdentifier);
172     WebPage* focusedWebPage() const;
173
174     InjectedBundle* injectedBundle() const { return m_injectedBundle.get(); }
175     
176     PAL::SessionID sessionID() const { ASSERT(m_sessionID); return *m_sessionID; }
177
178 #if ENABLE(RESOURCE_LOAD_STATISTICS)
179     WebCore::ThirdPartyCookieBlockingMode thirdPartyCookieBlockingMode() const { return m_thirdPartyCookieBlockingMode; }
180 #endif
181
182 #if PLATFORM(COCOA)
183     const WTF::MachSendRight& compositingRenderServerPort() const { return m_compositingRenderServerPort; }
184 #endif
185
186     bool shouldPlugInAutoStartFromOrigin(WebPage&, const String& pageOrigin, const String& pluginOrigin, const String& mimeType);
187     void plugInDidStartFromOrigin(const String& pageOrigin, const String& pluginOrigin, const String& mimeType);
188     void plugInDidReceiveUserInteraction(const String& pageOrigin, const String& pluginOrigin, const String& mimeType);
189     void setPluginLoadClientPolicy(uint8_t policy, const String& host, const String& bundleIdentifier, const String& versionString);
190     void resetPluginLoadClientPolicies(const HashMap<String, HashMap<String, HashMap<String, uint8_t>>>&);
191     void clearPluginClientPolicies();
192     void refreshPlugins();
193
194     bool fullKeyboardAccessEnabled() const { return m_fullKeyboardAccessEnabled; }
195
196     WebFrame* webFrame(WebCore::FrameIdentifier) const;
197     void addWebFrame(WebCore::FrameIdentifier, WebFrame*);
198     void removeWebFrame(WebCore::FrameIdentifier);
199
200     WebPageGroupProxy* webPageGroup(WebCore::PageGroup*);
201     WebPageGroupProxy* webPageGroup(uint64_t pageGroupID);
202     WebPageGroupProxy* webPageGroup(const WebPageGroupData&);
203
204     uint64_t userGestureTokenIdentifier(RefPtr<WebCore::UserGestureToken>);
205     void userGestureTokenDestroyed(WebCore::UserGestureToken&);
206     
207     const TextCheckerState& textCheckerState() const { return m_textCheckerState; }
208     void setTextCheckerState(const TextCheckerState&);
209
210     void clearResourceCaches(ResourceCachesToClear = AllResourceCaches);
211     
212 #if ENABLE(NETSCAPE_PLUGIN_API)
213     PluginProcessConnectionManager& pluginProcessConnectionManager();
214 #endif
215
216     EventDispatcher& eventDispatcher() { return m_eventDispatcher.get(); }
217
218     NetworkProcessConnection& ensureNetworkProcessConnection();
219     void networkProcessConnectionClosed(NetworkProcessConnection*);
220     NetworkProcessConnection* existingNetworkProcessConnection() { return m_networkProcessConnection.get(); }
221     WebLoaderStrategy& webLoaderStrategy();
222
223 #if ENABLE(GPU_PROCESS)
224     GPUProcessConnection& ensureGPUProcessConnection();
225     void gpuProcessConnectionClosed(GPUProcessConnection*);
226     GPUProcessConnection* existingGPUProcessConnection() { return m_gpuProcessConnection.get(); }
227
228 #if PLATFORM(COCOA) && USE(LIBWEBRTC)
229     LibWebRTCCodecs& libWebRTCCodecs();
230 #endif
231
232 #endif // ENABLE(GPU_PROCESS)
233
234     LibWebRTCNetwork& libWebRTCNetwork();
235
236     void setCacheModel(CacheModel);
237
238     void pageDidEnterWindow(WebCore::PageIdentifier);
239     void pageWillLeaveWindow(WebCore::PageIdentifier);
240
241     void nonVisibleProcessCleanupTimerFired();
242
243     void registerStorageAreaMap(StorageAreaMap&);
244     void unregisterStorageAreaMap(StorageAreaMap&);
245     StorageAreaMap* storageAreaMap(StorageAreaIdentifier) const;
246
247 #if PLATFORM(COCOA)
248     RetainPtr<CFDataRef> sourceApplicationAuditData() const;
249     void destroyRenderingResources();
250 #endif
251
252     const String& uiProcessBundleIdentifier() const { return m_uiProcessBundleIdentifier; }
253
254     void updateActivePages();
255     void getActivePagesOriginsForTesting(CompletionHandler<void(Vector<String>&&)>&&);
256     void pageActivityStateDidChange(WebCore::PageIdentifier, OptionSet<WebCore::ActivityState::Flag> changed);
257
258     void setHiddenPageDOMTimerThrottlingIncreaseLimit(int milliseconds);
259
260     void prepareToSuspend(bool isSuspensionImminent, CompletionHandler<void()>&&);
261     void processDidResume();
262
263     void sendPrewarmInformation(const URL&);
264
265     void isJITEnabled(CompletionHandler<void(bool)>&&);
266
267 #if PLATFORM(IOS_FAMILY)
268     void resetAllGeolocationPermissions();
269 #endif
270
271 #if PLATFORM(WAYLAND)
272     WaylandCompositorDisplay* waylandCompositorDisplay() const { return m_waylandCompositorDisplay.get(); }
273 #endif
274
275     RefPtr<API::Object> transformHandlesToObjects(API::Object*);
276     static RefPtr<API::Object> transformObjectsToHandles(API::Object*);
277
278 #if PLATFORM(COCOA)
279     RefPtr<ObjCObjectGraph> transformHandlesToObjects(ObjCObjectGraph&);
280     static RefPtr<ObjCObjectGraph> transformObjectsToHandles(ObjCObjectGraph&);
281 #endif
282
283 #if ENABLE(SERVICE_CONTROLS)
284     bool hasImageServices() const { return m_hasImageServices; }
285     bool hasSelectionServices() const { return m_hasSelectionServices; }
286     bool hasRichContentServices() const { return m_hasRichContentServices; }
287 #endif
288
289     WebCore::ApplicationCacheStorage& applicationCacheStorage() { return *m_applicationCacheStorage; }
290
291     void prefetchDNS(const String&);
292
293     WebAutomationSessionProxy* automationSessionProxy() { return m_automationSessionProxy.get(); }
294
295     WebCacheStorageProvider& cacheStorageProvider() { return m_cacheStorageProvider.get(); }
296     WebSocketChannelManager& webSocketChannelManager() { return m_webSocketChannelManager; }
297
298 #if PLATFORM(IOS_FAMILY)
299     void accessibilityProcessSuspendedNotification(bool);
300     
301     void unblockAccessibilityServer(const SandboxExtension::Handle&);
302 #endif
303
304 #if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
305     float backlightLevel() const { return m_backlightLevel; }
306 #endif
307
308 #if PLATFORM(COCOA)
309     void setMediaMIMETypes(const Vector<String>);
310 #if ENABLE(REMOTE_INSPECTOR)
311     void enableRemoteWebInspector(const SandboxExtension::Handle&);
312 #endif
313     void notifyPreferencesChanged(const String& domain, const String& key, const Optional<String>& encodedValue);
314 #endif
315
316     bool areAllPagesThrottleable() const;
317
318     void messagesAvailableForPort(const WebCore::MessagePortIdentifier&);
319
320 #if ENABLE(SERVICE_WORKER)
321     void addServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier);
322     bool removeServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier);
323 #endif
324
325 #if PLATFORM(IOS)
326     void grantAccessToAssetServices(WebKit::SandboxExtension::Handle&& mobileAssetHandle,  WebKit::SandboxExtension::Handle&& mobileAssetV2Handle);
327     void revokeAccessToAssetServices();
328 #endif
329
330 #if PLATFORM(MAC)
331     void updatePageScreenProperties();
332 #endif
333
334 private:
335     WebProcess();
336     ~WebProcess();
337
338     void initializeWebProcess(WebProcessCreationParameters&&);
339     void platformInitializeWebProcess(WebProcessCreationParameters&);
340     void setWebsiteDataStoreParameters(WebProcessDataStoreParameters&&);
341     void platformSetWebsiteDataStoreParameters(WebProcessDataStoreParameters&&);
342
343     void prewarmGlobally();
344     void prewarmWithDomainInformation(const WebCore::PrewarmInformation&);
345
346 #if USE(OS_STATE)
347     void registerWithStateDumper();
348 #endif
349
350     void markAllLayersVolatile(WTF::Function<void(bool)>&& completionHandler);
351     void cancelMarkAllLayersVolatile();
352
353     void freezeAllLayerTrees();
354     void unfreezeAllLayerTrees();
355
356     void processSuspensionCleanupTimerFired();
357
358     void platformTerminate();
359
360     void setHasSuspendedPageProxy(bool);
361     void setIsInProcessCache(bool);
362     void markIsNoLongerPrewarmed();
363
364     void registerURLSchemeAsEmptyDocument(const String&);
365     void registerURLSchemeAsSecure(const String&) const;
366     void registerURLSchemeAsBypassingContentSecurityPolicy(const String&) const;
367     void setDomainRelaxationForbiddenForURLScheme(const String&) const;
368     void registerURLSchemeAsLocal(const String&) const;
369     void registerURLSchemeAsNoAccess(const String&) const;
370     void registerURLSchemeAsDisplayIsolated(const String&) const;
371     void registerURLSchemeAsCORSEnabled(const String&);
372     void registerURLSchemeAsAlwaysRevalidated(const String&) const;
373     void registerURLSchemeAsCachePartitioned(const String&) const;
374     void registerURLSchemeAsCanDisplayOnlyIfCanRequest(const String&) const;
375
376     void setDefaultRequestTimeoutInterval(double);
377     void setAlwaysUsesComplexTextCodePath(bool);
378     void setShouldUseFontSmoothing(bool);
379     void setResourceLoadStatisticsEnabled(bool);
380     void clearResourceLoadStatistics();
381     void flushResourceLoadStatistics();
382     void seedResourceLoadStatisticsForTesting(const WebCore::RegistrableDomain& firstPartyDomain, const WebCore::RegistrableDomain& thirdPartyDomain, bool shouldScheduleNotification, CompletionHandler<void()>&&);
383     void userPreferredLanguagesChanged(const Vector<String>&) const;
384     void fullKeyboardAccessModeChanged(bool fullKeyboardAccessEnabled);
385
386     bool isPlugInAutoStartOriginHash(unsigned plugInOriginHash);
387     void didAddPlugInAutoStartOriginHash(unsigned plugInOriginHash, WallTime expirationTime);
388     void resetPlugInAutoStartOriginHashes(HashMap<unsigned, WallTime>&& hashes);
389
390     void platformSetCacheModel(CacheModel);
391
392     void setEnhancedAccessibility(bool);
393     
394     void startMemorySampler(SandboxExtension::Handle&&, const String&, const double);
395     void stopMemorySampler();
396     
397     void getWebCoreStatistics(uint64_t callbackID);
398     void garbageCollectJavaScriptObjects();
399     void setJavaScriptGarbageCollectorTimerEnabled(bool flag);
400
401     void mainThreadPing();
402     void backgroundResponsivenessPing();
403
404 #if ENABLE(GAMEPAD)
405     void setInitialGamepads(const Vector<GamepadData>&);
406     void gamepadConnected(const GamepadData&);
407     void gamepadDisconnected(unsigned index);
408 #endif
409
410 #if ENABLE(SERVICE_WORKER)
411     void establishWorkerContextConnectionToNetworkProcess(uint64_t pageGroupID, WebPageProxyIdentifier, WebCore::PageIdentifier, const WebPreferencesStore&, WebCore::RegistrableDomain&&, ServiceWorkerInitializationData&&, CompletionHandler<void()>&&);
412 #endif
413
414     void fetchWebsiteData(OptionSet<WebsiteDataType>, CompletionHandler<void(WebsiteData&&)>&&);
415     void deleteWebsiteData(OptionSet<WebsiteDataType>, WallTime modifiedSince, CompletionHandler<void()>&&);
416     void deleteWebsiteDataForOrigins(OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins, CompletionHandler<void()>&&);
417
418     void setMemoryCacheDisabled(bool);
419
420     void setBackForwardCacheCapacity(unsigned);
421     void clearCachedPage(WebCore::BackForwardItemIdentifier, CompletionHandler<void()>&&);
422
423 #if ENABLE(SERVICE_CONTROLS)
424     void setEnabledServices(bool hasImageServices, bool hasSelectionServices, bool hasRichContentServices);
425 #endif
426
427     void handleInjectedBundleMessage(const String& messageName, const UserData& messageBody);
428     void setInjectedBundleParameter(const String& key, const IPC::DataReference&);
429     void setInjectedBundleParameters(const IPC::DataReference&);
430
431     bool areAllPagesSuspended() const;
432
433     void ensureAutomationSessionProxy(const String& sessionIdentifier);
434     void destroyAutomationSessionProxy();
435
436     void logDiagnosticMessageForNetworkProcessCrash();
437     bool hasVisibleWebPage() const;
438     void updateCPULimit();
439     enum class CPUMonitorUpdateReason { LimitHasChanged, VisibilityHasChanged };
440     void updateCPUMonitorState(CPUMonitorUpdateReason);
441
442     // AuxiliaryProcess
443     void initializeProcess(const AuxiliaryProcessInitializationParameters&) override;
444     void initializeProcessName(const AuxiliaryProcessInitializationParameters&) override;
445     void initializeSandbox(const AuxiliaryProcessInitializationParameters&, SandboxInitializationParameters&) override;
446     void initializeConnection(IPC::Connection*) override;
447     bool shouldTerminate() override;
448     void terminate() override;
449
450 #if USE(APPKIT)
451     void stopRunLoop() override;
452 #endif
453
454 #if ENABLE(MEDIA_STREAM)
455     void addMockMediaDevice(const WebCore::MockMediaDevice&);
456     void clearMockMediaDevices();
457     void removeMockMediaDevice(const String& persistentId);
458     void resetMockMediaDevices();
459 #if ENABLE(SANDBOX_EXTENSIONS)
460     void grantUserMediaDeviceSandboxExtensions(MediaDeviceSandboxExtensions&&);
461     void revokeUserMediaDeviceSandboxExtensions(const Vector<String>&);
462 #endif
463
464 #endif
465
466 #if ENABLE(RESOURCE_LOAD_STATISTICS)
467     void setShouldBlockThirdPartyCookiesForTesting(WebCore::ThirdPartyCookieBlockingMode, CompletionHandler<void()>&&);
468 #endif
469
470     void platformInitializeProcess(const AuxiliaryProcessInitializationParameters&);
471
472     // IPC::Connection::Client
473     friend class WebConnectionToUIProcess;
474     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
475     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
476
477     // Implemented in generated WebProcessMessageReceiver.cpp
478     void didReceiveWebProcessMessage(IPC::Connection&, IPC::Decoder&);
479
480 #if PLATFORM(MAC)
481     void setScreenProperties(const WebCore::ScreenProperties&);
482 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
483     void scrollerStylePreferenceChanged(bool useOverlayScrollbars);
484     void displayConfigurationChanged(CGDirectDisplayID, CGDisplayChangeSummaryFlags);
485     void displayWasRefreshed(CGDirectDisplayID);
486 #endif
487 #endif
488
489 #if PLATFORM(COCOA)
490     void updateProcessName();
491 #endif
492
493 #if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
494     void backlightLevelDidChange(float backlightLevel);
495 #endif
496
497 #if PLATFORM(IOS_FAMILY)
498     void processTaskStateDidChange(ProcessTaskStateObserver::TaskState) final;
499     bool shouldFreezeOnSuspension() const;
500     void updateFreezerStatus();
501
502     void releaseProcessWasResumedAssertions();
503 #endif
504
505 #if ENABLE(VIDEO)
506     void suspendAllMediaBuffering();
507     void resumeAllMediaBuffering();
508 #endif
509
510     void clearCurrentModifierStateForTesting();
511
512 #if PLATFORM(GTK) || PLATFORM(WPE)
513     void sendMessageToWebExtension(UserMessage&&);
514 #endif
515
516     bool isAlwaysOnLoggingAllowed() { return m_sessionID ? m_sessionID->isAlwaysOnLoggingAllowed() : true; }
517
518     RefPtr<WebConnectionToUIProcess> m_webConnection;
519
520     HashMap<WebCore::PageIdentifier, RefPtr<WebPage>> m_pageMap;
521     HashMap<uint64_t, RefPtr<WebPageGroupProxy>> m_pageGroupMap;
522     RefPtr<InjectedBundle> m_injectedBundle;
523
524     Ref<EventDispatcher> m_eventDispatcher;
525 #if PLATFORM(IOS_FAMILY)
526     RefPtr<ViewUpdateDispatcher> m_viewUpdateDispatcher;
527 #endif
528     RefPtr<WebInspectorInterruptDispatcher> m_webInspectorInterruptDispatcher;
529
530     HashMap<unsigned, WallTime> m_plugInAutoStartOriginHashes;
531     HashSet<String> m_plugInAutoStartOrigins;
532
533     bool m_hasSetCacheModel { false };
534     CacheModel m_cacheModel { CacheModel::DocumentViewer };
535
536 #if PLATFORM(COCOA)
537     WTF::MachSendRight m_compositingRenderServerPort;
538 #endif
539
540     bool m_fullKeyboardAccessEnabled { false };
541
542     HashMap<WebCore::FrameIdentifier, WebFrame*> m_frameMap;
543
544     typedef HashMap<const char*, std::unique_ptr<WebProcessSupplement>, PtrHash<const char*>> WebProcessSupplementMap;
545     WebProcessSupplementMap m_supplements;
546
547     TextCheckerState m_textCheckerState;
548
549     String m_uiProcessBundleIdentifier;
550     RefPtr<NetworkProcessConnection> m_networkProcessConnection;
551     WebLoaderStrategy& m_webLoaderStrategy;
552
553 #if ENABLE(GPU_PROCESS)
554     RefPtr<GPUProcessConnection> m_gpuProcessConnection;
555 #if PLATFORM(COCOA) && USE(LIBWEBRTC)
556     std::unique_ptr<LibWebRTCCodecs> m_libWebRTCCodecs;
557 #endif
558 #endif
559
560     Ref<WebCacheStorageProvider> m_cacheStorageProvider;
561     WebSocketChannelManager m_webSocketChannelManager;
562
563     std::unique_ptr<LibWebRTCNetwork> m_libWebRTCNetwork;
564
565     HashSet<String> m_dnsPrefetchedHosts;
566     PAL::HysteresisActivity m_dnsPrefetchHystereris;
567
568     std::unique_ptr<WebAutomationSessionProxy> m_automationSessionProxy;
569
570 #if ENABLE(NETSCAPE_PLUGIN_API)
571     RefPtr<PluginProcessConnectionManager> m_pluginProcessConnectionManager;
572 #endif
573
574 #if ENABLE(SERVICE_CONTROLS)
575     bool m_hasImageServices { false };
576     bool m_hasSelectionServices { false };
577     bool m_hasRichContentServices { false };
578 #endif
579
580     bool m_processIsSuspended { false };
581
582     HashSet<WebCore::PageIdentifier> m_pagesInWindows;
583     WebCore::Timer m_nonVisibleProcessCleanupTimer;
584
585     RefPtr<WebCore::ApplicationCacheStorage> m_applicationCacheStorage;
586
587 #if PLATFORM(IOS_FAMILY)
588     WebSQLiteDatabaseTracker m_webSQLiteDatabaseTracker;
589     RefPtr<ProcessTaskStateObserver> m_taskStateObserver;
590     Lock m_processWasResumedAssertionsLock;
591     RetainPtr<BKSProcessAssertion> m_processWasResumedUIAssertion;
592     RetainPtr<BKSProcessAssertion> m_processWasResumedOwnAssertion;
593 #endif
594
595     enum PageMarkingLayersAsVolatileCounterType { };
596     using PageMarkingLayersAsVolatileCounter = RefCounter<PageMarkingLayersAsVolatileCounterType>;
597     std::unique_ptr<PageMarkingLayersAsVolatileCounter> m_pageMarkingLayersAsVolatileCounter;
598     unsigned m_countOfPagesFailingToMarkVolatile { 0 };
599
600     bool m_suppressMemoryPressureHandler { false };
601 #if PLATFORM(MAC)
602     std::unique_ptr<WebCore::CPUMonitor> m_cpuMonitor;
603     Optional<double> m_cpuLimit;
604
605     String m_uiProcessName;
606     WebCore::RegistrableDomain m_registrableDomain;
607 #endif
608
609 #if PLATFORM(COCOA)
610     enum class ProcessType { Inspector, ServiceWorker, PrewarmedWebContent, CachedWebContent, WebContent };
611     ProcessType m_processType { ProcessType::WebContent };
612 #endif
613
614     HashMap<WebCore::UserGestureToken *, uint64_t> m_userGestureTokens;
615
616 #if PLATFORM(WAYLAND)
617     std::unique_ptr<WaylandCompositorDisplay> m_waylandCompositorDisplay;
618 #endif
619
620 #if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
621     std::unique_ptr<WebCore::PlatformDisplayLibWPE> m_wpeDisplay;
622 #endif
623
624     bool m_hasSuspendedPageProxy { false };
625     bool m_isSuspending { false };
626
627 #if ENABLE(MEDIA_STREAM) && ENABLE(SANDBOX_EXTENSIONS)
628     HashMap<String, RefPtr<SandboxExtension>> m_mediaCaptureSandboxExtensions;
629 #endif
630
631 #if PLATFORM(IOS_FAMILY) && !PLATFORM(MACCATALYST)
632     float m_backlightLevel { 0 };
633 #endif
634
635 #if ENABLE(SERVICE_WORKER)
636     HashCountedSet<WebCore::ServiceWorkerRegistrationIdentifier> m_swRegistrationCounts;
637 #endif
638
639     HashMap<StorageAreaIdentifier, StorageAreaMap*> m_storageAreaMaps;
640     
641     // Prewarmed WebProcesses do not have an associated sessionID yet, which is why this is an optional.
642     // By the time the WebProcess gets a WebPage, it is guaranteed to have a sessionID.
643     Optional<PAL::SessionID> m_sessionID;
644
645 #if ENABLE(RESOURCE_LOAD_STATISTICS)
646     WebCore::ThirdPartyCookieBlockingMode m_thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::All };
647 #endif
648
649 #if PLATFORM(IOS)
650     RefPtr<SandboxExtension> m_assetServiceExtension;
651     RefPtr<SandboxExtension> m_assetServiceV2Extension;
652 #endif
653 };
654
655 } // namespace WebKit