Changeset 184011 in webkit
- Timestamp:
- May 8, 2015, 1:40:32 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 13 edited
-
ChangeLog (modified) (1 diff)
-
Platform/mac/LayerHostingContext.h (modified) (1 diff)
-
Platform/mac/LayerHostingContext.mm (modified) (1 diff)
-
UIProcess/WebPageProxy.cpp (modified) (2 diffs)
-
UIProcess/WebPageProxy.h (modified) (3 diffs)
-
UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
UIProcess/mac/WKViewLayoutStrategy.mm (modified) (1 diff)
-
WebProcess/WebPage/DrawingArea.h (modified) (1 diff)
-
WebProcess/WebPage/WebPage.cpp (modified) (1 diff)
-
WebProcess/WebPage/WebPage.h (modified) (1 diff)
-
WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
-
WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (modified) (2 diffs)
-
WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r184010 r184011 1 2015-05-08 Timothy Horton <timothy_horton@apple.com> 2 3 Flip the direction of the fence in scaleViewAndUpdateGeometryFenced 4 https://bugs.webkit.org/show_bug.cgi?id=144810 5 6 Reviewed by Simon Fraser. 7 8 Send the fence from the Web process to the UI process, instead of vice versa. 9 This means that we won't keep the UI process CAContext blocked for the whole 10 time that the Web process is doing layout/painting/etc. Instead, we'll start 11 blocking the Web process CAContext immediately after flushing and before committing, 12 and send the fence to the UI process to be applied immediately. This minimizes 13 the amount of time in both processes spent blocked on the fence. 14 15 * Platform/mac/LayerHostingContext.h: 16 * Platform/mac/LayerHostingContext.mm: 17 (WebKit::LayerHostingContext::createFencePort): 18 Add createFencePort, which creates a MachSendRight wrapping a CA fence port. 19 Note that you must setFencePort() with this port if you want the LayerHostingContext's 20 CAContext to block on it! 21 22 * UIProcess/WebPageProxy.cpp: 23 (WebKit::WebPageProxy::scaleViewAndUpdateGeometryFenced): 24 (WebKit::WebPageProxy::machSendRightCallback): 25 * UIProcess/WebPageProxy.h: 26 * UIProcess/WebPageProxy.messages.in: 27 Create a callback and send it to the Web process along with scaleViewAndUpdateGeometryFenced. 28 29 * UIProcess/mac/WKViewLayoutStrategy.mm: 30 (-[WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy updateLayout]): 31 When called back, install the fence port in our CAContext; when the commit goes through, 32 remove the transient scale as we did previously. 33 34 * WebProcess/WebPage/DrawingArea.h: 35 (WebKit::DrawingArea::replyWithFenceAfterNextFlush): 36 (WebKit::DrawingArea::updateGeometry): Deleted. 37 * WebProcess/WebPage/WebPage.cpp: 38 (WebKit::WebPage::scaleViewAndUpdateGeometryFenced): 39 * WebProcess/WebPage/WebPage.h: 40 * WebProcess/WebPage/WebPage.messages.in: 41 Instead of installing a fence created in the UI process, tell the DrawingArea 42 to create one and reply to the UI process with it after the next flush. 43 44 * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h: 45 * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: 46 (WebKit::TiledCoreAnimationDrawingArea::flushLayers): 47 (WebKit::TiledCoreAnimationDrawingArea::replyWithFenceAfterNextFlush): 48 After flushing, before committing, create a fence and reply to any 49 callbacks that requested fences, and install it in our context. 50 1 51 2015-05-08 Michael Catanzaro <mcatanzaro@igalia.com>, Martin Robinson <mrobinson@igalia.com> 2 52 -
trunk/Source/WebKit2/Platform/mac/LayerHostingContext.h
r183841 r184011 63 63 CGColorSpaceRef colorSpace() const; 64 64 65 // This only works on iOS and OS 10.10+65 // Fences only work on iOS and OS 10.10+. 66 66 void setFencePort(mach_port_t); 67 68 // createFencePort does not install the fence port on the LayerHostingContext's 69 // CAContext; call setFencePort() with the newly created port if synchronization 70 // with this context is desired. 71 WebCore::MachSendRight createFencePort(); 67 72 68 73 private: -
trunk/Source/WebKit2/Platform/mac/LayerHostingContext.mm
r183846 r184011 108 108 [m_context setFencePort:fencePort]; 109 109 } 110 111 MachSendRight LayerHostingContext::createFencePort() 112 { 113 return MachSendRight::adopt([m_context createFencePort]); 114 } 110 115 #else 111 116 NO_RETURN_DUE_TO_ASSERT void LayerHostingContext::setFencePort(mach_port_t fencePort) 117 { 118 ASSERT_NOT_REACHED(); 119 } 120 121 NO_RETURN_DUE_TO_ASSERT const MachSendRight& LayerHostingContext::createFencePort() 112 122 { 113 123 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r183841 r184011 2249 2249 2250 2250 #if PLATFORM(COCOA) 2251 void WebPageProxy::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, const MachSendRight& fencePort) 2252 { 2253 if (!isValid()) 2254 return; 2251 void WebPageProxy::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, std::function<void (const MachSendRight&, CallbackBase::Error)> callback) 2252 { 2253 if (!isValid()) { 2254 callback(MachSendRight(), CallbackBase::Error::OwnerWasInvalidated); 2255 return; 2256 } 2255 2257 2256 2258 m_viewScaleFactor = scale; 2257 2259 if (m_drawingArea) 2258 2260 m_drawingArea->willSendUpdateGeometry(); 2259 m_process->send(Messages::WebPage::ScaleViewAndUpdateGeometryFenced(scale, viewSize, fencePort), m_pageID); 2261 uint64_t callbackID = m_callbacks.put(WTF::move(callback), m_process->throttler().backgroundActivityToken()); 2262 m_process->send(Messages::WebPage::ScaleViewAndUpdateGeometryFenced(scale, viewSize, callbackID), m_pageID); 2260 2263 } 2261 2264 #endif … … 4656 4659 callback->performCallbackWithReturnValue(range); 4657 4660 } 4661 4662 #if PLATFORM(COCOA) 4663 void WebPageProxy::machSendRightCallback(const MachSendRight& sendRight, uint64_t callbackID) 4664 { 4665 auto callback = m_callbacks.take<MachSendRightCallback>(callbackID); 4666 if (!callback) 4667 return; 4668 4669 callback->performCallbackWithReturnValue(sendRight); 4670 } 4671 #endif 4658 4672 4659 4673 static bool shouldLogDiagnosticMessage(bool shouldSample) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r183909 r184011 243 243 #endif 244 244 245 #if PLATFORM(COCOA) 246 typedef GenericCallback<const WebCore::MachSendRight&> MachSendRightCallback; 247 #endif 248 245 249 struct WebPageConfiguration { 246 250 WebPageGroup* pageGroup = nullptr; … … 650 654 void scaleView(double scale); 651 655 #if PLATFORM(COCOA) 652 void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, const WebCore::MachSendRight& fencePort);656 void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, std::function<void (const WebCore::MachSendRight&, CallbackBase::Error)>); 653 657 #endif 654 658 … … 1314 1318 void unsignedCallback(uint64_t, uint64_t); 1315 1319 void editingRangeCallback(const EditingRange&, uint64_t); 1320 #if PLATFORM(COCOA) 1321 void machSendRightCallback(const WebCore::MachSendRight&, uint64_t); 1322 #endif 1316 1323 void rectForCharacterRangeCallback(const WebCore::IntRect&, const EditingRange&, uint64_t); 1317 1324 #if PLATFORM(MAC) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r183698 r184011 195 195 PrintFinishedCallback(WebCore::ResourceError error, uint64_t callbackID) 196 196 #endif 197 #if PLATFORM(COCOA) 198 MachSendRightCallback(WebCore::MachSendRight sendRight, uint64_t callbackID) 199 #endif 197 200 198 201 PageScaleFactorDidChange(double scaleFactor) -
trunk/Source/WebKit2/UIProcess/mac/WKViewLayoutStrategy.mm
r183889 r184011 294 294 } else if (scale != _page->viewScaleFactor()) { 295 295 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 296 CAContext *context = [_wkView.layer context]; 297 MachSendRight fencePort = MachSendRight::adopt([context createFencePort]); 298 _page->scaleViewAndUpdateGeometryFenced(scale, IntSize(_wkView.frame.size), fencePort); 299 [context setFencePort:fencePort.sendRight() commitHandler:^{ 300 _wkView._rootLayer.transform = CATransform3DIdentity; 301 }]; 296 RetainPtr<CAContext> context = [_wkView.layer context]; 297 RetainPtr<WKView> retainedWKView = _wkView; 298 _page->scaleViewAndUpdateGeometryFenced(scale, IntSize(_wkView.frame.size), [retainedWKView, context] (const WebCore::MachSendRight& fencePort, CallbackBase::Error) { 299 [context setFencePort:fencePort.sendRight() commitHandler:^{ 300 [retainedWKView _rootLayer].transform = CATransform3DIdentity; 301 }]; 302 }); 302 303 #else 303 304 _page->scaleView(scale); -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
r183841 r184011 130 130 // Used by TiledCoreAnimationDrawingArea. 131 131 virtual void updateGeometry(const WebCore::IntSize& viewSize, const WebCore::IntSize& layerPosition, bool flushSynchronously) { } 132 133 virtual void replyWithFenceAfterNextFlush(uint64_t callbackID) { ASSERT_NOT_REACHED(); } 132 134 #endif 133 135 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r183969 r184011 1450 1450 1451 1451 #if PLATFORM(COCOA) 1452 void WebPage::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, const MachSendRight& fencePort)1452 void WebPage::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, uint64_t callbackID) 1453 1453 { 1454 1454 scaleView(scale); 1455 1455 m_drawingArea->updateGeometry(viewSize, IntSize(), false); 1456 m_drawingArea-> addFence(fencePort);1456 m_drawingArea->replyWithFenceAfterNextFlush(callbackID); 1457 1457 } 1458 1458 #endif -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r183909 r184011 363 363 void scaleView(double scale); 364 364 #if PLATFORM(COCOA) 365 void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, const WebCore::MachSendRight& fencePort);365 void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, uint64_t callbackID); 366 366 #endif 367 367 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r183909 r184011 204 204 ScaleView(double scale) 205 205 #if PLATFORM(COCOA) 206 ScaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, WebCore::MachSendRight fencePort)206 ScaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, uint64_t callbackID) 207 207 #endif 208 208 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
r183841 r184011 87 87 virtual void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override; 88 88 89 virtual void replyWithFenceAfterNextFlush(uint64_t callbackID) override; 90 89 91 // WebCore::LayerFlushSchedulerClient 90 92 virtual bool flushLayers() override; … … 147 149 148 150 WebCore::GraphicsLayer* m_viewOverlayRootLayer; 151 152 Vector<uint64_t> m_fenceCallbacksForAfterNextFlush; 149 153 }; 150 154 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
r183841 r184011 330 330 applyTransientZoomToLayers(m_transientZoomScale, m_transientZoomOrigin); 331 331 332 if (!m_fenceCallbacksForAfterNextFlush.isEmpty()) { 333 MachSendRight fencePort = m_layerHostingContext->createFencePort(); 334 335 for (auto callbackID : m_fenceCallbacksForAfterNextFlush) 336 m_webPage.send(Messages::WebPageProxy::MachSendRightCallback(fencePort, callbackID)); 337 m_fenceCallbacksForAfterNextFlush.clear(); 338 339 m_layerHostingContext->setFencePort(fencePort.sendRight()); 340 } 341 332 342 return returnValue; 333 343 } … … 747 757 } 748 758 759 void TiledCoreAnimationDrawingArea::replyWithFenceAfterNextFlush(uint64_t callbackID) 760 { 761 m_fenceCallbacksForAfterNextFlush.append(callbackID); 762 } 763 749 764 } // namespace WebKit 750 765
Note:
See TracChangeset
for help on using the changeset viewer.