Changeset 243094 in webkit
- Timestamp:
- Mar 18, 2019, 1:23:47 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 42 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.h (modified) (1 diff)
-
Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm (modified) (2 diffs)
-
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (modified) (1 diff)
-
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (modified) (1 diff)
-
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (modified) (2 diffs)
-
Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp (modified) (3 diffs)
-
Source/WebKit/UIProcess/DrawingAreaProxy.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/GeolocationPermissionRequestManagerProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/InspectorTargetProxy.cpp (modified) (3 diffs)
-
Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm (modified) (3 diffs)
-
Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp (modified) (10 diffs)
-
Source/WebKit/UIProcess/ViewGestureController.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebBackForwardList.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebCookieManagerProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebEditCommandProxy.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebFrameProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebInspectorProxy.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (182 diffs)
-
Source/WebKit/UIProcess/WebPageProxy.h (modified) (5 diffs)
-
Source/WebKit/UIProcess/WebProcessPool.cpp (modified) (6 diffs)
-
Source/WebKit/UIProcess/WebProcessPool.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebProcessProxy.cpp (modified) (3 diffs)
-
Source/WebKit/UIProcess/WebProcessProxy.h (modified) (1 diff)
-
Source/WebKit/UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (3 diffs)
-
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (modified) (32 diffs)
-
Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm (modified) (5 diffs)
-
Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (modified) (12 diffs)
-
Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/win/WebView.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/WebPage.cpp (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit/NetworkProcessCrashWithPendingConnection.mm (modified) (3 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit/mac/GetBackingScaleFactor.mm (modified) (2 diffs)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessPreWarming.mm (modified) (2 diffs)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm (modified) (3 diffs)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r243092 r243094 1 2019-03-18 Chris Dumez <cdumez@apple.com> 2 3 Delay WebProcess launch until a load is triggered in a Web view 4 https://bugs.webkit.org/show_bug.cgi?id=195758 5 <rdar://problem/48126013> 6 7 Reviewed by Geoff Garen. 8 9 This is achieved by constructing WebPageProxy objects with a WebProcessProxy that is in 10 terminated state (because it never launched its process). This is convenient because 11 it is a state that the WebPageProxy supports, which normally happened by the WebProcess 12 crashes. When trying to do a load, we were already checking if the WebPageProxy's process 13 was running (via an isValid() check) and we would re-launch the WebProcess if necessary 14 by calling reattachToWebProcess(). For clarity, given that this state is no longer 15 indicating that the WebProcess crashed, I renamed isValid() to hasRunningProcess() and 16 reattachToWebProcess() to launchProcess(). 17 18 The reason delaying the WebProcess launch until the first load is useful is because it 19 allows us to leverage the WebProcessCache given that we now know which registrable 20 domain is going to be loaded in the process. 21 22 This is a progression from a power usage standpoint. When it comes to page load time, 23 it would be a progression if we found a suitable process in the cache. I do not expect 24 a performance hit when no process is found in the cache because of process prewarming. 25 26 * Shared/API/Cocoa/RemoteObjectRegistry.h: 27 * Shared/API/Cocoa/RemoteObjectRegistry.mm: 28 (WebKit::m_launchInitialProcessIfNecessary): 29 (WebKit::RemoteObjectRegistry::sendInvocation): 30 * UIProcess/API/Cocoa/WKProcessPool.mm: 31 (-[WKProcessPool _processCacheSize]): 32 * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 33 * UIProcess/API/Cocoa/WKWebView.mm: 34 (-[WKWebView _isValid]): 35 * UIProcess/Automation/WebAutomationSession.cpp: 36 (WebKit::WebAutomationSession::willShowJavaScriptDialog): 37 * UIProcess/Cocoa/WebPageProxyCocoa.mm: 38 (WebKit::WebPageProxy::performDictionaryLookupAtLocation): 39 (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection): 40 * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp: 41 (WebKit::DrawingAreaProxyCoordinatedGraphics::sendUpdateBackingStoreState): 42 (WebKit::DrawingAreaProxyCoordinatedGraphics::waitForAndDispatchDidUpdateBackingStoreState): 43 (WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing): 44 * UIProcess/DrawingAreaProxy.cpp: 45 (WebKit::DrawingAreaProxy::setViewExposedRect): 46 (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired): 47 * UIProcess/GeolocationPermissionRequestManagerProxy.cpp: 48 (WebKit::GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision): 49 * UIProcess/InspectorTargetProxy.cpp: 50 (WebKit::InspectorTargetProxy::connect): 51 (WebKit::InspectorTargetProxy::disconnect): 52 (WebKit::InspectorTargetProxy::sendMessageToTargetBackend): 53 * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: 54 (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange): 55 (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay): 56 (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing): 57 * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: 58 (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged): 59 (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied): 60 (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): 61 (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): 62 (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): 63 (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest): 64 (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): 65 (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged): 66 * UIProcess/ViewGestureController.cpp: 67 (WebKit::ViewGestureController::ViewGestureController): 68 * UIProcess/WebBackForwardList.cpp: 69 (WebKit::WebBackForwardList::~WebBackForwardList): 70 * UIProcess/WebCookieManagerProxy.cpp: 71 (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy): 72 * UIProcess/WebEditCommandProxy.cpp: 73 (WebKit::WebEditCommandProxy::unapply): 74 (WebKit::WebEditCommandProxy::reapply): 75 * UIProcess/WebFrameProxy.cpp: 76 (WebKit::WebFrameProxy::stopLoading const): 77 * UIProcess/WebInspectorProxy.cpp: 78 (WebKit::WebInspectorProxy::WebInspectorProxy): 79 * UIProcess/WebPageProxy.cpp: 80 (WebKit::m_resetRecentCrashCountTimer): 81 (WebKit::WebPageProxy::hasRunningProcess const): 82 (WebKit::WebPageProxy::setUIClient): 83 (WebKit::WebPageProxy::setIconLoadingClient): 84 (WebKit::WebPageProxy::launchProcess): 85 (WebKit::WebPageProxy::swapToWebProcess): 86 (WebKit::WebPageProxy::finishAttachingToWebProcess): 87 (WebKit::WebPageProxy::didAttachToRunningProcess): 88 (WebKit::WebPageProxy::launchProcessForReload): 89 (WebKit::WebPageProxy::launchProcessWithItem): 90 (WebKit::WebPageProxy::initializeWebPage): 91 (WebKit::WebPageProxy::tryClose): 92 (WebKit::WebPageProxy::loadRequest): 93 (WebKit::WebPageProxy::loadFile): 94 (WebKit::WebPageProxy::loadData): 95 (WebKit::WebPageProxy::loadAlternateHTML): 96 (WebKit::WebPageProxy::loadWebArchiveData): 97 (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick): 98 (WebKit::WebPageProxy::stopLoading): 99 (WebKit::WebPageProxy::reload): 100 (WebKit::WebPageProxy::goToBackForwardItem): 101 (WebKit::WebPageProxy::tryRestoreScrollPosition): 102 (WebKit::WebPageProxy::setControlledByAutomation): 103 (WebKit::WebPageProxy::setIndicating): 104 (WebKit::WebPageProxy::setBackgroundColor): 105 (WebKit::WebPageProxy::setTopContentInset): 106 (WebKit::WebPageProxy::setUnderlayColor): 107 (WebKit::WebPageProxy::viewWillStartLiveResize): 108 (WebKit::WebPageProxy::viewWillEndLiveResize): 109 (WebKit::WebPageProxy::dispatchActivityStateChange): 110 (WebKit::WebPageProxy::layerHostingModeDidChange): 111 (WebKit::WebPageProxy::waitForDidUpdateActivityState): 112 (WebKit::WebPageProxy::setInitialFocus): 113 (WebKit::WebPageProxy::clearSelection): 114 (WebKit::WebPageProxy::restoreSelectionInFocusedEditableElement): 115 (WebKit::WebPageProxy::validateCommand): 116 (WebKit::WebPageProxy::increaseListLevel): 117 (WebKit::WebPageProxy::decreaseListLevel): 118 (WebKit::WebPageProxy::changeListType): 119 (WebKit::WebPageProxy::setBaseWritingDirection): 120 (WebKit::WebPageProxy::setNeedsFontAttributes): 121 (WebKit::WebPageProxy::executeEditCommand): 122 (WebKit::WebPageProxy::requestFontAttributesAtSelectionStart): 123 (WebKit::WebPageProxy::setEditable): 124 (WebKit::WebPageProxy::performDragControllerAction): 125 (WebKit::WebPageProxy::dragEnded): 126 (WebKit::WebPageProxy::didStartDrag): 127 (WebKit::WebPageProxy::dragCancelled): 128 (WebKit::WebPageProxy::handleMouseEvent): 129 (WebKit::WebPageProxy::processNextQueuedMouseEvent): 130 (WebKit::WebPageProxy::handleWheelEvent): 131 (WebKit::WebPageProxy::handleKeyboardEvent): 132 (WebKit::WebPageProxy::handleGestureEvent): 133 (WebKit::WebPageProxy::handleTouchEventSynchronously): 134 (WebKit::WebPageProxy::handleTouchEventAsynchronously): 135 (WebKit::WebPageProxy::handleTouchEvent): 136 (WebKit::WebPageProxy::scrollBy): 137 (WebKit::WebPageProxy::centerSelectionInVisibleArea): 138 (WebKit::WebPageProxy::receivedPolicyDecision): 139 (WebKit::WebPageProxy::setUserAgent): 140 (WebKit::WebPageProxy::resumeActiveDOMObjectsAndAnimations): 141 (WebKit::WebPageProxy::suspendActiveDOMObjectsAndAnimations): 142 (WebKit::WebPageProxy::setCustomTextEncodingName): 143 (WebKit::WebPageProxy::setTextZoomFactor): 144 (WebKit::WebPageProxy::setPageZoomFactor): 145 (WebKit::WebPageProxy::setPageAndTextZoomFactors): 146 (WebKit::WebPageProxy::scalePage): 147 (WebKit::WebPageProxy::scalePageInViewCoordinates): 148 (WebKit::WebPageProxy::scaleView): 149 (WebKit::WebPageProxy::windowScreenDidChange): 150 (WebKit::WebPageProxy::setCustomDeviceScaleFactor): 151 (WebKit::WebPageProxy::accessibilitySettingsDidChange): 152 (WebKit::WebPageProxy::updateAccessibilityEventsEnabled): 153 (WebKit::WebPageProxy::setUseFixedLayout): 154 (WebKit::WebPageProxy::setFixedLayoutSize): 155 (WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller): 156 (WebKit::WebPageProxy::setAlwaysShowsVerticalScroller): 157 (WebKit::WebPageProxy::listenForLayoutMilestones): 158 (WebKit::WebPageProxy::setSuppressScrollbarAnimations): 159 (WebKit::WebPageProxy::setEnableVerticalRubberBanding): 160 (WebKit::WebPageProxy::setEnableHorizontalRubberBanding): 161 (WebKit::WebPageProxy::setBackgroundExtendsBeyondPage): 162 (WebKit::WebPageProxy::setPaginationMode): 163 (WebKit::WebPageProxy::setPaginationBehavesLikeColumns): 164 (WebKit::WebPageProxy::setPageLength): 165 (WebKit::WebPageProxy::setGapBetweenPages): 166 (WebKit::WebPageProxy::setPaginationLineGridEnabled): 167 (WebKit::WebPageProxy::countStringMatches): 168 (WebKit::WebPageProxy::replaceMatches): 169 (WebKit::WebPageProxy::launchInitialProcessIfNecessary): 170 (WebKit::WebPageProxy::runJavaScriptInMainFrame): 171 (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld): 172 (WebKit::WebPageProxy::getRenderTreeExternalRepresentation): 173 (WebKit::WebPageProxy::getSourceForFrame): 174 (WebKit::WebPageProxy::getContentsAsString): 175 (WebKit::WebPageProxy::getContentsAsAttributedString): 176 (WebKit::WebPageProxy::getBytecodeProfile): 177 (WebKit::WebPageProxy::getSamplingProfilerOutput): 178 (WebKit::WebPageProxy::getContentsAsMHTMLData): 179 (WebKit::WebPageProxy::getSelectionOrContentsAsString): 180 (WebKit::WebPageProxy::getSelectionAsWebArchiveData): 181 (WebKit::WebPageProxy::getMainResourceDataOfFrame): 182 (WebKit::WebPageProxy::getResourceDataFromFrame): 183 (WebKit::WebPageProxy::getWebArchiveOfFrame): 184 (WebKit::WebPageProxy::forceRepaint): 185 (WebKit::WebPageProxy::preferencesDidChange): 186 (WebKit::WebPageProxy::setMediaVolume): 187 (WebKit::WebPageProxy::setMuted): 188 (WebKit::WebPageProxy::setMediaCaptureEnabled): 189 (WebKit::WebPageProxy::stopMediaCapture): 190 (WebKit::WebPageProxy::stopAllMediaPlayback): 191 (WebKit::WebPageProxy::suspendAllMediaPlayback): 192 (WebKit::WebPageProxy::resumeAllMediaPlayback): 193 (WebKit::WebPageProxy::handleMediaEvent): 194 (WebKit::WebPageProxy::setVolumeOfMediaElement): 195 (WebKit::WebPageProxy::setMayStartMediaWhenInWindow): 196 (WebKit::WebPageProxy::didChooseColor): 197 (WebKit::WebPageProxy::didEndColorPicker): 198 (WebKit::WebPageProxy::didSelectOption): 199 (WebKit::WebPageProxy::inspector const): 200 (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon): 201 (WebKit::WebPageProxy::didChooseFilesForOpenPanel): 202 (WebKit::WebPageProxy::didCancelForOpenPanel): 203 (WebKit::WebPageProxy::removeEditCommand): 204 (WebKit::WebPageProxy::processDidBecomeUnresponsive): 205 (WebKit::WebPageProxy::processDidBecomeResponsive): 206 (WebKit::WebPageProxy::processDidTerminate): 207 (WebKit::WebPageProxy::processWillBecomeSuspended): 208 (WebKit::WebPageProxy::processWillBecomeForeground): 209 (WebKit::WebPageProxy::resetStateAfterProcessExited): 210 (WebKit::WebPageProxy::setCanRunModal): 211 (WebKit::WebPageProxy::canRunModal): 212 (WebKit::WebPageProxy::computePagesForPrinting): 213 (WebKit::WebPageProxy::drawRectToImage): 214 (WebKit::WebPageProxy::drawPagesToPDF): 215 (WebKit::WebPageProxy::drawPagesForPrinting): 216 (WebKit::WebPageProxy::updateBackingStoreDiscardableState): 217 (WebKit::WebPageProxy::setViewLayoutSize): 218 (WebKit::WebPageProxy::setAutoSizingShouldExpandToViewHeight): 219 (WebKit::WebPageProxy::setViewportSizeForCSSViewportUnits): 220 (WebKit::WebPageProxy::setComposition): 221 (WebKit::WebPageProxy::confirmComposition): 222 (WebKit::WebPageProxy::cancelComposition): 223 (WebKit::WebPageProxy::setScrollPinningBehavior): 224 (WebKit::WebPageProxy::setOverlayScrollbarStyle): 225 (WebKit::WebPageProxy::changeFontAttributes): 226 (WebKit::WebPageProxy::changeFont): 227 (WebKit::WebPageProxy::setTextAsync): 228 (WebKit::WebPageProxy::insertTextAsync): 229 (WebKit::WebPageProxy::getMarkedRangeAsync): 230 (WebKit::WebPageProxy::getSelectedRangeAsync): 231 (WebKit::WebPageProxy::characterIndexForPointAsync): 232 (WebKit::WebPageProxy::firstRectForCharacterRangeAsync): 233 (WebKit::WebPageProxy::setCompositionAsync): 234 (WebKit::WebPageProxy::confirmCompositionAsync): 235 (WebKit::WebPageProxy::takeSnapshot): 236 (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo): 237 (WebKit::WebPageProxy::setUseSystemAppearance): 238 (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler): 239 (WebKit::WebPageProxy::setPlaybackTarget): 240 (WebKit::WebPageProxy::externalOutputDeviceAvailableDidChange): 241 (WebKit::WebPageProxy::setShouldPlayToPlaybackTarget): 242 (WebKit::WebPageProxy::clearWheelEventTestTrigger): 243 (WebKit::WebPageProxy::callAfterNextPresentationUpdate): 244 (WebKit::WebPageProxy::setShouldScaleViewToFitDocument): 245 (WebKit::WebPageProxy::getLoadDecisionForIcon): 246 (WebKit::WebPageProxy::setResourceCachingDisabled): 247 (WebKit::WebPageProxy::setUserInterfaceLayoutDirection): 248 (WebKit::WebPageProxy::effectiveAppearanceDidChange): 249 (WebKit::WebPageProxy::insertAttachment): 250 (WebKit::WebPageProxy::updateAttachmentAttributes): 251 (WebKit::WebPageProxy::getApplicationManifest): 252 (WebKit::WebPageProxy::textInputContextsInRect): 253 (WebKit::WebPageProxy::focusTextInputContext): 254 * UIProcess/WebPageProxy.h: 255 * UIProcess/WebProcessPool.cpp: 256 (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled): 257 (WebKit::WebProcessPool::initializeNewWebProcess): 258 (WebKit::WebProcessPool::disconnectProcess): 259 (WebKit::WebProcessPool::createWebPage): 260 (WebKit::WebProcessPool::pageBeginUsingWebsiteDataStore): 261 * UIProcess/WebProcessPool.h: 262 * UIProcess/WebProcessProxy.cpp: 263 (WebKit::WebProcessProxy::create): 264 (WebKit::WebProcessProxy::addExistingWebPage): 265 (WebKit::WebProcessProxy::maybeShutDown): 266 * UIProcess/WebProcessProxy.h: 267 * UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp: 268 (WebKit::InstallMissingMediaPluginsPermissionRequest::allow): 269 (WebKit::InstallMissingMediaPluginsPermissionRequest::didEndRequestInstallMissingMediaPlugins): 270 * UIProcess/gtk/WebInspectorProxyGtk.cpp: 271 (WebKit::WebInspectorProxy::platformDetach): 272 * UIProcess/ios/WKContentViewInteraction.mm: 273 (-[WKContentView setupInteraction]): 274 (-[WKContentView _webTouchEventsRecognized:]): 275 (-[WKContentView _hoverGestureRecognizerChanged:]): 276 * UIProcess/ios/WebPageProxyIOS.mm: 277 (WebKit::WebPageProxy::requestFocusedElementInformation): 278 (WebKit::WebPageProxy::updateVisibleContentRects): 279 (WebKit::WebPageProxy::updateStringForFind): 280 (WebKit::WebPageProxy::dynamicViewportSizeUpdate): 281 (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): 282 (WebKit::WebPageProxy::setForceAlwaysUserScalable): 283 (WebKit::WebPageProxy::setMaximumUnobscuredSize): 284 (WebKit::WebPageProxy::setDeviceOrientation): 285 (WebKit::WebPageProxy::setOverrideViewportArguments): 286 (WebKit::WebPageProxy::selectWithGesture): 287 (WebKit::WebPageProxy::updateSelectionWithTouches): 288 (WebKit::WebPageProxy::requestAutocorrectionData): 289 (WebKit::WebPageProxy::applyAutocorrection): 290 (WebKit::WebPageProxy::selectTextWithGranularityAtPoint): 291 (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection): 292 (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection): 293 (WebKit::WebPageProxy::selectPositionAtPoint): 294 (WebKit::WebPageProxy::beginSelectionInDirection): 295 (WebKit::WebPageProxy::updateSelectionWithExtentPoint): 296 (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary): 297 (WebKit::WebPageProxy::requestDictationContext): 298 (WebKit::WebPageProxy::getSelectionContext): 299 (WebKit::WebPageProxy::selectWithTwoTouches): 300 (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset): 301 (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText): 302 (WebKit::WebPageProxy::moveSelectionByOffset): 303 (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens): 304 (WebKit::WebPageProxy::focusNextFocusedElement): 305 (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF): 306 (WebKit::WebPageProxy::requestEvasionRectsAboveSelection): 307 (WebKit::WebPageProxy::requestDragStart): 308 (WebKit::WebPageProxy::requestAdditionalItemsForDragSession): 309 * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm: 310 (WebKit::TiledCoreAnimationDrawingAreaProxy::sizeDidChange): 311 (WebKit::TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange): 312 (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence): 313 (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing): 314 * UIProcess/mac/WebPageProxyMac.mm: 315 (WebKit::WebPageProxy::windowAndViewFramesChanged): 316 (WebKit::WebPageProxy::setMainFrameIsScrollable): 317 (WebKit::WebPageProxy::insertDictatedTextAsync): 318 (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync): 319 (WebKit::WebPageProxy::fontAtSelection): 320 (WebKit::WebPageProxy::stringSelectionForPasteboard): 321 (WebKit::WebPageProxy::dataSelectionForPasteboard): 322 (WebKit::WebPageProxy::readSelectionFromPasteboard): 323 (WebKit::WebPageProxy::sendComplexTextInputToPlugin): 324 (WebKit::WebPageProxy::registerWebProcessAccessibilityToken): 325 (WebKit::WebPageProxy::registerUIProcessAccessibilityTokens): 326 (WebKit::WebPageProxy::acceptsFirstMouse): 327 * UIProcess/win/WebInspectorProxyWin.cpp: 328 (WebKit::WebInspectorProxy::platformDetach): 329 * UIProcess/win/WebView.cpp: 330 (WebKit::WebView::cursorToShow const): 331 * WebProcess/WebPage/WebPage.cpp: 332 (WebKit::m_hostFileDescriptor): 333 1 334 2019-03-18 Antti Koivisto <antti@apple.com> 2 335 -
trunk/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.h
r241183 r243094 68 68 IPC::MessageSender& m_messageSender; 69 69 WTF::Function<ProcessThrottler::BackgroundActivityToken()> m_takeBackgroundActivityToken; 70 WTF::Function<void()> m_launchInitialProcessIfNecessary; 70 71 HashMap<uint64_t, ProcessThrottler::BackgroundActivityToken> m_pendingReplies; 71 72 }; -
trunk/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm
r242339 r243094 50 50 , m_messageSender(page) 51 51 , m_takeBackgroundActivityToken([&page] { return page.process().throttler().backgroundActivityToken(); }) 52 , m_launchInitialProcessIfNecessary([&page] { page.launchInitialProcessIfNecessary(); }) 52 53 { 53 54 } … … 60 61 void RemoteObjectRegistry::sendInvocation(const RemoteObjectInvocation& invocation) 61 62 { 63 // For backward-compatibility, support invoking injected bundle methods before having done any load in the WebView. 64 if (m_launchInitialProcessIfNecessary) 65 m_launchInitialProcessIfNecessary(); 66 62 67 if (auto* replyInfo = invocation.replyInfo()) { 63 68 ASSERT(!m_pendingReplies.contains(replyInfo->replyID)); -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
r242726 r243094 523 523 } 524 524 525 - (NSUInteger)_processCacheSize 526 { 527 return _processPool->webProcessCache().size(); 528 } 529 525 530 - (size_t)_serviceWorkerProcessCount 526 531 { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
r242339 r243094 103 103 - (NSUInteger)_maximumSuspendedPageCount WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 104 104 - (NSUInteger)_processCacheCapacity WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 105 - (NSUInteger)_processCacheSize WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 105 106 106 107 // Test only. Returns web processes running web pages (does not include web processes running service workers) -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r243012 r243094 392 392 - (BOOL)_isValid 393 393 { 394 return _page && _page-> isValid();394 return _page && _page->hasRunningProcess(); 395 395 } 396 396 -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r241001 r243094 643 643 // operation with an unexpected alert open error. 644 644 RunLoop::main().dispatch([this, protectedThis = makeRef(*this), page = makeRef(page)] { 645 if (!page-> isValid() || !m_client || !m_client->isShowingJavaScriptDialogOnPage(*this, page))645 if (!page->hasRunningProcess() || !m_client || !m_client->isShowingJavaScriptDialogOnPage(*this, page)) 646 646 return; 647 647 -
trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
r243002 r243094 200 200 void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint& point) 201 201 { 202 if (! isValid())202 if (!hasRunningProcess()) 203 203 return; 204 204 … … 208 208 void WebPageProxy::performDictionaryLookupOfCurrentSelection() 209 209 { 210 if (! isValid())210 if (!hasRunningProcess()) 211 211 return; 212 212 -
trunk/Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
r242346 r243094 304 304 ASSERT(m_currentBackingStoreStateID < m_nextBackingStoreStateID); 305 305 306 if (!m_webPageProxy. isValid())306 if (!m_webPageProxy.hasRunningProcess()) 307 307 return; 308 308 … … 335 335 ASSERT(m_isWaitingForDidUpdateBackingStoreState); 336 336 337 if (!m_webPageProxy. isValid())337 if (!m_webPageProxy.hasRunningProcess()) 338 338 return; 339 339 if (process().state() == WebProcessProxy::State::Launching) … … 466 466 void DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing(WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 467 467 { 468 if (!m_webPageProxy. isValid()) {468 if (!m_webPageProxy.hasRunningProcess()) { 469 469 callbackFunction(CallbackBase::Error::OwnerWasInvalidated); 470 470 return; -
trunk/Source/WebKit/UIProcess/DrawingAreaProxy.cpp
r241988 r243094 88 88 void DrawingAreaProxy::setViewExposedRect(Optional<WebCore::FloatRect> viewExposedRect) 89 89 { 90 if (!m_webPageProxy. isValid())90 if (!m_webPageProxy.hasRunningProcess()) 91 91 return; 92 92 … … 99 99 void DrawingAreaProxy::viewExposedRectChangedTimerFired() 100 100 { 101 if (!m_webPageProxy. isValid())101 if (!m_webPageProxy.hasRunningProcess()) 102 102 return; 103 103 -
trunk/Source/WebKit/UIProcess/GeolocationPermissionRequestManagerProxy.cpp
r216794 r243094 55 55 void GeolocationPermissionRequestManagerProxy::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed) 56 56 { 57 if (!m_page. isValid())57 if (!m_page.hasRunningProcess()) 58 58 return; 59 59 -
trunk/Source/WebKit/UIProcess/InspectorTargetProxy.cpp
r238330 r243094 49 49 void InspectorTargetProxy::connect(Inspector::FrontendChannel& channel) 50 50 { 51 if (m_page. isValid())51 if (m_page.hasRunningProcess()) 52 52 m_page.process().send(Messages::WebPage::ConnectInspector(identifier(), channel.connectionType()), m_page.pageID()); 53 53 } … … 55 55 void InspectorTargetProxy::disconnect(Inspector::FrontendChannel&) 56 56 { 57 if (m_page. isValid())57 if (m_page.hasRunningProcess()) 58 58 m_page.process().send(Messages::WebPage::DisconnectInspector(identifier()), m_page.pageID()); 59 59 } … … 61 61 void InspectorTargetProxy::sendMessageToTargetBackend(const String& message) 62 62 { 63 if (m_page. isValid())63 if (m_page.hasRunningProcess()) 64 64 m_page.process().send(Messages::WebPage::SendMessageToTargetBackend(identifier(), message), m_page.pageID()); 65 65 } -
trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
r242687 r243094 151 151 void RemoteLayerTreeDrawingAreaProxy::sizeDidChange() 152 152 { 153 if (!m_webPageProxy. isValid())153 if (!m_webPageProxy.hasRunningProcess()) 154 154 return; 155 155 … … 417 417 void RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay() 418 418 { 419 if (!m_webPageProxy. isValid())419 if (!m_webPageProxy.hasRunningProcess()) 420 420 return; 421 421 … … 469 469 void RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing(WTF::Function<void (CallbackBase::Error)>&& callbackFunction) 470 470 { 471 if (!m_webPageProxy. isValid()) {471 if (!m_webPageProxy.hasRunningProcess()) { 472 472 callbackFunction(CallbackBase::Error::OwnerWasInvalidated); 473 473 return; -
trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp
r242142 r243094 103 103 { 104 104 #if ENABLE(MEDIA_STREAM) 105 if (!m_page. isValid() || !m_page.mainFrame())105 if (!m_page.hasRunningProcess() || !m_page.mainFrame()) 106 106 return; 107 107 108 108 auto handler = [this](Optional<bool> originHasPersistentAccess) mutable { 109 if (!originHasPersistentAccess || !m_page. isValid())109 if (!originHasPersistentAccess || !m_page.hasRunningProcess()) 110 110 return; 111 111 … … 153 153 void UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied(uint64_t userMediaID, UserMediaPermissionRequestProxy::UserMediaAccessDenialReason reason) 154 154 { 155 if (!m_page. isValid())155 if (!m_page.hasRunningProcess()) 156 156 return; 157 157 … … 168 168 void UserMediaPermissionRequestManagerProxy::denyRequest(uint64_t userMediaID, UserMediaPermissionRequestProxy::UserMediaAccessDenialReason reason, const String& invalidConstraint) 169 169 { 170 ASSERT(m_page. isValid());170 ASSERT(m_page.hasRunningProcess()); 171 171 172 172 #if ENABLE(MEDIA_STREAM) … … 182 182 ASSERT(audioDevice || videoDevice); 183 183 184 if (!m_page. isValid())184 if (!m_page.hasRunningProcess()) 185 185 return; 186 186 … … 329 329 } 330 330 331 if (!m_page. isValid())331 if (!m_page.hasRunningProcess()) 332 332 return; 333 333 … … 364 364 return; 365 365 366 if (!m_page. isValid())366 if (!m_page.hasRunningProcess()) 367 367 return; 368 368 … … 374 374 return; 375 375 376 if (!m_page. isValid() || !m_page.mainFrame())376 if (!m_page.hasRunningProcess() || !m_page.mainFrame()) 377 377 return; 378 378 … … 553 553 return; 554 554 555 if (!m_page. isValid())555 if (!m_page.hasRunningProcess()) 556 556 return; 557 557 … … 565 565 return; 566 566 567 if (!m_page. isValid())567 if (!m_page.hasRunningProcess()) 568 568 return; 569 569 … … 597 597 void UserMediaPermissionRequestManagerProxy::captureStateChanged(MediaProducer::MediaStateFlags oldState, MediaProducer::MediaStateFlags newState) 598 598 { 599 if (!m_page. isValid())599 if (!m_page.hasRunningProcess()) 600 600 return; 601 601 -
trunk/Source/WebKit/UIProcess/ViewGestureController.cpp
r241224 r243094 84 84 #endif 85 85 { 86 connectToProcess(); 86 if (webPageProxy.hasRunningProcess()) 87 connectToProcess(); 87 88 88 89 viewGestureControllersForAllPages().add(webPageProxy.pageID(), this); -
trunk/Source/WebKit/UIProcess/WebBackForwardList.cpp
r241751 r243094 53 53 54 54 // A WebBackForwardList should never be destroyed unless it's associated page has been closed or is invalid. 55 ASSERT((!m_page && !m_currentIndex) || !m_page-> isValid());55 ASSERT((!m_page && !m_currentIndex) || !m_page->hasRunningProcess()); 56 56 } 57 57 -
trunk/Source/WebKit/UIProcess/WebCookieManagerProxy.cpp
r241903 r243094 249 249 #endif 250 250 251 if (!processPool()->networkProcess()) {252 callbackFunction(CallbackBase::Error::None);253 return;254 }255 256 251 auto callbackID = m_callbacks.put(WTFMove(callbackFunction), processPool()->ensureNetworkProcess().throttler().backgroundActivityToken()); 257 252 processPool()->sendToNetworkingProcess(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy, OptionalCallbackID(callbackID))); -
trunk/Source/WebKit/UIProcess/WebEditCommandProxy.cpp
r240342 r243094 53 53 void WebEditCommandProxy::unapply() 54 54 { 55 if (!m_page || !m_page-> isValid())55 if (!m_page || !m_page->hasRunningProcess()) 56 56 return; 57 57 … … 62 62 void WebEditCommandProxy::reapply() 63 63 { 64 if (!m_page || !m_page-> isValid())64 if (!m_page || !m_page->hasRunningProcess()) 65 65 return; 66 66 -
trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp
r242836 r243094 100 100 return; 101 101 102 if (!m_page-> isValid())102 if (!m_page->hasRunningProcess()) 103 103 return; 104 104 -
trunk/Source/WebKit/UIProcess/WebInspectorProxy.cpp
r242339 r243094 61 61 62 62 WebInspectorProxy::WebInspectorProxy(WebPageProxy* inspectedPage) 63 : m_inspectedPage(inspectedPage)64 63 #if PLATFORM(MAC) 65 ,m_closeFrontendAfterInactivityTimer(RunLoop::main(), this, &WebInspectorProxy::closeFrontendAfterInactivityTimerFired)64 : m_closeFrontendAfterInactivityTimer(RunLoop::main(), this, &WebInspectorProxy::closeFrontendAfterInactivityTimerFired) 66 65 #endif 67 66 { 68 m_inspectedPage->process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->pageID(), *this); 67 if (inspectedPage && inspectedPage->hasRunningProcess()) { 68 m_inspectedPage = inspectedPage; 69 m_inspectedPage->process().addMessageReceiver(Messages::WebInspectorProxy::messageReceiverName(), m_inspectedPage->pageID(), *this); 70 } 69 71 } 70 72 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r243028 r243094 435 435 , m_backForwardList(WebBackForwardList::create(*this)) 436 436 , m_waitsForPaintAfterViewDidMoveToWindow(m_configuration->waitsForPaintAfterViewDidMoveToWindow()) 437 , m_hasRunningProcess(process.state() != WebProcessProxy::State::Terminated) 437 438 , m_pageID(pageID) 438 439 , m_controlledByAutomation(m_configuration->isControlledByAutomation()) … … 447 448 #endif 448 449 , m_resetRecentCrashCountTimer(RunLoop::main(), this, &WebPageProxy::resetRecentCrashCount) 449 #if HAVE(PENCILKIT)450 , m_editableImageController(std::make_unique<EditableImageController>(*this))451 #endif452 450 { 453 451 RELEASE_LOG_IF_ALLOWED(Loading, "constructor: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); … … 479 477 480 478 m_inspector = WebInspectorProxy::create(this); 481 #if ENABLE(FULLSCREEN_API) 482 m_fullScreenManager = std::make_unique<WebFullScreenManagerProxy>(*this, WebPageProxy::pageClient().fullScreenManagerProxyClient()); 483 #endif 484 #if PLATFORM(IOS_FAMILY) && HAVE(AVKIT) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 485 m_playbackSessionManager = PlaybackSessionManagerProxy::create(*this); 486 m_videoFullscreenManager = VideoFullscreenManagerProxy::create(*this, *m_playbackSessionManager); 487 #endif 488 489 #if ENABLE(APPLE_PAY) 490 m_paymentCoordinator = std::make_unique<WebPaymentCoordinatorProxy>(*this); 491 #endif 492 493 #if USE(SYSTEM_PREVIEW) 494 m_systemPreviewController = std::make_unique<SystemPreviewController>(*this); 495 #endif 496 497 #if ENABLE(WEB_AUTHN) 498 m_credentialsMessenger = std::make_unique<WebAuthenticatorCoordinatorProxy>(*this); 499 #endif 479 480 if (hasRunningProcess()) 481 didAttachToRunningProcess(); 500 482 501 483 m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this); … … 579 561 } 580 562 581 bool WebPageProxy:: isValid() const563 bool WebPageProxy::hasRunningProcess() const 582 564 { 583 565 // A page that has been explicitly closed is never valid. … … 585 567 return false; 586 568 587 return m_ isValid;569 return m_hasRunningProcess; 588 570 } 589 571 … … 644 626 m_uiClient = WTFMove(uiClient); 645 627 646 if (!isValid()) 647 return; 648 649 m_process->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient->canRunBeforeUnloadConfirmPanel()), m_pageID); 628 if (hasRunningProcess()) 629 m_process->send(Messages::WebPage::SetCanRunBeforeUnloadConfirmPanel(m_uiClient->canRunBeforeUnloadConfirmPanel()), m_pageID); 630 650 631 setCanRunModal(m_uiClient->canRunModal()); 651 632 setNeedsFontAttributes(m_uiClient->needsFontAttributes()); … … 660 641 m_iconLoadingClient = WTFMove(iconLoadingClient); 661 642 662 if (! isValid())643 if (!hasRunningProcess()) 663 644 return; 664 645 … … 736 717 } 737 718 738 void WebPageProxy:: reattachToWebProcess(const RegistrableDomain& registrableDomain)719 void WebPageProxy::launchProcess(const RegistrableDomain& registrableDomain) 739 720 { 740 721 ASSERT(!m_isClosed); 741 ASSERT(! isValid());742 743 RELEASE_LOG_IF_ALLOWED(Loading, " reattachToWebProcess: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID);722 ASSERT(!hasRunningProcess()); 723 724 RELEASE_LOG_IF_ALLOWED(Loading, "launchProcess: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 744 725 745 726 m_process->removeWebPage(*this, WebProcessProxy::EndsUsingDataStore::Yes); … … 748 729 auto& processPool = m_process->processPool(); 749 730 m_process = processPool.processForRegistrableDomain(m_websiteDataStore.get(), this, registrableDomain); 750 m_ isValid= true;731 m_hasRunningProcess = true; 751 732 752 733 m_process->addExistingWebPage(*this, WebProcessProxy::BeginsUsingDataStore::Yes); … … 822 803 ASSERT(!m_mainFrame); 823 804 m_mainFrame = WTFMove(mainFrame); 824 m_ isValid= true;805 m_hasRunningProcess = true; 825 806 826 807 m_process->addExistingWebPage(*this, WebProcessProxy::BeginsUsingDataStore::No); … … 845 826 updateThrottleState(); 846 827 847 #if ENABLE(FULLSCREEN_API) 848 m_fullScreenManager = std::make_unique<WebFullScreenManagerProxy>(*this, pageClient().fullScreenManagerProxyClient()); 849 #endif 850 #if PLATFORM(IOS_FAMILY) && HAVE(AVKIT) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 851 m_playbackSessionManager = PlaybackSessionManagerProxy::create(*this); 852 m_videoFullscreenManager = VideoFullscreenManagerProxy::create(*this, *m_playbackSessionManager); 853 #endif 854 855 #if ENABLE(APPLE_PAY) 856 m_paymentCoordinator = std::make_unique<WebPaymentCoordinatorProxy>(*this); 857 #endif 858 859 #if USE(SYSTEM_PREVIEW) 860 m_systemPreviewController = std::make_unique<SystemPreviewController>(*this); 861 #endif 862 863 #if ENABLE(WEB_AUTHN) 864 m_credentialsMessenger = std::make_unique<WebAuthenticatorCoordinatorProxy>(*this); 865 #endif 866 867 #if HAVE(PENCILKIT) 868 m_editableImageController = std::make_unique<EditableImageController>(*this); 869 #endif 828 didAttachToRunningProcess(); 870 829 871 830 // In the process-swap case, the ProvisionalPageProxy already took care of initializing the WebPage in the WebProcess. … … 887 846 } 888 847 889 RefPtr<API::Navigation> WebPageProxy::reattachToWebProcessForReload() 890 { 891 RELEASE_LOG_IF_ALLOWED(Loading, "reattachToWebProcessForReload: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 848 void WebPageProxy::didAttachToRunningProcess() 849 { 850 ASSERT(hasRunningProcess()); 851 852 #if ENABLE(FULLSCREEN_API) 853 ASSERT(!m_fullScreenManager); 854 m_fullScreenManager = std::make_unique<WebFullScreenManagerProxy>(*this, pageClient().fullScreenManagerProxyClient()); 855 #endif 856 #if PLATFORM(IOS_FAMILY) && HAVE(AVKIT) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) 857 ASSERT(!m_playbackSessionManager); 858 m_playbackSessionManager = PlaybackSessionManagerProxy::create(*this); 859 ASSERT(!m_videoFullscreenManager); 860 m_videoFullscreenManager = VideoFullscreenManagerProxy::create(*this, *m_playbackSessionManager); 861 #endif 862 863 #if ENABLE(APPLE_PAY) 864 ASSERT(!m_paymentCoordinator); 865 m_paymentCoordinator = std::make_unique<WebPaymentCoordinatorProxy>(*this); 866 #endif 867 868 #if USE(SYSTEM_PREVIEW) 869 ASSERT(!m_systemPreviewController); 870 m_systemPreviewController = std::make_unique<SystemPreviewController>(*this); 871 #endif 872 873 #if ENABLE(WEB_AUTHN) 874 ASSERT(!m_credentialsMessenger); 875 m_credentialsMessenger = std::make_unique<WebAuthenticatorCoordinatorProxy>(*this); 876 #endif 877 878 #if HAVE(PENCILKIT) 879 ASSERT(!m_editableImageController); 880 m_editableImageController = std::make_unique<EditableImageController>(*this); 881 #endif 882 } 883 884 RefPtr<API::Navigation> WebPageProxy::launchProcessForReload() 885 { 886 RELEASE_LOG_IF_ALLOWED(Loading, "launchProcessForReload: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 892 887 893 888 if (m_isClosed) { 894 RELEASE_LOG_IF_ALLOWED(Loading, " reattachToWebProcessForReload: page is closed: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID);889 RELEASE_LOG_IF_ALLOWED(Loading, "launchProcessForReload: page is closed: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 895 890 return nullptr; 896 891 } 897 892 898 ASSERT(! isValid());893 ASSERT(!hasRunningProcess()); 899 894 auto registrableDomain = m_backForwardList->currentItem() ? RegistrableDomain { URL(URL(), m_backForwardList->currentItem()->url()) } : RegistrableDomain { }; 900 reattachToWebProcess(registrableDomain);895 launchProcess(registrableDomain); 901 896 902 897 if (!m_backForwardList->currentItem()) { 903 RELEASE_LOG_IF_ALLOWED(Loading, " reattachToWebProcessForReload: no current item to reload: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID);898 RELEASE_LOG_IF_ALLOWED(Loading, "launchProcessForReload: no current item to reload: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 904 899 return nullptr; 905 900 } … … 914 909 } 915 910 916 RefPtr<API::Navigation> WebPageProxy:: reattachToWebProcessWithItem(WebBackForwardListItem& item)917 { 918 RELEASE_LOG_IF_ALLOWED(Loading, " reattachToWebProcessWithItem: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID);911 RefPtr<API::Navigation> WebPageProxy::launchProcessWithItem(WebBackForwardListItem& item) 912 { 913 RELEASE_LOG_IF_ALLOWED(Loading, "launchProcessWithItem: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 919 914 920 915 if (m_isClosed) { 921 RELEASE_LOG_IF_ALLOWED(Loading, " reattachToWebProcessWithItem: page is closed: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID);916 RELEASE_LOG_IF_ALLOWED(Loading, "launchProcessWithItem: page is closed: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 922 917 return nullptr; 923 918 } 924 919 925 ASSERT(! isValid());926 reattachToWebProcess(RegistrableDomain { URL(URL(), item.url()) });920 ASSERT(!hasRunningProcess()); 921 launchProcess(RegistrableDomain { URL(URL(), item.url()) }); 927 922 928 923 if (&item != m_backForwardList->currentItem()) … … 956 951 void WebPageProxy::initializeWebPage() 957 952 { 958 ASSERT(isValid()); 953 if (!hasRunningProcess()) 954 return; 959 955 960 956 setDrawingArea(pageClient().createDrawingAreaProxy(m_process)); … … 1054 1050 bool WebPageProxy::tryClose() 1055 1051 { 1056 if (! isValid())1052 if (!hasRunningProcess()) 1057 1053 return true; 1058 1054 … … 1097 1093 RELEASE_LOG_IF_ALLOWED(Loading, "loadRequest: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 1098 1094 1099 if (! isValid())1100 reattachToWebProcess(RegistrableDomain { request.url() });1095 if (!hasRunningProcess()) 1096 launchProcess(RegistrableDomain { request.url() }); 1101 1097 1102 1098 auto navigation = m_navigationState->createLoadRequestNavigation(ResourceRequest(request), m_backForwardList->currentItem()); … … 1145 1141 } 1146 1142 1147 if (! isValid())1148 reattachToWebProcess({ });1143 if (!hasRunningProcess()) 1144 launchProcess({ }); 1149 1145 1150 1146 URL fileURL = URL(URL(), fileURLString); … … 1197 1193 } 1198 1194 1199 if (! isValid())1200 reattachToWebProcess({ });1195 if (!hasRunningProcess()) 1196 launchProcess({ }); 1201 1197 1202 1198 auto navigation = m_navigationState->createLoadDataNavigation(std::make_unique<API::SubstituteData>(data.vector(), MIMEType, encoding, baseURL, userData)); … … 1246 1242 m_isLoadingAlternateHTMLStringForFailingProvisionalLoad = true; 1247 1243 1248 if (! isValid())1249 reattachToWebProcess(RegistrableDomain { baseURL });1244 if (!hasRunningProcess()) 1245 launchProcess(RegistrableDomain { baseURL }); 1250 1246 1251 1247 auto transaction = m_pageLoadState.transaction(); … … 1283 1279 } 1284 1280 1285 if (! isValid())1286 reattachToWebProcess({ });1281 if (!hasRunningProcess()) 1282 launchProcess({ }); 1287 1283 1288 1284 auto transaction = m_pageLoadState.transaction(); … … 1313 1309 return; 1314 1310 1315 if (! isValid())1316 reattachToWebProcess(RegistrableDomain { URL(URL(), urlString) });1311 if (!hasRunningProcess()) 1312 launchProcess(RegistrableDomain { URL(URL(), urlString) }); 1317 1313 1318 1314 m_process->send(Messages::WebPage::NavigateToPDFLinkWithSimulatedClick(urlString, documentPoint, screenPoint), m_pageID); … … 1324 1320 RELEASE_LOG_IF_ALLOWED(Loading, "stopLoading: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 1325 1321 1326 if (! isValid()) {1322 if (!hasRunningProcess()) { 1327 1323 RELEASE_LOG_IF_ALLOWED(Loading, "navigateToPDFLinkWithSimulatedClick: page is not valid: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 1328 1324 return; … … 1354 1350 } 1355 1351 1356 if (! isValid())1357 return reattachToWebProcessForReload();1352 if (!hasRunningProcess()) 1353 return launchProcessForReload(); 1358 1354 1359 1355 auto navigation = m_navigationState->createReloadNavigation(); … … 1419 1415 LOG(Loading, "WebPageProxy %p goToBackForwardItem to item URL %s", this, item.url().utf8().data()); 1420 1416 1421 if (! isValid())1422 return reattachToWebProcessWithItem(item);1417 if (!hasRunningProcess()) 1418 return launchProcessWithItem(item); 1423 1419 1424 1420 auto transaction = m_pageLoadState.transaction(); … … 1440 1436 RELEASE_LOG_IF_ALLOWED(Loading, "tryRestoreScrollPosition: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 1441 1437 1442 if (! isValid()) {1438 if (!hasRunningProcess()) { 1443 1439 RELEASE_LOG_IF_ALLOWED(Loading, "tryRestoreScrollPosition: page is not valid: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 1444 1440 return; … … 1504 1500 m_controlledByAutomation = controlled; 1505 1501 1506 if (! isValid())1502 if (!hasRunningProcess()) 1507 1503 return; 1508 1504 … … 1529 1525 void WebPageProxy::setIndicating(bool indicating) 1530 1526 { 1531 if (! isValid())1527 if (!hasRunningProcess()) 1532 1528 return; 1533 1529 … … 1578 1574 1579 1575 m_backgroundColor = color; 1580 if ( isValid())1576 if (hasRunningProcess()) 1581 1577 m_process->send(Messages::WebPage::SetBackgroundColor(color), m_pageID); 1582 1578 } … … 1589 1585 m_topContentInset = contentInset; 1590 1586 1591 if (! isValid())1587 if (!hasRunningProcess()) 1592 1588 return; 1593 1589 #if PLATFORM(COCOA) … … 1608 1604 m_underlayColor = color; 1609 1605 1610 if ( isValid())1606 if (hasRunningProcess()) 1611 1607 m_process->send(Messages::WebPage::SetUnderlayColor(color), m_pageID); 1612 1608 } … … 1614 1610 void WebPageProxy::viewWillStartLiveResize() 1615 1611 { 1616 if (! isValid())1612 if (!hasRunningProcess()) 1617 1613 return; 1618 1614 … … 1623 1619 void WebPageProxy::viewWillEndLiveResize() 1624 1620 { 1625 if (! isValid())1621 if (!hasRunningProcess()) 1626 1622 return; 1627 1623 m_process->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID); … … 1729 1725 #endif 1730 1726 1731 if (! isValid())1727 if (!hasRunningProcess()) 1732 1728 return; 1733 1729 … … 1863 1859 void WebPageProxy::layerHostingModeDidChange() 1864 1860 { 1865 if (! isValid())1861 if (!hasRunningProcess()) 1866 1862 return; 1867 1863 … … 1876 1872 void WebPageProxy::waitForDidUpdateActivityState(ActivityStateChangeID activityStateChangeID) 1877 1873 { 1878 if (! isValid())1874 if (!hasRunningProcess()) 1879 1875 return; 1880 1876 … … 1907 1903 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent, WTF::Function<void (CallbackBase::Error)>&& callbackFunction) 1908 1904 { 1909 if (! isValid()) {1905 if (!hasRunningProcess()) { 1910 1906 callbackFunction(CallbackBase::Error::OwnerWasInvalidated); 1911 1907 return; … … 1918 1914 void WebPageProxy::clearSelection() 1919 1915 { 1920 if (! isValid())1916 if (!hasRunningProcess()) 1921 1917 return; 1922 1918 m_process->send(Messages::WebPage::ClearSelection(), m_pageID); … … 1925 1921 void WebPageProxy::restoreSelectionInFocusedEditableElement() 1926 1922 { 1927 if (! isValid())1923 if (!hasRunningProcess()) 1928 1924 return; 1929 1925 m_process->send(Messages::WebPage::RestoreSelectionInFocusedEditableElement(), m_pageID); … … 1932 1928 void WebPageProxy::validateCommand(const String& commandName, WTF::Function<void (const String&, bool, int32_t, CallbackBase::Error)>&& callbackFunction) 1933 1929 { 1934 if (! isValid()) {1930 if (!hasRunningProcess()) { 1935 1931 callbackFunction(String(), false, 0, CallbackBase::Error::Unknown); 1936 1932 return; … … 1943 1939 void WebPageProxy::increaseListLevel() 1944 1940 { 1945 if (! isValid())1941 if (!hasRunningProcess()) 1946 1942 return; 1947 1943 … … 1951 1947 void WebPageProxy::decreaseListLevel() 1952 1948 { 1953 if (! isValid())1949 if (!hasRunningProcess()) 1954 1950 return; 1955 1951 … … 1959 1955 void WebPageProxy::changeListType() 1960 1956 { 1961 if (! isValid())1957 if (!hasRunningProcess()) 1962 1958 return; 1963 1959 … … 1967 1963 void WebPageProxy::setBaseWritingDirection(WritingDirection direction) 1968 1964 { 1969 if (! isValid())1965 if (!hasRunningProcess()) 1970 1966 return; 1971 1967 … … 1993 1989 m_needsFontAttributes = needsFontAttributes; 1994 1990 1995 if ( isValid())1991 if (hasRunningProcess()) 1996 1992 m_process->send(Messages::WebPage::SetNeedsFontAttributes(needsFontAttributes), m_pageID); 1997 1993 } … … 2014 2010 void WebPageProxy::executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 2015 2011 { 2016 if (! isValid()) {2012 if (!hasRunningProcess()) { 2017 2013 callbackFunction(CallbackBase::Error::Unknown); 2018 2014 return; … … 2027 2023 static NeverDestroyed<String> ignoreSpellingCommandName(MAKE_STATIC_STRING_IMPL("ignoreSpelling")); 2028 2024 2029 if (! isValid())2025 if (!hasRunningProcess()) 2030 2026 return; 2031 2027 … … 2038 2034 void WebPageProxy::requestFontAttributesAtSelectionStart(Function<void(const WebCore::FontAttributes&, CallbackBase::Error)>&& callback) 2039 2035 { 2040 if (! isValid()) {2036 if (!hasRunningProcess()) { 2041 2037 callback({ }, CallbackBase::Error::Unknown); 2042 2038 return; … … 2059 2055 if (editable == m_isEditable) 2060 2056 return; 2061 if (!isValid())2062 return;2063 2057 2064 2058 m_isEditable = editable; 2059 2060 if (!hasRunningProcess()) 2061 return; 2062 2065 2063 m_process->send(Messages::WebPage::SetEditable(editable), m_pageID); 2066 2064 } … … 2115 2113 void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData& dragData, const String& dragStorageName, SandboxExtension::Handle&& sandboxExtensionHandle, SandboxExtension::HandleArray&& sandboxExtensionsForUpload) 2116 2114 { 2117 if (! isValid())2115 if (!hasRunningProcess()) 2118 2116 return; 2119 2117 #if PLATFORM(GTK) … … 2158 2156 void WebPageProxy::dragEnded(const IntPoint& clientPosition, const IntPoint& globalPosition, uint64_t operation) 2159 2157 { 2160 if (! isValid())2158 if (!hasRunningProcess()) 2161 2159 return; 2162 2160 m_process->send(Messages::WebPage::DragEnded(clientPosition, globalPosition, operation), m_pageID); … … 2171 2169 void WebPageProxy::didStartDrag() 2172 2170 { 2173 if ( isValid())2171 if (hasRunningProcess()) 2174 2172 m_process->send(Messages::WebPage::DidStartDrag(), m_pageID); 2175 2173 } … … 2177 2175 void WebPageProxy::dragCancelled() 2178 2176 { 2179 if ( isValid())2177 if (hasRunningProcess()) 2180 2178 m_process->send(Messages::WebPage::DragCancelled(), m_pageID); 2181 2179 } … … 2232 2230 void WebPageProxy::handleMouseEvent(const NativeWebMouseEvent& event) 2233 2231 { 2234 if (! isValid())2232 if (!hasRunningProcess()) 2235 2233 return; 2236 2234 … … 2258 2256 void WebPageProxy::processNextQueuedMouseEvent() 2259 2257 { 2260 if (! isValid())2258 if (!hasRunningProcess()) 2261 2259 return; 2262 2260 … … 2351 2349 #endif 2352 2350 2353 if (! isValid())2351 if (!hasRunningProcess()) 2354 2352 return; 2355 2353 … … 2422 2420 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event) 2423 2421 { 2424 if (! isValid())2422 if (!hasRunningProcess()) 2425 2423 return; 2426 2424 … … 2594 2592 void WebPageProxy::handleGestureEvent(const NativeWebGestureEvent& event) 2595 2593 { 2596 if (! isValid())2594 if (!hasRunningProcess()) 2597 2595 return; 2598 2596 … … 2613 2611 void WebPageProxy::handleTouchEventSynchronously(NativeWebTouchEvent& event) 2614 2612 { 2615 if (! isValid())2613 if (!hasRunningProcess()) 2616 2614 return; 2617 2615 … … 2653 2651 void WebPageProxy::handleTouchEventAsynchronously(const NativeWebTouchEvent& event) 2654 2652 { 2655 if (! isValid())2653 if (!hasRunningProcess()) 2656 2654 return; 2657 2655 … … 2669 2667 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event) 2670 2668 { 2671 if (! isValid())2669 if (!hasRunningProcess()) 2672 2670 return; 2673 2671 … … 2710 2708 void WebPageProxy::scrollBy(ScrollDirection direction, ScrollGranularity granularity) 2711 2709 { 2712 if (! isValid())2710 if (!hasRunningProcess()) 2713 2711 return; 2714 2712 … … 2718 2716 void WebPageProxy::centerSelectionInVisibleArea() 2719 2717 { 2720 if (! isValid())2718 if (!hasRunningProcess()) 2721 2719 return; 2722 2720 … … 2825 2823 void WebPageProxy::receivedPolicyDecision(PolicyAction action, API::Navigation* navigation, Optional<WebsitePoliciesData>&& websitePolicies, Ref<PolicyDecisionSender>&& sender, WillContinueLoadInNewProcess willContinueLoadInNewProcess) 2826 2824 { 2827 if (! isValid()) {2825 if (!hasRunningProcess()) { 2828 2826 sender->send(PolicyAction::Ignore, 0, DownloadID(), WTF::nullopt); 2829 2827 return; … … 2960 2958 #endif 2961 2959 2962 if (! isValid())2960 if (!hasRunningProcess()) 2963 2961 return; 2964 2962 m_process->send(Messages::WebPage::SetUserAgent(m_userAgent), m_pageID); … … 2994 2992 void WebPageProxy::resumeActiveDOMObjectsAndAnimations() 2995 2993 { 2996 if (! isValid() || !m_isPageSuspended)2994 if (!hasRunningProcess() || !m_isPageSuspended) 2997 2995 return; 2998 2996 … … 3004 3002 void WebPageProxy::suspendActiveDOMObjectsAndAnimations() 3005 3003 { 3006 if (! isValid() || m_isPageSuspended)3004 if (!hasRunningProcess() || m_isPageSuspended) 3007 3005 return; 3008 3006 … … 3024 3022 m_customTextEncodingName = encodingName; 3025 3023 3026 if (! isValid())3024 if (!hasRunningProcess()) 3027 3025 return; 3028 3026 m_process->send(Messages::WebPage::SetCustomTextEncodingName(encodingName), m_pageID); … … 3097 3095 void WebPageProxy::setTextZoomFactor(double zoomFactor) 3098 3096 { 3099 if (!isValid())3100 return;3101 3102 3097 if (m_textZoomFactor == zoomFactor) 3103 3098 return; 3104 3099 3105 3100 m_textZoomFactor = zoomFactor; 3101 3102 if (!hasRunningProcess()) 3103 return; 3104 3106 3105 m_process->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID); 3107 3106 } … … 3109 3108 void WebPageProxy::setPageZoomFactor(double zoomFactor) 3110 3109 { 3111 if (!isValid())3112 return;3113 3114 3110 if (m_pageZoomFactor == zoomFactor) 3115 3111 return; … … 3118 3114 3119 3115 m_pageZoomFactor = zoomFactor; 3116 3117 if (!hasRunningProcess()) 3118 return; 3119 3120 3120 m_process->send(Messages::WebPage::SetPageZoomFactor(m_pageZoomFactor), m_pageID); 3121 3121 } … … 3123 3123 void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor) 3124 3124 { 3125 if (!isValid())3126 return;3127 3128 3125 if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor) 3129 3126 return; … … 3133 3130 m_pageZoomFactor = pageZoomFactor; 3134 3131 m_textZoomFactor = textZoomFactor; 3132 3133 if (!hasRunningProcess()) 3134 return; 3135 3135 3136 m_process->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); 3136 3137 } … … 3158 3159 ASSERT(scale > 0); 3159 3160 3160 if (!isValid())3161 return;3162 3163 3161 m_pageScaleFactor = scale; 3162 3163 if (!hasRunningProcess()) 3164 return; 3165 3164 3166 m_process->send(Messages::WebPage::ScalePage(scale, origin), m_pageID); 3165 3167 } … … 3169 3171 ASSERT(scale > 0); 3170 3172 3171 if (!isValid())3172 return;3173 3174 3173 m_pageScaleFactor = scale; 3174 3175 if (!hasRunningProcess()) 3176 return; 3177 3175 3178 m_process->send(Messages::WebPage::ScalePageInViewCoordinates(scale, centerInViewCoordinates), m_pageID); 3176 3179 } … … 3180 3183 ASSERT(scale > 0); 3181 3184 3182 if (!isValid())3183 return;3184 3185 3185 m_viewScaleFactor = scale; 3186 3187 if (!hasRunningProcess()) 3188 return; 3189 3186 3190 m_process->send(Messages::WebPage::ScaleView(scale), m_pageID); 3187 3191 } … … 3200 3204 void WebPageProxy::windowScreenDidChange(PlatformDisplayID displayID) 3201 3205 { 3202 if (! isValid())3206 if (!hasRunningProcess()) 3203 3207 return; 3204 3208 … … 3213 3217 void WebPageProxy::setCustomDeviceScaleFactor(float customScaleFactor) 3214 3218 { 3215 if (!isValid())3216 return;3217 3218 3219 // FIXME: Remove this once we bump cairo requirements to support HiDPI. 3219 3220 // https://bugs.webkit.org/show_bug.cgi?id=133378 … … 3233 3234 m_customDeviceScaleFactor = WTF::nullopt; 3234 3235 3236 if (!hasRunningProcess()) 3237 return; 3238 3235 3239 if (deviceScaleFactor() != oldScaleFactor) 3236 3240 m_drawingArea->deviceScaleFactorDidChange(); … … 3239 3243 void WebPageProxy::accessibilitySettingsDidChange() 3240 3244 { 3241 if (! isValid())3245 if (!hasRunningProcess()) 3242 3246 return; 3243 3247 … … 3248 3252 void WebPageProxy::updateAccessibilityEventsEnabled(bool enabled) 3249 3253 { 3250 if (! isValid())3254 if (!hasRunningProcess()) 3251 3255 return; 3252 3256 … … 3257 3261 void WebPageProxy::setUseFixedLayout(bool fixed) 3258 3262 { 3259 if (!isValid())3260 return;3261 3262 3263 // This check is fine as the value is initialized in the web 3263 3264 // process as part of the creation parameters. … … 3268 3269 if (!fixed) 3269 3270 m_fixedLayoutSize = IntSize(); 3271 3272 if (!hasRunningProcess()) 3273 return; 3274 3270 3275 m_process->send(Messages::WebPage::SetUseFixedLayout(fixed), m_pageID); 3271 3276 } … … 3273 3278 void WebPageProxy::setFixedLayoutSize(const IntSize& size) 3274 3279 { 3275 if (!isValid())3276 return;3277 3278 3280 if (size == m_fixedLayoutSize) 3279 3281 return; 3280 3282 3281 3283 m_fixedLayoutSize = size; 3284 3285 if (!hasRunningProcess()) 3286 return; 3287 3282 3288 m_process->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID); 3283 3289 } … … 3285 3291 void WebPageProxy::setAlwaysShowsHorizontalScroller(bool alwaysShowsHorizontalScroller) 3286 3292 { 3287 if (!isValid())3288 return;3289 3290 3293 if (alwaysShowsHorizontalScroller == m_alwaysShowsHorizontalScroller) 3291 3294 return; 3292 3295 3293 3296 m_alwaysShowsHorizontalScroller = alwaysShowsHorizontalScroller; 3297 3298 if (!hasRunningProcess()) 3299 return; 3300 3294 3301 m_process->send(Messages::WebPage::SetAlwaysShowsHorizontalScroller(alwaysShowsHorizontalScroller), m_pageID); 3295 3302 } … … 3297 3304 void WebPageProxy::setAlwaysShowsVerticalScroller(bool alwaysShowsVerticalScroller) 3298 3305 { 3299 if (!isValid())3300 return;3301 3302 3306 if (alwaysShowsVerticalScroller == m_alwaysShowsVerticalScroller) 3303 3307 return; 3304 3308 3305 3309 m_alwaysShowsVerticalScroller = alwaysShowsVerticalScroller; 3310 3311 if (!hasRunningProcess()) 3312 return; 3313 3306 3314 m_process->send(Messages::WebPage::SetAlwaysShowsVerticalScroller(alwaysShowsVerticalScroller), m_pageID); 3307 3315 } 3308 3316 3309 3317 void WebPageProxy::listenForLayoutMilestones(OptionSet<WebCore::LayoutMilestone> milestones) 3310 { 3311 if (!isValid()) 3312 return; 3313 3318 { 3314 3319 if (milestones == m_observedLayoutMilestones) 3315 3320 return; 3316 3321 3317 3322 m_observedLayoutMilestones = milestones; 3323 3324 if (!hasRunningProcess()) 3325 return; 3326 3318 3327 m_process->send(Messages::WebPage::ListenForLayoutMilestones(milestones), m_pageID); 3319 3328 } … … 3321 3330 void WebPageProxy::setSuppressScrollbarAnimations(bool suppressAnimations) 3322 3331 { 3323 if (!isValid())3324 return;3325 3326 3332 if (suppressAnimations == m_suppressScrollbarAnimations) 3327 3333 return; 3328 3334 3329 3335 m_suppressScrollbarAnimations = suppressAnimations; 3336 3337 if (!hasRunningProcess()) 3338 return; 3339 3330 3340 m_process->send(Messages::WebPage::SetSuppressScrollbarAnimations(suppressAnimations), m_pageID); 3331 3341 } … … 3378 3388 m_enableVerticalRubberBanding = enableVerticalRubberBanding; 3379 3389 3380 if (! isValid())3390 if (!hasRunningProcess()) 3381 3391 return; 3382 3392 m_process->send(Messages::WebPage::SetEnableVerticalRubberBanding(enableVerticalRubberBanding), m_pageID); … … 3395 3405 m_enableHorizontalRubberBanding = enableHorizontalRubberBanding; 3396 3406 3397 if (! isValid())3407 if (!hasRunningProcess()) 3398 3408 return; 3399 3409 m_process->send(Messages::WebPage::SetEnableHorizontalRubberBanding(enableHorizontalRubberBanding), m_pageID); … … 3412 3422 m_backgroundExtendsBeyondPage = backgroundExtendsBeyondPage; 3413 3423 3414 if (! isValid())3424 if (!hasRunningProcess()) 3415 3425 return; 3416 3426 m_process->send(Messages::WebPage::SetBackgroundExtendsBeyondPage(backgroundExtendsBeyondPage), m_pageID); … … 3429 3439 m_paginationMode = mode; 3430 3440 3431 if (! isValid())3441 if (!hasRunningProcess()) 3432 3442 return; 3433 3443 m_process->send(Messages::WebPage::SetPaginationMode(mode), m_pageID); … … 3441 3451 m_paginationBehavesLikeColumns = behavesLikeColumns; 3442 3452 3443 if (! isValid())3453 if (!hasRunningProcess()) 3444 3454 return; 3445 3455 m_process->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID); … … 3453 3463 m_pageLength = pageLength; 3454 3464 3455 if (! isValid())3465 if (!hasRunningProcess()) 3456 3466 return; 3457 3467 m_process->send(Messages::WebPage::SetPageLength(pageLength), m_pageID); … … 3465 3475 m_gapBetweenPages = gap; 3466 3476 3467 if (! isValid())3477 if (!hasRunningProcess()) 3468 3478 return; 3469 3479 m_process->send(Messages::WebPage::SetGapBetweenPages(gap), m_pageID); … … 3477 3487 m_paginationLineGridEnabled = lineGridEnabled; 3478 3488 3479 if (! isValid())3489 if (!hasRunningProcess()) 3480 3490 return; 3481 3491 m_process->send(Messages::WebPage::SetPaginationLineGridEnabled(lineGridEnabled), m_pageID); … … 3529 3539 void WebPageProxy::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount) 3530 3540 { 3531 if (! isValid())3541 if (!hasRunningProcess()) 3532 3542 return; 3533 3543 … … 3537 3547 void WebPageProxy::replaceMatches(Vector<uint32_t>&& matchIndices, const String& replacementText, bool selectionOnly, Function<void(uint64_t, CallbackBase::Error)>&& callback) 3538 3548 { 3539 if (! isValid()) {3549 if (!hasRunningProcess()) { 3540 3550 callback(0, CallbackBase::Error::Unknown); 3541 3551 return; … … 3546 3556 } 3547 3557 3558 void WebPageProxy::launchInitialProcessIfNecessary() 3559 { 3560 if (&process() == process().processPool().dummyProcessProxy()) 3561 launchProcess({ }); 3562 } 3563 3548 3564 void WebPageProxy::runJavaScriptInMainFrame(const String& script, bool forceUserGesture, WTF::Function<void (API::SerializedScriptValue*, bool hadException, const ExceptionDetails&, CallbackBase::Error)>&& callbackFunction) 3549 3565 { 3550 if (!isValid()) { 3566 // For backward-compatibility support running script in a WebView which has not done any loads yets. 3567 launchInitialProcessIfNecessary(); 3568 3569 if (!hasRunningProcess()) { 3551 3570 callbackFunction(nullptr, false, { }, CallbackBase::Error::Unknown); 3552 3571 return; … … 3559 3578 void WebPageProxy::runJavaScriptInMainFrameScriptWorld(const String& script, bool forceUserGesture, const String& worldName, WTF::Function<void(API::SerializedScriptValue*, bool hadException, const ExceptionDetails&, CallbackBase::Error)>&& callbackFunction) 3560 3579 { 3561 if (!isValid()) { 3580 // For backward-compatibility support running script in a WebView which has not done any loads yets. 3581 launchInitialProcessIfNecessary(); 3582 3583 if (!hasRunningProcess()) { 3562 3584 callbackFunction(nullptr, false, { }, CallbackBase::Error::Unknown); 3563 3585 return; … … 3570 3592 void WebPageProxy::getRenderTreeExternalRepresentation(WTF::Function<void (const String&, CallbackBase::Error)>&& callbackFunction) 3571 3593 { 3572 if (! isValid()) {3594 if (!hasRunningProcess()) { 3573 3595 callbackFunction(String(), CallbackBase::Error::Unknown); 3574 3596 return; … … 3581 3603 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, WTF::Function<void (const String&, CallbackBase::Error)>&& callbackFunction) 3582 3604 { 3583 if (! isValid()) {3605 if (!hasRunningProcess()) { 3584 3606 callbackFunction(String(), CallbackBase::Error::Unknown); 3585 3607 return; … … 3593 3615 void WebPageProxy::getContentsAsString(WTF::Function<void (const String&, CallbackBase::Error)>&& callbackFunction) 3594 3616 { 3595 if (! isValid()) {3617 if (!hasRunningProcess()) { 3596 3618 callbackFunction(String(), CallbackBase::Error::Unknown); 3597 3619 return; … … 3606 3628 void WebPageProxy::getContentsAsAttributedString(CompletionHandler<void(const AttributedString&)>&& completionHandler) 3607 3629 { 3608 if (! isValid()) {3630 if (!hasRunningProcess()) { 3609 3631 completionHandler(AttributedString()); 3610 3632 return; … … 3617 3639 void WebPageProxy::getBytecodeProfile(WTF::Function<void (const String&, CallbackBase::Error)>&& callbackFunction) 3618 3640 { 3619 if (! isValid()) {3641 if (!hasRunningProcess()) { 3620 3642 callbackFunction(String(), CallbackBase::Error::Unknown); 3621 3643 return; … … 3629 3651 void WebPageProxy::getSamplingProfilerOutput(WTF::Function<void (const String&, CallbackBase::Error)>&& callbackFunction) 3630 3652 { 3631 if (! isValid()) {3653 if (!hasRunningProcess()) { 3632 3654 callbackFunction(String(), CallbackBase::Error::Unknown); 3633 3655 return; … … 3642 3664 void WebPageProxy::getContentsAsMHTMLData(Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction) 3643 3665 { 3644 if (! isValid()) {3666 if (!hasRunningProcess()) { 3645 3667 callbackFunction(nullptr, CallbackBase::Error::Unknown); 3646 3668 return; … … 3654 3676 void WebPageProxy::getSelectionOrContentsAsString(WTF::Function<void (const String&, CallbackBase::Error)>&& callbackFunction) 3655 3677 { 3656 if (! isValid()) {3678 if (!hasRunningProcess()) { 3657 3679 callbackFunction(String(), CallbackBase::Error::Unknown); 3658 3680 return; … … 3665 3687 void WebPageProxy::getSelectionAsWebArchiveData(Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction) 3666 3688 { 3667 if (! isValid()) {3689 if (!hasRunningProcess()) { 3668 3690 callbackFunction(nullptr, CallbackBase::Error::Unknown); 3669 3691 return; … … 3676 3698 void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction) 3677 3699 { 3678 if (! isValid() || !frame) {3700 if (!hasRunningProcess() || !frame) { 3679 3701 callbackFunction(nullptr, CallbackBase::Error::Unknown); 3680 3702 return; … … 3687 3709 void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, API::URL* resourceURL, Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction) 3688 3710 { 3689 if (! isValid()) {3711 if (!hasRunningProcess()) { 3690 3712 callbackFunction(nullptr, CallbackBase::Error::Unknown); 3691 3713 return; … … 3698 3720 void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction) 3699 3721 { 3700 if (! isValid()) {3722 if (!hasRunningProcess()) { 3701 3723 callbackFunction(nullptr, CallbackBase::Error::Unknown); 3702 3724 return; … … 3709 3731 void WebPageProxy::forceRepaint(RefPtr<VoidCallback>&& callback) 3710 3732 { 3711 if (! isValid()) {3733 if (!hasRunningProcess()) { 3712 3734 // FIXME: If the page is invalid we should not call the callback. It'd be better to just return false from forceRepaint. 3713 3735 callback->invalidate(CallbackBase::Error::OwnerWasInvalidated); … … 3721 3743 } 3722 3744 3723 if (! isValid()) {3745 if (!hasRunningProcess()) { 3724 3746 callback->invalidate(CallbackBase::Error::OwnerWasInvalidated); 3725 3747 return; … … 3751 3773 void WebPageProxy::preferencesDidChange() 3752 3774 { 3753 if (! isValid())3775 if (!hasRunningProcess()) 3754 3776 return; 3755 3777 … … 5331 5353 m_mediaVolume = volume; 5332 5354 5333 if (! isValid())5355 if (!hasRunningProcess()) 5334 5356 return; 5335 5357 … … 5341 5363 m_mutedState = state; 5342 5364 5343 if (! isValid())5365 if (!hasRunningProcess()) 5344 5366 return; 5345 5367 … … 5358 5380 m_mediaCaptureEnabled = enabled; 5359 5381 5360 if (! isValid())5382 if (!hasRunningProcess()) 5361 5383 return; 5362 5384 … … 5368 5390 void WebPageProxy::stopMediaCapture() 5369 5391 { 5370 if (! isValid())5392 if (!hasRunningProcess()) 5371 5393 return; 5372 5394 … … 5378 5400 void WebPageProxy::stopAllMediaPlayback() 5379 5401 { 5380 if (! isValid())5402 if (!hasRunningProcess()) 5381 5403 return; 5382 5404 … … 5386 5408 void WebPageProxy::suspendAllMediaPlayback() 5387 5409 { 5388 if (! isValid())5410 if (!hasRunningProcess()) 5389 5411 return; 5390 5412 … … 5394 5416 void WebPageProxy::resumeAllMediaPlayback() 5395 5417 { 5396 if (! isValid())5418 if (!hasRunningProcess()) 5397 5419 return; 5398 5420 … … 5403 5425 void WebPageProxy::handleMediaEvent(MediaEventType eventType) 5404 5426 { 5405 if (! isValid())5427 if (!hasRunningProcess()) 5406 5428 return; 5407 5429 … … 5411 5433 void WebPageProxy::setVolumeOfMediaElement(double volume, uint64_t elementID) 5412 5434 { 5413 if (! isValid())5435 if (!hasRunningProcess()) 5414 5436 return; 5415 5437 … … 5425 5447 m_mayStartMediaWhenInWindow = mayStartMedia; 5426 5448 5427 if (! isValid())5449 if (!hasRunningProcess()) 5428 5450 return; 5429 5451 … … 5465 5487 void WebPageProxy::didChooseColor(const WebCore::Color& color) 5466 5488 { 5467 if (! isValid())5489 if (!hasRunningProcess()) 5468 5490 return; 5469 5491 … … 5473 5495 void WebPageProxy::didEndColorPicker() 5474 5496 { 5475 if (! isValid())5497 if (!hasRunningProcess()) 5476 5498 return; 5477 5499 … … 5516 5538 void WebPageProxy::didSelectOption(const String& selectedOption) 5517 5539 { 5518 if (! isValid())5540 if (!hasRunningProcess()) 5519 5541 return; 5520 5542 … … 5526 5548 WebInspectorProxy* WebPageProxy::inspector() const 5527 5549 { 5528 if (isClosed() || ! isValid())5550 if (isClosed() || !hasRunningProcess()) 5529 5551 return nullptr; 5530 5552 return m_inspector.get(); … … 5957 5979 void WebPageProxy::didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>& fileURLs, const String& displayString, const API::Data* iconData) 5958 5980 { 5959 if (! isValid())5981 if (!hasRunningProcess()) 5960 5982 return; 5961 5983 … … 5978 6000 void WebPageProxy::didChooseFilesForOpenPanel(const Vector<String>& fileURLs) 5979 6001 { 5980 if (! isValid())6002 if (!hasRunningProcess()) 5981 6003 return; 5982 6004 … … 6005 6027 void WebPageProxy::didCancelForOpenPanel() 6006 6028 { 6007 if (! isValid())6029 if (!hasRunningProcess()) 6008 6030 return; 6009 6031 … … 6041 6063 m_editCommandSet.remove(&command); 6042 6064 6043 if (! isValid())6065 if (!hasRunningProcess()) 6044 6066 return; 6045 6067 m_process->send(Messages::WebPage::DidRemoveEditCommand(command.commandID()), m_pageID); … … 6588 6610 RELEASE_LOG_IF_ALLOWED(Process, "processDidBecomeUnresponsive: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 6589 6611 6590 if (! isValid())6612 if (!hasRunningProcess()) 6591 6613 return; 6592 6614 … … 6600 6622 RELEASE_LOG_IF_ALLOWED(Process, "processDidBecomeResponsive: webPID = %i, pageID = %" PRIu64, m_process->processIdentifier(), m_pageID); 6601 6623 6602 if (! isValid())6624 if (!hasRunningProcess()) 6603 6625 return; 6604 6626 … … 6631 6653 RELEASE_LOG_IF_ALLOWED(Process, "processDidTerminate: (pid %d), reason %d", processIdentifier(), reason); 6632 6654 6633 ASSERT(m_ isValid);6655 ASSERT(m_hasRunningProcess); 6634 6656 6635 6657 #if PLATFORM(IOS_FAMILY) … … 6734 6756 void WebPageProxy::processWillBecomeSuspended() 6735 6757 { 6736 if (! isValid())6758 if (!hasRunningProcess()) 6737 6759 return; 6738 6760 … … 6744 6766 void WebPageProxy::processWillBecomeForeground() 6745 6767 { 6746 if (! isValid())6768 if (!hasRunningProcess()) 6747 6769 return; 6748 6770 … … 6880 6902 void WebPageProxy::resetStateAfterProcessExited(ProcessTerminationReason terminationReason) 6881 6903 { 6882 if (! isValid())6904 if (!hasRunningProcess()) 6883 6905 return; 6884 6906 … … 6900 6922 m_visiblePageToken = nullptr; 6901 6923 6902 m_ isValid= false;6924 m_hasRunningProcess = false; 6903 6925 m_isPageSuspended = false; 6904 6926 … … 7400 7422 void WebPageProxy::setCanRunModal(bool canRunModal) 7401 7423 { 7402 if (!isValid())7403 return;7404 7405 7424 // It's only possible to change the state for a WebPage which 7406 7425 // already qualifies for running modal child web pages, otherwise 7407 7426 // there's no other possibility than not allowing it. 7408 7427 m_canRunModal = m_uiClient->canRunModal() && canRunModal; 7428 7429 if (!hasRunningProcess()) 7430 return; 7431 7409 7432 m_process->send(Messages::WebPage::SetCanRunModal(m_canRunModal), m_pageID); 7410 7433 } … … 7412 7435 bool WebPageProxy::canRunModal() 7413 7436 { 7414 return isValid() ? m_canRunModal : false;7437 return hasRunningProcess() ? m_canRunModal : false; 7415 7438 } 7416 7439 … … 7435 7458 void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, Ref<ComputedPagesCallback>&& callback) 7436 7459 { 7437 if (! isValid()) {7460 if (!hasRunningProcess()) { 7438 7461 callback->invalidate(); 7439 7462 return; … … 7449 7472 void WebPageProxy::drawRectToImage(WebFrameProxy* frame, const PrintInfo& printInfo, const IntRect& rect, const WebCore::IntSize& imageSize, Ref<ImageCallback>&& callback) 7450 7473 { 7451 if (! isValid()) {7474 if (!hasRunningProcess()) { 7452 7475 callback->invalidate(); 7453 7476 return; … … 7461 7484 void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printInfo, uint32_t first, uint32_t count, Ref<DataCallback>&& callback) 7462 7485 { 7463 if (! isValid()) {7486 if (!hasRunningProcess()) { 7464 7487 callback->invalidate(); 7465 7488 return; … … 7473 7496 void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& printInfo, Ref<PrintFinishedCallback>&& callback) 7474 7497 { 7475 if (! isValid()) {7498 if (!hasRunningProcess()) { 7476 7499 callback->invalidate(); 7477 7500 return; … … 7487 7510 void WebPageProxy::updateBackingStoreDiscardableState() 7488 7511 { 7489 ASSERT( isValid());7512 ASSERT(hasRunningProcess()); 7490 7513 7491 7514 if (!m_drawingArea) … … 7523 7546 m_viewLayoutSize = viewLayoutSize; 7524 7547 7525 if (! isValid())7548 if (!hasRunningProcess()) 7526 7549 return; 7527 7550 … … 7542 7565 m_autoSizingShouldExpandToViewHeight = shouldExpand; 7543 7566 7544 if (! isValid())7567 if (!hasRunningProcess()) 7545 7568 return; 7546 7569 … … 7555 7578 m_viewportSizeForCSSViewportUnits = viewportSize; 7556 7579 7557 if (! isValid())7580 if (!hasRunningProcess()) 7558 7581 return; 7559 7582 … … 7663 7686 { 7664 7687 // FIXME: We need to find out how to proper handle the crashes case. 7665 if (! isValid())7688 if (!hasRunningProcess()) 7666 7689 return; 7667 7690 … … 7671 7694 void WebPageProxy::confirmComposition(const String& compositionString, int64_t selectionStart, int64_t selectionLength) 7672 7695 { 7673 if (! isValid())7696 if (!hasRunningProcess()) 7674 7697 return; 7675 7698 … … 7679 7702 void WebPageProxy::cancelComposition() 7680 7703 { 7681 if (! isValid())7704 if (!hasRunningProcess()) 7682 7705 return; 7683 7706 … … 7698 7721 m_scrollPinningBehavior = pinning; 7699 7722 7700 if ( isValid())7723 if (hasRunningProcess()) 7701 7724 m_process->send(Messages::WebPage::SetScrollPinningBehavior(pinning), m_pageID); 7702 7725 } … … 7716 7739 scrollbarStyleForMessage = static_cast<ScrollbarOverlayStyle>(scrollbarStyle.value()); 7717 7740 7718 if ( isValid())7741 if (hasRunningProcess()) 7719 7742 m_process->send(Messages::WebPage::SetScrollbarOverlayStyle(scrollbarStyleForMessage), m_pageID); 7720 7743 } … … 7761 7784 void WebPageProxy::changeFontAttributes(WebCore::FontAttributeChanges&& changes) 7762 7785 { 7763 if (! isValid())7786 if (!hasRunningProcess()) 7764 7787 return; 7765 7788 … … 7769 7792 void WebPageProxy::changeFont(WebCore::FontChanges&& changes) 7770 7793 { 7771 if (! isValid())7794 if (!hasRunningProcess()) 7772 7795 return; 7773 7796 … … 7779 7802 void WebPageProxy::setTextAsync(const String& text) 7780 7803 { 7781 if ( isValid())7804 if (hasRunningProcess()) 7782 7805 process().send(Messages::WebPage::SetTextAsync(text), m_pageID); 7783 7806 } … … 7785 7808 void WebPageProxy::insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup, EditingRangeIsRelativeTo editingRangeIsRelativeTo, bool suppressSelectionUpdate) 7786 7809 { 7787 if (! isValid())7810 if (!hasRunningProcess()) 7788 7811 return; 7789 7812 … … 7793 7816 void WebPageProxy::getMarkedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&& callbackFunction) 7794 7817 { 7795 if (! isValid()) {7818 if (!hasRunningProcess()) { 7796 7819 callbackFunction(EditingRange(), CallbackBase::Error::Unknown); 7797 7820 return; … … 7804 7827 void WebPageProxy::getSelectedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&& callbackFunction) 7805 7828 { 7806 if (! isValid()) {7829 if (!hasRunningProcess()) { 7807 7830 callbackFunction(EditingRange(), CallbackBase::Error::Unknown); 7808 7831 return; … … 7815 7838 void WebPageProxy::characterIndexForPointAsync(const WebCore::IntPoint& point, WTF::Function<void (uint64_t, CallbackBase::Error)>&& callbackFunction) 7816 7839 { 7817 if (! isValid()) {7840 if (!hasRunningProcess()) { 7818 7841 callbackFunction(0, CallbackBase::Error::Unknown); 7819 7842 return; … … 7826 7849 void WebPageProxy::firstRectForCharacterRangeAsync(const EditingRange& range, WTF::Function<void (const WebCore::IntRect&, const EditingRange&, CallbackBase::Error)>&& callbackFunction) 7827 7850 { 7828 if (! isValid()) {7851 if (!hasRunningProcess()) { 7829 7852 callbackFunction(WebCore::IntRect(), EditingRange(), CallbackBase::Error::Unknown); 7830 7853 return; … … 7837 7860 void WebPageProxy::setCompositionAsync(const String& text, const Vector<CompositionUnderline>& underlines, const EditingRange& selectionRange, const EditingRange& replacementRange) 7838 7861 { 7839 if (! isValid()) {7862 if (!hasRunningProcess()) { 7840 7863 // If this fails, we should call -discardMarkedText on input context to notify the input method. 7841 7864 // This will happen naturally later, as part of reloading the page. … … 7848 7871 void WebPageProxy::confirmCompositionAsync() 7849 7872 { 7850 if (! isValid())7873 if (!hasRunningProcess()) 7851 7874 return; 7852 7875 … … 7870 7893 void WebPageProxy::takeSnapshot(IntRect rect, IntSize bitmapSize, SnapshotOptions options, WTF::Function<void (const ShareableBitmap::Handle&, CallbackBase::Error)>&& callbackFunction) 7871 7894 { 7872 if (! isValid()) {7895 if (!hasRunningProcess()) { 7873 7896 callbackFunction(ShareableBitmap::Handle(), CallbackBase::Error::Unknown); 7874 7897 return; … … 8023 8046 void WebPageProxy::requestActiveNowPlayingSessionInfo(Ref<NowPlayingInfoCallback>&& callback) 8024 8047 { 8025 if (! isValid()) {8048 if (!hasRunningProcess()) { 8026 8049 callback->invalidate(); 8027 8050 return; … … 8113 8136 8114 8137 void WebPageProxy::setUseSystemAppearance(bool useSystemAppearance) 8115 { 8116 if (!isValid()) 8117 return; 8118 8138 { 8119 8139 if (useSystemAppearance == m_useSystemAppearance) 8120 8140 return; 8121 8141 8122 8142 m_useSystemAppearance = useSystemAppearance; 8143 8144 if (!hasRunningProcess()) 8145 return; 8146 8123 8147 m_process->send(Messages::WebPage::SetUseSystemAppearance(useSystemAppearance), m_pageID); 8124 8148 } … … 8138 8162 void WebPageProxy::installActivityStateChangeCompletionHandler(Function<void()>&& completionHandler) 8139 8163 { 8140 if (! isValid()) {8164 if (!hasRunningProcess()) { 8141 8165 completionHandler(); 8142 8166 return; … … 8203 8227 void WebPageProxy::setPlaybackTarget(uint64_t contextId, Ref<MediaPlaybackTarget>&& target) 8204 8228 { 8205 if (! isValid())8229 if (!hasRunningProcess()) 8206 8230 return; 8207 8231 … … 8211 8235 void WebPageProxy::externalOutputDeviceAvailableDidChange(uint64_t contextId, bool available) 8212 8236 { 8213 if (! isValid())8237 if (!hasRunningProcess()) 8214 8238 return; 8215 8239 … … 8219 8243 void WebPageProxy::setShouldPlayToPlaybackTarget(uint64_t contextId, bool shouldPlay) 8220 8244 { 8221 if (! isValid())8245 if (!hasRunningProcess()) 8222 8246 return; 8223 8247 … … 8245 8269 void WebPageProxy::clearWheelEventTestTrigger() 8246 8270 { 8247 if (! isValid())8271 if (!hasRunningProcess()) 8248 8272 return; 8249 8273 … … 8253 8277 void WebPageProxy::callAfterNextPresentationUpdate(WTF::Function<void (CallbackBase::Error)>&& callback) 8254 8278 { 8255 if (! isValid() || !m_drawingArea) {8279 if (!hasRunningProcess() || !m_drawingArea) { 8256 8280 callback(CallbackBase::Error::OwnerWasInvalidated); 8257 8281 return; … … 8268 8292 m_shouldScaleViewToFitDocument = shouldScaleViewToFitDocument; 8269 8293 8270 if (! isValid())8294 if (!hasRunningProcess()) 8271 8295 return; 8272 8296 … … 8282 8306 { 8283 8307 m_iconLoadingClient->getLoadDecisionForIcon(icon, [this, protectedThis = RefPtr<WebPageProxy>(this), loadIdentifier](WTF::Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction) { 8284 if (! isValid()) {8308 if (!hasRunningProcess()) { 8285 8309 if (callbackFunction) 8286 8310 callbackFunction(nullptr, CallbackBase::Error::Unknown); … … 8307 8331 m_isResourceCachingDisabled = disabled; 8308 8332 8309 if (! isValid())8333 if (!hasRunningProcess()) 8310 8334 return; 8311 8335 … … 8320 8344 void WebPageProxy::setUserInterfaceLayoutDirection(WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection) 8321 8345 { 8322 if (! isValid())8346 if (!hasRunningProcess()) 8323 8347 return; 8324 8348 … … 8465 8489 void WebPageProxy::effectiveAppearanceDidChange() 8466 8490 { 8467 if (! isValid())8491 if (!hasRunningProcess()) 8468 8492 return; 8469 8493 … … 8500 8524 void WebPageProxy::insertAttachment(Ref<API::Attachment>&& attachment, Function<void(CallbackBase::Error)>&& callback) 8501 8525 { 8502 if (! isValid()) {8526 if (!hasRunningProcess()) { 8503 8527 callback(CallbackBase::Error::OwnerWasInvalidated); 8504 8528 return; … … 8513 8537 void WebPageProxy::updateAttachmentAttributes(const API::Attachment& attachment, Function<void(CallbackBase::Error)>&& callback) 8514 8538 { 8515 if (! isValid()) {8539 if (!hasRunningProcess()) { 8516 8540 callback(CallbackBase::Error::OwnerWasInvalidated); 8517 8541 return; … … 8674 8698 void WebPageProxy::getApplicationManifest(Function<void(const Optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&& callbackFunction) 8675 8699 { 8676 if (! isValid()) {8700 if (!hasRunningProcess()) { 8677 8701 callbackFunction(WTF::nullopt, CallbackBase::Error::Unknown); 8678 8702 return; … … 8901 8925 void WebPageProxy::textInputContextsInRect(WebCore::FloatRect rect, CompletionHandler<void(const Vector<WebKit::TextInputContext>&)>&& completionHandler) 8902 8926 { 8903 if (! isValid()) {8927 if (!hasRunningProcess()) { 8904 8928 completionHandler({ }); 8905 8929 return; … … 8911 8935 void WebPageProxy::focusTextInputContext(const TextInputContext& context, CompletionHandler<void(bool)>&& completionHandler) 8912 8936 { 8913 if (! isValid()) {8937 if (!hasRunningProcess()) { 8914 8938 completionHandler(false); 8915 8939 return; -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r243028 r243094 1072 1072 WebPageGroup& pageGroup() { return m_pageGroup; } 1073 1073 1074 bool isValid() const; 1074 bool hasRunningProcess() const; 1075 void launchInitialProcessIfNecessary(); 1075 1076 1076 1077 #if ENABLE(DRAG_SUPPORT) … … 1675 1676 void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; } 1676 1677 1677 void reattachToWebProcess(const WebCore::RegistrableDomain&);1678 void launchProcess(const WebCore::RegistrableDomain&); 1678 1679 void swapToWebProcess(Ref<WebProcessProxy>&&, std::unique_ptr<DrawingAreaProxy>&&, RefPtr<WebFrameProxy>&& mainFrame); 1679 1680 void didFailToSuspendAfterProcessSwap(); … … 1683 1684 void finishAttachingToWebProcess(IsProcessSwap); 1684 1685 1685 RefPtr<API::Navigation> reattachToWebProcessForReload();1686 RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem&);1686 RefPtr<API::Navigation> launchProcessForReload(); 1687 RefPtr<API::Navigation> launchProcessWithItem(WebBackForwardListItem&); 1687 1688 1688 1689 void requestNotificationPermission(uint64_t notificationID, const String& originString); … … 2010 2011 void updateFontAttributesAfterEditorStateChange(); 2011 2012 2013 void didAttachToRunningProcess(); 2014 2012 2015 #if ENABLE(RESOURCE_LOAD_STATISTICS) 2013 2016 void logFrameNavigation(const WebFrameProxy&, const URL& pageURL, const WebCore::ResourceRequest&, const URL& redirectURL); … … 2215 2218 2216 2219 // If the process backing the web page is alive and kicking. 2217 bool m_ isValid { true };2220 bool m_hasRunningProcess { false }; 2218 2221 2219 2222 // Whether WebPageProxy::close() has been called on this page. -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r243019 r243094 64 64 #include "WebCoreArgumentCoders.h" 65 65 #include "WebGeolocationManagerProxy.h" 66 #include "WebInspectorUtilities.h" 66 67 #include "WebKit2Initialize.h" 67 68 #include "WebMemorySampler.h" … … 739 740 { 740 741 if (privateBrowsingEnabled) { 741 sendToNetworkingProcess(Messages::NetworkProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters()));742 ensureNetworkProcess().send(Messages::NetworkProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters()), 0); 742 743 } else { 743 networkProcess()->removeSession(PAL::SessionID::legacyPrivateSessionID()); 744 if (auto* networkProcess = this->networkProcess()) 745 networkProcess->removeSession(PAL::SessionID::legacyPrivateSessionID()); 744 746 } 745 747 } … … 899 901 900 902 parameters.cacheModel = cacheModel(); 901 parameters.languages = userPreferredLanguages();903 parameters.languages = configuration().overrideLanguages().isEmpty() ? userPreferredLanguages() : configuration().overrideLanguages(); 902 904 903 905 parameters.urlSchemesRegisteredAsEmptyDocument = copyToVector(m_schemesToRegisterAsEmptyDocument); … … 1105 1107 } 1106 1108 1109 if (m_dummyProcessProxy == process) 1110 m_dummyProcessProxy = nullptr; 1111 1107 1112 // FIXME (Multi-WebProcess): <rdar://problem/12239765> Some of the invalidation calls of the other supplements are still necessary in multi-process mode, but they should only affect data structures pertaining to the process being disconnected. 1108 1113 // Clearing everything causes assertion failures, so it's less trouble to skip that for now. … … 1211 1216 // Sharing processes, e.g. when creating the page via window.open(). 1212 1217 process = &pageConfiguration->relatedPage()->process(); 1218 } else if (WebKit::isInspectorProcessPool(*this)) { 1219 // Do not delay process launch for inspector pages as inspector pages do not know how to transition from a terminated process. 1220 process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { }); 1213 1221 } else { 1214 process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { }); 1222 // In the common case, we delay process launch until something is actually loaded in the page. 1223 if (!m_dummyProcessProxy) { 1224 auto dummyProcessProxy = WebProcessProxy::create(*this, WebsiteDataStore::createNonPersistent().get(), WebProcessProxy::IsPrewarmed::No, WebProcessProxy::ShouldLaunchProcess::No); 1225 m_dummyProcessProxy = dummyProcessProxy.ptr(); 1226 m_processes.append(WTFMove(dummyProcessProxy)); 1227 } 1228 process = m_dummyProcessProxy; 1215 1229 } 1216 1230 ASSERT(process); … … 1279 1293 if (sessionID.isEphemeral()) { 1280 1294 ASSERT(dataStore.parameters().networkSessionParameters.sessionID == sessionID); 1281 if (m_networkProcess) 1295 if (m_networkProcess) { 1282 1296 m_networkProcess->addSession(makeRef(dataStore)); 1283 dataStore.clearPendingCookies(); 1297 dataStore.clearPendingCookies(); 1298 } 1284 1299 } else if (sessionID != PAL::SessionID::defaultSessionID()) { 1285 if (m_networkProcess) 1300 if (m_networkProcess) { 1286 1301 m_networkProcess->addSession(makeRef(dataStore)); 1287 dataStore.clearPendingCookies(); 1302 dataStore.clearPendingCookies(); 1303 } 1288 1304 } 1289 1305 } -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r243034 r243094 165 165 const Vector<RefPtr<WebProcessProxy>>& processes() const { return m_processes; } 166 166 167 // WebProcessProxy object which does not have a running process which is used for convenience, to avoid 168 // null checks in WebPageProxy. 169 WebProcessProxy* dummyProcessProxy() const { return m_dummyProcessProxy; } 170 167 171 // WebProcess or NetworkProcess as approporiate for current process model. The connection must be non-null. 168 172 IPC::Connection* networkingProcessConnection(); … … 587 591 Vector<RefPtr<WebProcessProxy>> m_processes; 588 592 WebProcessProxy* m_prewarmedProcess { nullptr }; 593 WebProcessProxy* m_dummyProcessProxy { nullptr }; // A lightweight WebProcessProxy without backing process. 589 594 590 595 WebProcessProxy* m_processWithPageCache { nullptr }; -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r243034 r243094 123 123 } 124 124 125 Ref<WebProcessProxy> WebProcessProxy::create(WebProcessPool& processPool, WebsiteDataStore& websiteDataStore, IsPrewarmed isPrewarmed )125 Ref<WebProcessProxy> WebProcessProxy::create(WebProcessPool& processPool, WebsiteDataStore& websiteDataStore, IsPrewarmed isPrewarmed, ShouldLaunchProcess shouldLaunchProcess) 126 126 { 127 127 auto proxy = adoptRef(*new WebProcessProxy(processPool, websiteDataStore, isPrewarmed)); 128 proxy->connect(); 128 if (shouldLaunchProcess == ShouldLaunchProcess::Yes) 129 proxy->connect(); 129 130 return proxy; 130 131 } … … 360 361 ASSERT(!globalPageMap().contains(webPage.pageID())); 361 362 ASSERT(!m_isInProcessCache); 362 ASSERT(m_websiteDataStore.ptr() == &webPage.websiteDataStore() );363 ASSERT(m_websiteDataStore.ptr() == &webPage.websiteDataStore() || processPool().dummyProcessProxy() == this); 363 364 364 365 if (beginsUsingDataStore == BeginsUsingDataStore::Yes) … … 848 849 void WebProcessProxy::maybeShutDown(AllowProcessCaching allowProcessCaching) 849 850 { 851 if (processPool().dummyProcessProxy() == this && m_pageMap.isEmpty()) { 852 ASSERT(state() == State::Terminated); 853 m_processPool->disconnectProcess(this); 854 return; 855 } 856 850 857 if (state() == State::Terminated || !canTerminateAuxiliaryProcess()) 851 858 return; -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r243034 r243094 105 105 }; 106 106 107 static Ref<WebProcessProxy> create(WebProcessPool&, WebsiteDataStore&, IsPrewarmed); 107 enum class ShouldLaunchProcess : bool { No, Yes }; 108 109 static Ref<WebProcessProxy> create(WebProcessPool&, WebsiteDataStore&, IsPrewarmed, ShouldLaunchProcess = ShouldLaunchProcess::Yes); 108 110 ~WebProcessProxy(); 109 111 -
trunk/Source/WebKit/UIProcess/gstreamer/InstallMissingMediaPluginsPermissionRequest.cpp
r188121 r243094 47 47 void InstallMissingMediaPluginsPermissionRequest::allow(GUniquePtr<GstInstallPluginsContext>&& context) 48 48 { 49 if (!m_page-> isValid())49 if (!m_page->hasRunningProcess()) 50 50 return; 51 51 … … 73 73 void InstallMissingMediaPluginsPermissionRequest::didEndRequestInstallMissingMediaPlugins(uint32_t result) 74 74 { 75 if (!m_page-> isValid())75 if (!m_page->hasRunningProcess()) 76 76 return; 77 77 -
trunk/Source/WebKit/UIProcess/gtk/WebInspectorProxyGtk.cpp
r240437 r243094 400 400 void WebInspectorProxy::platformDetach() 401 401 { 402 if (!inspectedPage()-> isValid())402 if (!inspectedPage()->hasRunningProcess()) 403 403 return; 404 404 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r243082 r243094 672 672 - (void)setupInteraction 673 673 { 674 // If the page is not valid yet then delay interaction setup until the process is launched/relaunched. 675 if (!_page->hasRunningProcess()) 676 return; 677 674 678 if (_hasSetUpInteractions) 675 679 return; … … 1218 1222 - (void)_webTouchEventsRecognized:(UIWebTouchEventsGestureRecognizer *)gestureRecognizer 1219 1223 { 1220 if (!_page-> isValid())1224 if (!_page->hasRunningProcess()) 1221 1225 return; 1222 1226 … … 6794 6798 - (void)_hoverGestureRecognizerChanged:(UIGestureRecognizer *)gestureRecognizer 6795 6799 { 6796 if (!_page-> isValid())6800 if (!_page->hasRunningProcess()) 6797 6801 return; 6798 6802 -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r242833 r243094 206 206 void WebPageProxy::requestFocusedElementInformation(Function<void(const FocusedElementInformation&, CallbackBase::Error)>&& callback) 207 207 { 208 if (! isValid()) {208 if (!hasRunningProcess()) { 209 209 callback({ }, CallbackBase::Error::OwnerWasInvalidated); 210 210 return; … … 217 217 void WebPageProxy::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdate) 218 218 { 219 if (!isValid())220 return;221 222 219 if (visibleContentRectUpdate == m_lastVisibleContentRectUpdate) 223 220 return; 224 221 225 222 m_lastVisibleContentRectUpdate = visibleContentRectUpdate; 223 224 if (!hasRunningProcess()) 225 return; 226 226 227 m_process->send(Messages::ViewUpdateDispatcher::VisibleContentRectUpdate(m_pageID, visibleContentRectUpdate), 0); 227 228 } … … 234 235 void WebPageProxy::updateStringForFind(const String& string) 235 236 { 236 if (! isValid())237 if (!hasRunningProcess()) 237 238 return; 238 239 … … 310 311 void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, const FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double targetScale, int32_t deviceOrientation, DynamicViewportSizeUpdateID dynamicViewportSizeUpdateID) 311 312 { 312 if (! isValid())313 if (!hasRunningProcess()) 313 314 return; 314 315 … … 326 327 m_viewportConfigurationLayoutSizeScaleFactor = scaleFactor; 327 328 328 if ( isValid())329 if (hasRunningProcess()) 329 330 m_process->send(Messages::WebPage::SetViewportConfigurationViewLayoutSize(size, scaleFactor, minimumEffectiveDeviceWidth), m_pageID); 330 331 } … … 336 337 m_forceAlwaysUserScalable = userScalable; 337 338 338 if ( isValid())339 if (hasRunningProcess()) 339 340 m_process->send(Messages::WebPage::SetForceAlwaysUserScalable(userScalable), m_pageID); 340 341 } … … 344 345 m_maximumUnobscuredSize = size; 345 346 346 if ( isValid())347 if (hasRunningProcess()) 347 348 m_process->send(Messages::WebPage::SetMaximumUnobscuredSize(size), m_pageID); 348 349 } … … 352 353 if (deviceOrientation != m_deviceOrientation) { 353 354 m_deviceOrientation = deviceOrientation; 354 if ( isValid())355 if (hasRunningProcess()) 355 356 m_process->send(Messages::WebPage::SetDeviceOrientation(deviceOrientation), m_pageID); 356 357 } … … 359 360 void WebPageProxy::setOverrideViewportArguments(const Optional<ViewportArguments>& viewportArguments) 360 361 { 361 if ( isValid())362 if (hasRunningProcess()) 362 363 m_process->send(Messages::WebPage::SetOverrideViewportArguments(viewportArguments), m_pageID); 363 364 } … … 416 417 void WebPageProxy::selectWithGesture(const WebCore::IntPoint point, WebCore::TextGranularity granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithFocusedElement, WTF::Function<void(const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>&& callbackFunction) 417 418 { 418 if (! isValid()) {419 if (!hasRunningProcess()) { 419 420 callbackFunction(WebCore::IntPoint(), 0, 0, 0, CallbackBase::Error::Unknown); 420 421 return; … … 427 428 void WebPageProxy::updateSelectionWithTouches(const WebCore::IntPoint point, uint32_t touches, bool baseIsStart, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, CallbackBase::Error)>&& callbackFunction) 428 429 { 429 if (! isValid()) {430 if (!hasRunningProcess()) { 430 431 callbackFunction(WebCore::IntPoint(), 0, 0, CallbackBase::Error::Unknown); 431 432 return; … … 448 449 void WebPageProxy::requestAutocorrectionData(const String& textForAutocorrection, WTF::Function<void (const Vector<WebCore::FloatRect>&, const String&, double, uint64_t, CallbackBase::Error)>&& callbackFunction) 449 450 { 450 if (! isValid()) {451 if (!hasRunningProcess()) { 451 452 callbackFunction(Vector<WebCore::FloatRect>(), String(), 0, 0, CallbackBase::Error::Unknown); 452 453 return; … … 459 460 void WebPageProxy::applyAutocorrection(const String& correction, const String& originalText, WTF::Function<void (const String&, CallbackBase::Error)>&& callbackFunction) 460 461 { 461 if (! isValid()) {462 if (!hasRunningProcess()) { 462 463 callbackFunction(String(), CallbackBase::Error::Unknown); 463 464 return; … … 477 478 void WebPageProxy::selectTextWithGranularityAtPoint(const WebCore::IntPoint point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 478 479 { 479 if (! isValid()) {480 if (!hasRunningProcess()) { 480 481 callbackFunction(CallbackBase::Error::Unknown); 481 482 return; … … 488 489 void WebPageProxy::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint point, WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 489 490 { 490 if (! isValid()) {491 if (!hasRunningProcess()) { 491 492 callbackFunction(CallbackBase::Error::Unknown); 492 493 return; … … 499 500 void WebPageProxy::moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 500 501 { 501 if (! isValid()) {502 if (!hasRunningProcess()) { 502 503 callbackFunction(CallbackBase::Error::Unknown); 503 504 return; … … 510 511 void WebPageProxy::selectPositionAtPoint(const WebCore::IntPoint point, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 511 512 { 512 if (! isValid()) {513 if (!hasRunningProcess()) { 513 514 callbackFunction(CallbackBase::Error::Unknown); 514 515 return; … … 521 522 void WebPageProxy::beginSelectionInDirection(WebCore::SelectionDirection direction, WTF::Function<void (uint64_t, CallbackBase::Error)>&& callbackFunction) 522 523 { 523 if (! isValid()) {524 if (!hasRunningProcess()) { 524 525 callbackFunction(0, CallbackBase::Error::Unknown); 525 526 return; … … 532 533 void WebPageProxy::updateSelectionWithExtentPoint(const WebCore::IntPoint point, bool isInteractingWithFocusedElement, WTF::Function<void(uint64_t, CallbackBase::Error)>&& callbackFunction) 533 534 { 534 if (! isValid()) {535 if (!hasRunningProcess()) { 535 536 callbackFunction(0, CallbackBase::Error::Unknown); 536 537 return; … … 544 545 void WebPageProxy::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, WTF::Function<void(uint64_t, CallbackBase::Error)>&& callbackFunction) 545 546 { 546 if (! isValid()) {547 if (!hasRunningProcess()) { 547 548 callbackFunction(0, CallbackBase::Error::Unknown); 548 549 return; … … 556 557 void WebPageProxy::requestDictationContext(WTF::Function<void (const String&, const String&, const String&, CallbackBase::Error)>&& callbackFunction) 557 558 { 558 if (! isValid()) {559 if (!hasRunningProcess()) { 559 560 callbackFunction(String(), String(), String(), CallbackBase::Error::Unknown); 560 561 return; … … 577 578 void WebPageProxy::getSelectionContext(WTF::Function<void(const String&, const String&, const String&, CallbackBase::Error)>&& callbackFunction) 578 579 { 579 if (! isValid()) {580 if (!hasRunningProcess()) { 580 581 callbackFunction(String(), String(), String(), CallbackBase::Error::Unknown); 581 582 return; … … 598 599 void WebPageProxy::selectWithTwoTouches(const WebCore::IntPoint from, const WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>&& callbackFunction) 599 600 { 600 if (! isValid()) {601 if (!hasRunningProcess()) { 601 602 callbackFunction(WebCore::IntPoint(), 0, 0, 0, CallbackBase::Error::Unknown); 602 603 return; … … 695 696 void WebPageProxy::requestRectsForGranularityWithSelectionOffset(WebCore::TextGranularity granularity, uint32_t offset, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&& callbackFunction) 696 697 { 697 if (! isValid()) {698 if (!hasRunningProcess()) { 698 699 callbackFunction(Vector<WebCore::SelectionRect>(), CallbackBase::Error::Unknown); 699 700 return; … … 706 707 void WebPageProxy::requestRectsAtSelectionOffsetWithText(int32_t offset, const String& text, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&& callbackFunction) 707 708 { 708 if (! isValid()) {709 if (!hasRunningProcess()) { 709 710 callbackFunction(Vector<WebCore::SelectionRect>(), CallbackBase::Error::Unknown); 710 711 return; … … 732 733 void WebPageProxy::moveSelectionByOffset(int32_t offset, WTF::Function<void (CallbackBase::Error)>&& callbackFunction) 733 734 { 734 if (! isValid()) {735 if (!hasRunningProcess()) { 735 736 callbackFunction(CallbackBase::Error::Unknown); 736 737 return; … … 775 776 void WebPageProxy::registerUIProcessAccessibilityTokens(const IPC::DataReference& elementToken, const IPC::DataReference& windowToken) 776 777 { 777 if (! isValid())778 if (!hasRunningProcess()) 778 779 return; 779 780 … … 967 968 void WebPageProxy::focusNextFocusedElement(bool isForward, WTF::Function<void(CallbackBase::Error)>&& callbackFunction) 968 969 { 969 if (! isValid()) {970 if (!hasRunningProcess()) { 970 971 callbackFunction(CallbackBase::Error::Unknown); 971 972 return; … … 1050 1051 uint32_t WebPageProxy::computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo& printInfo, DrawToPDFCallback::CallbackFunction&& callback) 1051 1052 { 1052 if (! isValid()) {1053 if (!hasRunningProcess()) { 1053 1054 callback(IPC::DataReference(), CallbackBase::Error::OwnerWasInvalidated); 1054 1055 return 0; … … 1127 1128 void WebPageProxy::requestEvasionRectsAboveSelection(CompletionHandler<void(const Vector<WebCore::FloatRect>&)>&& callback) 1128 1129 { 1129 if (! isValid()) {1130 if (!hasRunningProcess()) { 1130 1131 callback({ }); 1131 1132 return; … … 1149 1150 void WebPageProxy::requestDragStart(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition) 1150 1151 { 1151 if ( isValid())1152 if (hasRunningProcess()) 1152 1153 m_process->send(Messages::WebPage::RequestDragStart(clientPosition, globalPosition), m_pageID); 1153 1154 } … … 1155 1156 void WebPageProxy::requestAdditionalItemsForDragSession(const IntPoint& clientPosition, const IntPoint& globalPosition) 1156 1157 { 1157 if ( isValid())1158 if (hasRunningProcess()) 1158 1159 m_process->send(Messages::WebPage::RequestAdditionalItemsForDragSession(clientPosition, globalPosition), m_pageID); 1159 1160 } -
trunk/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
r241988 r243094 61 61 void TiledCoreAnimationDrawingAreaProxy::sizeDidChange() 62 62 { 63 if (!m_webPageProxy. isValid())63 if (!m_webPageProxy.hasRunningProcess()) 64 64 return; 65 65 … … 79 79 void TiledCoreAnimationDrawingAreaProxy::viewLayoutSizeDidChange() 80 80 { 81 if (!m_webPageProxy. isValid())81 if (!m_webPageProxy.hasRunningProcess()) 82 82 return; 83 83 … … 141 141 MachSendRight TiledCoreAnimationDrawingAreaProxy::createFence() 142 142 { 143 if (!m_webPageProxy. isValid())143 if (!m_webPageProxy.hasRunningProcess()) 144 144 return MachSendRight(); 145 145 … … 169 169 RefPtr<WebPageProxy> retainedPage = &m_webPageProxy; 170 170 [CATransaction addCommitHandler:[callbackID, retainedPage] { 171 if (!retainedPage-> isValid())171 if (!retainedPage->hasRunningProcess()) 172 172 return; 173 173 if (Connection* connection = retainedPage->process().connection()) … … 198 198 void TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing(WTF::Function<void (CallbackBase::Error)>&& callback) 199 199 { 200 if (!m_webPageProxy. isValid()) {200 if (!m_webPageProxy.hasRunningProcess()) { 201 201 callback(CallbackBase::Error::OwnerWasInvalidated); 202 202 return; -
trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
r242339 r243094 166 166 void WebPageProxy::windowAndViewFramesChanged(const FloatRect& viewFrameInWindowCoordinates, const FloatPoint& accessibilityViewCoordinates) 167 167 { 168 if (! isValid())168 if (!hasRunningProcess()) 169 169 return; 170 170 … … 178 178 void WebPageProxy::setMainFrameIsScrollable(bool isScrollable) 179 179 { 180 if (! isValid())180 if (!hasRunningProcess()) 181 181 return; 182 182 … … 187 187 { 188 188 #if USE(DICTATION_ALTERNATIVES) 189 if (! isValid())189 if (!hasRunningProcess()) 190 190 return; 191 191 … … 211 211 void WebPageProxy::attributedSubstringForCharacterRangeAsync(const EditingRange& range, WTF::Function<void (const AttributedString&, const EditingRange&, CallbackBase::Error)>&& callbackFunction) 212 212 { 213 if (! isValid()) {213 if (!hasRunningProcess()) { 214 214 callbackFunction(AttributedString(), EditingRange(), CallbackBase::Error::Unknown); 215 215 return; … … 237 237 void WebPageProxy::fontAtSelection(WTF::Function<void (const String&, double, bool, CallbackBase::Error)>&& callbackFunction) 238 238 { 239 if (! isValid()) {239 if (!hasRunningProcess()) { 240 240 callbackFunction(String(), 0, false, CallbackBase::Error::Unknown); 241 241 return; … … 262 262 { 263 263 String value; 264 if (! isValid())264 if (!hasRunningProcess()) 265 265 return value; 266 266 … … 272 272 RefPtr<WebCore::SharedBuffer> WebPageProxy::dataSelectionForPasteboard(const String& pasteboardType) 273 273 { 274 if (! isValid())274 if (!hasRunningProcess()) 275 275 return nullptr; 276 276 SharedMemory::Handle handle; … … 287 287 bool WebPageProxy::readSelectionFromPasteboard(const String& pasteboardName) 288 288 { 289 if (! isValid())289 if (!hasRunningProcess()) 290 290 return false; 291 291 … … 326 326 void WebPageProxy::sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput) 327 327 { 328 if (! isValid())328 if (!hasRunningProcess()) 329 329 return; 330 330 … … 364 364 void WebPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference& data) 365 365 { 366 if (! isValid())366 if (!hasRunningProcess()) 367 367 return; 368 368 … … 387 387 void WebPageProxy::registerUIProcessAccessibilityTokens(const IPC::DataReference& elementToken, const IPC::DataReference& windowToken) 388 388 { 389 if (! isValid())389 if (!hasRunningProcess()) 390 390 return; 391 391 … … 425 425 bool WebPageProxy::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event) 426 426 { 427 if (! isValid())427 if (!hasRunningProcess()) 428 428 return false; 429 429 -
trunk/Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp
r239535 r243094 321 321 void WebInspectorProxy::platformDetach() 322 322 { 323 if (!inspectedPage()-> isValid())323 if (!inspectedPage()->hasRunningProcess()) 324 324 return; 325 325 -
trunk/Source/WebKit/UIProcess/win/WebView.cpp
r242995 r243094 738 738 HCURSOR WebView::cursorToShow() const 739 739 { 740 if (!m_page-> isValid())740 if (!m_page->hasRunningProcess()) 741 741 return 0; 742 742 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r243044 r243094 482 482 483 483 m_page = std::make_unique<Page>(WTFMove(pageConfiguration)); 484 485 // Set the sessionID *before* updating the preferences as the privateBrowsingEnabled preferences may need to override it. 486 if (parameters.sessionID.isValid()) 487 setSessionID(parameters.sessionID); 488 484 489 updatePreferences(parameters.store); 485 490 … … 539 544 540 545 setUseDarkAppearance(parameters.useDarkAppearance); 546 547 if (parameters.isEditable) 548 setEditable(true); 541 549 542 550 #if PLATFORM(MAC) … … 567 575 if (!parameters.itemStates.isEmpty()) 568 576 restoreSessionInternal(parameters.itemStates, WasRestoredByAPIRequest::No, WebBackForwardListProxy::OverwriteExistingItem::Yes); 569 570 if (parameters.sessionID.isValid())571 setSessionID(parameters.sessionID);572 577 573 578 m_drawingArea->setPaintingEnabled(true); -
trunk/Tools/ChangeLog
r243083 r243094 1 2019-03-18 Chris Dumez <cdumez@apple.com> 2 3 Delay WebProcess launch until a load is triggered in a Web view 4 https://bugs.webkit.org/show_bug.cgi?id=195758 5 <rdar://problem/48126013> 6 7 Reviewed by Geoff Garen. 8 9 Add API test coverage. Also update some existing API tests to not expect 10 constructing a WKWebView to launch both a WebProcess and a NetworkProcess. 11 12 * TestWebKitAPI/Tests/WebKit/NetworkProcessCrashWithPendingConnection.mm: 13 (TestWebKitAPI::TEST): 14 * TestWebKitAPI/Tests/WebKit/mac/GetBackingScaleFactor.mm: 15 (TestWebKitAPI::TEST): 16 * TestWebKitAPI/Tests/WebKitCocoa/ProcessPreWarming.mm: 17 (TEST): 18 * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: 19 * TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm: 20 (TEST): 21 * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: 22 (TEST): 23 (testDidResignInputElementStrongPasswordAppearanceAfterEvaluatingJavaScript): 24 1 25 2019-03-18 Xan Lopez <xan@igalia.com> 2 26 -
trunk/Tools/TestWebKitAPI/Tests/WebKit/NetworkProcessCrashWithPendingConnection.mm
r242339 r243094 40 40 static bool webProcessCrashed = false; 41 41 static bool networkProcessCrashed = false; 42 static pid_t pid;43 42 static WKWebView* testView; 44 43 … … 139 138 memset(&client, 0, sizeof(client)); 140 139 client.networkProcessDidCrash = [](WKContextRef context, const void* clientInfo) { 141 pid = [testView _webProcessIdentifier];142 EXPECT_GT(pid, 0); // The WebProcess is already launched when the network process crashes.143 140 networkProcessCrashed = true; 144 141 }; … … 162 159 EXPECT_FALSE(webProcessCrashed); 163 160 EXPECT_GT([webView _webProcessIdentifier], 0); 164 EXPECT_EQ(pid, [webView _webProcessIdentifier]);165 161 EXPECT_GT([processPool.get() _networkProcessIdentifier], 0); 166 162 } -
trunk/Tools/TestWebKitAPI/Tests/WebKit/mac/GetBackingScaleFactor.mm
r221505 r243094 29 29 #import "SyntheticBackingScaleFactorWindow.h" 30 30 #import "Test.h" 31 #import <WebKit/WKBrowsingContextController.h> 31 32 #import <WebKit/WKViewPrivate.h> 32 33 #import <wtf/RetainPtr.h> … … 69 70 setInjectedBundleClient(context.get()); 70 71 RetainPtr<WKView> view = adoptNS([[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) contextRef:context.get() pageGroupRef:0]); 72 [[view browsingContextController] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; 71 73 72 74 RetainPtr<SyntheticBackingScaleFactorWindow> window1 = createWindow(); -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessPreWarming.mm
r242371 r243094 66 66 auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]); 67 67 68 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL]]]; 69 68 70 EXPECT_FALSE([pool _hasPrewarmedWebProcess]); 69 71 EXPECT_EQ(1U, [pool _webPageContentProcessCount]); 70 72 71 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL]]];72 73 [webView _test_waitForDidFinishNavigation]; 73 74 … … 102 103 103 104 auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]); 105 [webView2 loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL]]]; 106 104 107 EXPECT_FALSE([pool _hasPrewarmedWebProcess]); 105 108 EXPECT_EQ(2U, [pool _webPageContentProcessCount]); -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
r243009 r243094 3273 3273 } 3274 3274 3275 TEST(ProcessSwap, UseWebProcessCacheForLoadInNewView) 3276 { 3277 auto processPoolConfiguration = psonProcessPoolConfiguration(); 3278 auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); 3279 3280 auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); 3281 [webViewConfiguration setProcessPool:processPool.get()]; 3282 auto handler = adoptNS([[PSONScheme alloc] init]); 3283 [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; 3284 3285 auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]); 3286 3287 int webkitPID = 0; 3288 3289 @autoreleasepool { 3290 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); 3291 [webView setNavigationDelegate:navigationDelegate.get()]; 3292 3293 // Process launch should be delayed until a load actually happens. 3294 EXPECT_EQ(0, [webView _webProcessIdentifier]); 3295 TestWebKitAPI::Util::sleep(0.1); 3296 EXPECT_EQ(0, [webView _webProcessIdentifier]); 3297 3298 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]]; 3299 [webView loadRequest:request]; 3300 TestWebKitAPI::Util::run(&done); 3301 done = false; 3302 webkitPID = [webView _webProcessIdentifier]; 3303 EXPECT_NE(0, webkitPID); 3304 } 3305 3306 while ([processPool _processCacheSize] != 1) 3307 TestWebKitAPI::Util::sleep(0.1); 3308 3309 EXPECT_EQ(1U, [processPool _webProcessCountIgnoringPrewarmed]); 3310 3311 @autoreleasepool { 3312 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); 3313 [webView setNavigationDelegate:navigationDelegate.get()]; 3314 3315 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main2.html"]]; 3316 [webView loadRequest:request]; 3317 TestWebKitAPI::Util::run(&done); 3318 done = false; 3319 3320 EXPECT_EQ(webkitPID, [webView _webProcessIdentifier]); 3321 EXPECT_EQ(1U, [processPool _webProcessCountIgnoringPrewarmed]); 3322 } 3323 3324 while ([processPool _processCacheSize] != 1) 3325 TestWebKitAPI::Util::sleep(0.1); 3326 3327 EXPECT_EQ(1U, [processPool _webProcessCountIgnoringPrewarmed]); 3328 3329 @autoreleasepool { 3330 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); 3331 [webView setNavigationDelegate:navigationDelegate.get()]; 3332 3333 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]]; 3334 [webView loadRequest:request]; 3335 TestWebKitAPI::Util::run(&done); 3336 done = false; 3337 3338 EXPECT_NE(webkitPID, [webView _webProcessIdentifier]); 3339 } 3340 3341 EXPECT_EQ(2U, [processPool _webProcessCountIgnoringPrewarmed]); 3342 } 3343 3275 3344 #endif // PLATFORM(MAC) 3276 3345 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm
r242339 r243094 75 75 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 76 76 [dataStore _setResourceLoadStatisticsEnabled:YES]; 77 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; 77 78 78 79 TestWebKitAPI::Util::run(&grandfatheredFlag); … … 140 141 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 141 142 [dataStore _setResourceLoadStatisticsEnabled:YES]; 143 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; 142 144 143 145 TestWebKitAPI::Util::run(&callbackFlag); … … 171 173 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 172 174 [dataStore _setResourceLoadStatisticsEnabled:YES]; 175 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; 173 176 174 177 TestWebKitAPI::Util::run(&doneFlag); -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm
r242339 r243094 193 193 auto delegate = adoptNS([[InjectedBundleNodeHandleIsSelectElementDelegate alloc] init]); 194 194 [webView setUIDelegate:delegate.get()]; 195 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; 195 196 TestWebKitAPI::Util::run(&done); 196 197 } … … 595 596 auto delegate = adoptNS([[AutoFillDelegate alloc] init]); 596 597 [webView setUIDelegate:delegate.get()]; 598 [webView evaluateJavaScript:@"" completionHandler: nil]; // Ensure the WebProcess and injected bundle are running. 597 599 TestWebKitAPI::Util::run(&readyForClick); 598 600 NSPoint buttonLocation = NSMakePoint(130, 575); … … 634 636 auto delegate = adoptNS([[DidResignInputElementStrongPasswordAppearanceDelegate alloc] init]); 635 637 [webView setUIDelegate:delegate.get()]; 638 [webView evaluateJavaScript:@"" completionHandler:nil]; // Make sure WebProcess and injected bundle are running. 636 639 TestWebKitAPI::Util::run(&readytoResign); 637 640 [webView evaluateJavaScript:script completionHandler:nil]; … … 675 678 auto delegate = adoptNS([[AutoFillAvailableDelegate alloc] init]); 676 679 [webView setUIDelegate:delegate.get()]; 680 [webView evaluateJavaScript:@"" completionHandler: nil]; // Ensure the WebProcess and injected bundle are running. 677 681 TestWebKitAPI::Util::run(&done); 678 682 } … … 699 703 auto delegate = adoptNS([[InjectedBundleNodeHandleIsTextFieldDelegate alloc] init]); 700 704 [webView setUIDelegate:delegate.get()]; 705 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; 701 706 TestWebKitAPI::Util::run(&done); 702 707 }
Note:
See TracChangeset
for help on using the changeset viewer.