Changeset 202040 in webkit
- Timestamp:
- Jun 14, 2016 2:58:06 AM (8 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r202038 r202040 1 2016-06-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [ThreadedCompositor] Opening the inspector in a window causes a crash. 4 https://bugs.webkit.org/show_bug.cgi?id=154444 5 6 Reviewed by Žan Doberšek. 7 8 The threaded compositor doesn't handle the case of changing or removing the native surface handle. When the web 9 view is reparented, the current native surface handle is destroyed when the view is removed from the parent, and 10 a new one is created when added to the new parent. We need to handle this case in the threaded compositor. 11 12 * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp: 13 (WebKit::CompositingRunLoop::stopUpdateTimer): Allow users to stop the update timer. 14 * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h: 15 * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: 16 (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing): Use performTaskSync because this is called 17 from a synchronous IPC message and right after it returns, the current native surface is destroyed by the UI 18 process. So we need to ensure we finish all pending operations for the current native surface in the compositing 19 thread before it's destroyed. Then we enable or disable the scene depending on whether the native surface has 20 been created or destroyed and destroy the current context in case the new handle is 0. 21 (WebKit::ThreadedCompositor::tryEnsureGLContext): Just renamed to make it clear that it can fail. 22 (WebKit::ThreadedCompositor::glContext): 23 (WebKit::ThreadedCompositor::renderLayerTree): Return early if scene is not active. 24 * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp: 25 (WebKit::ThreadedCoordinatedLayerTreeHost::setNativeSurfaceHandleForCompositing): Schedule a new layer flush 26 after the native surface handle changed. 27 1 28 2016-06-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 29 -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp
r202038 r202040 72 72 } 73 73 74 void CompositingRunLoop::stopUpdateTimer() 75 { 76 m_updateTimer.stop(); 77 } 78 74 79 void CompositingRunLoop::updateTimerFired() 75 80 { -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h
r202038 r202040 51 51 52 52 void startUpdateTimer(UpdateTiming = Immediate); 53 void stopUpdateTimer(); 53 54 54 55 void run(); -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
r202038 r202040 62 62 void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle) 63 63 { 64 m_compositingRunLoop->performTask([this, protectedThis = Ref<ThreadedCompositor>(*this), handle] { 64 m_compositingRunLoop->stopUpdateTimer(); 65 m_compositingRunLoop->performTaskSync([this, protectedThis = Ref<ThreadedCompositor>(*this), handle] { 66 m_scene->setActive(!!handle); 67 68 // A new native handle can't be set without destroying the previous one first if any. 69 ASSERT(!!handle ^ !!m_nativeSurfaceHandle); 65 70 m_nativeSurfaceHandle = handle; 66 m_scene->setActive(true); 71 if (!m_nativeSurfaceHandle) 72 m_context = nullptr; 67 73 }); 68 74 } … … 131 137 } 132 138 133 bool ThreadedCompositor:: ensureGLContext()139 bool ThreadedCompositor::tryEnsureGLContext() 134 140 { 135 141 if (!glContext()) … … 157 163 158 164 if (!m_nativeSurfaceHandle) 159 return 0;165 return nullptr; 160 166 161 167 m_context = GLContext::createContextForWindow(reinterpret_cast<GLNativeWindowType>(m_nativeSurfaceHandle), GLContext::sharingContext()); … … 182 188 { 183 189 ASSERT(&RunLoop::current() == &m_compositingRunLoop->runLoop()); 184 if (!m_scene )190 if (!m_scene || !m_scene->isActive()) 185 191 return; 186 192 187 if (! ensureGLContext())193 if (!tryEnsureGLContext()) 188 194 return; 189 195 -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h
r202038 r202040 89 89 void didChangeVisibleRect() override; 90 90 91 bool ensureGLContext();91 bool tryEnsureGLContext(); 92 92 WebCore::GLContext* glContext(); 93 93 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
r201923 r202040 199 199 m_layerTreeContext.contextID = handle; 200 200 m_compositor->setNativeSurfaceHandleForCompositing(handle); 201 scheduleLayerFlush(); 201 202 } 202 203 #endif
Note: See TracChangeset
for help on using the changeset viewer.