Changeset 80306 in webkit
- Timestamp:
- Mar 3, 2011 5:36:29 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r80297 r80306 1 2011-03-03 Adam Roben <aroben@apple.com> 2 3 Add a way to tell the web process to perform a full backing store update on its next paint 4 5 Messages::DrawingArea::UpdateBackingStoreState now takes a boolean specifying whether the 6 full backing store update should happen immediately or should be deferred until the next 7 paint or compositing mode change occurs. The deferred update isn't used yet, but will be 8 used when we start throwing away backing stores to save memory. 9 10 Fixes <http://webkit.org/b/55730> UI process needs a way to tell the web process its backing 11 store needs a full update on the next paint 12 13 Reviewed by Anders Carlsson. 14 15 * UIProcess/DrawingAreaProxyImpl.cpp: 16 (WebKit::DrawingAreaProxyImpl::paint): If we have an outstanding backing store state change 17 request, tell the web process to perform the backing store update right away, in case we 18 previously told it it could defer the update. 19 (WebKit::DrawingAreaProxyImpl::sizeDidChange): Specify that we need an immediate backing 20 store update. 21 (WebKit::DrawingAreaProxyImpl::didUpdateBackingStoreState): We can no longer assert that we 22 were waiting for a DidUpdateBackingStoreState message when we receive one, as it's possible 23 for the web process to decide to send us this message on its own (if we asked it to do a 24 deferred backing store update and then it needed to paint some part of the page). Specify 25 that we need an immediate backing store update if the web process hasn't updated to our 26 latest state, as we're about to draw potentially out-of-date bits to the screen and want to 27 get the right bits as soon as possible. Also added a FIXME about a potential optimization. 28 (WebKit::DrawingAreaProxyImpl::backingStoreStateDidChange): Added a RespondImmediatelyOrNot 29 parameter, which is just passed through to sendUpdateBackingStoreState. 30 (WebKit::DrawingAreaProxyImpl::sendUpdateBackingStoreState): Added a RespondImmediatelyOrNot 31 parameter that is used to specify to the web process whether to perform the full backing 32 store update immediately. We now only wait for a DidUpdateBackingStoreState message (and 33 thus suppress any more UpdateBackingStoreState messages until one is received) when we ask 34 the web process for an immediate response; otherwise we could end up accidentally calling 35 waitForAndDispatchDidUpdateBackingStoreState when the web process hasn't been told to send 36 us such a message. 37 38 * UIProcess/DrawingAreaProxyImpl.h: Added RespondImmediatelyOrNot. 39 40 * WebProcess/WebPage/DrawingArea.h: 41 (WebKit::DrawingArea::updateBackingStoreState): Added respondImmediately argument. 42 43 * WebProcess/WebPage/DrawingArea.messages.in: Added respondImmediately argument to 44 UpdateBackingStoreState message. 45 46 * WebProcess/WebPage/DrawingAreaImpl.cpp: 47 (WebKit::DrawingAreaImpl::DrawingAreaImpl): Initialize new member that's used to track 48 whether we should send a DidUpdateBackingStoreState message instead of an Update or 49 compositing mode change message. This will be set to true when a deferred backing store 50 update is pending. 51 (WebKit::DrawingAreaImpl::layerHostDidFlushLayers): If a deferred update is pending, send a 52 DidUpdateBackingStoreState message instead of a compositing mode change message. 53 (WebKit::DrawingAreaImpl::updateBackingStoreState): Added respondImmediately argument. If 54 we've already been told about this state ID (as can happen when the UI process decides it 55 needs an immediate update to a state that it previously requested a deferred update to), 56 don't bother updating the page's size, etc. In addition, if we've already sent a 57 DidUpdateBackingStoreState message for this state, we don't have to do anything at all. 58 Moved code to send the DidUpdateBackingStoreState message from here... 59 (WebKit::DrawingAreaImpl::sendDidUpdateBackingStoreState): ...to here. 60 (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): Always update our dirty region, 61 even if painting is suspended or we're in the process of updating the backing store state. 62 It causes no harm and simplifies the code. If a deferred update is pending, send a 63 DidUpdateBackingStoreState message instead of a compositing mode change message. Also 64 removed a redundant if. 65 (WebKit::DrawingAreaImpl::display): Added an assertion that this isn't called while updating 66 backing store state, as otherwise we might end up sending two DidUpdateBackingStoreState 67 messages. If a deferred update is pending, send a DidUpdateBackingStoreState message instead 68 of an Update message. 69 70 * WebProcess/WebPage/DrawingAreaImpl.h: Updated updateBackingStoreState to match the base 71 class. Added sendDidUpdateBackingStoreState and m_shouldSendDidUpdateBackingStoreState. 72 1 73 2011-03-03 Andy Estes <aestes@apple.com> 2 74 -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
r79869 r80306 72 72 ASSERT(!isInAcceleratedCompositingMode()); 73 73 74 if (m_isWaitingForDidUpdateBackingStoreState) { 75 // Wait for a DidUpdateBackingStoreState message that contains the new bits before we paint 76 // what's currently in the backing store. 77 waitForAndDispatchDidUpdateBackingStoreState(); 78 79 // Dispatching DidUpdateBackingStoreState could destroy our backing store or change the compositing mode. 74 ASSERT(m_currentBackingStoreStateID <= m_nextBackingStoreStateID); 75 if (m_currentBackingStoreStateID < m_nextBackingStoreStateID) { 76 // Tell the web process to do a full backing store update now, in case we previously told 77 // it about our next state but didn't request an immediate update. 78 sendUpdateBackingStoreState(RespondImmediately); 79 80 if (m_isWaitingForDidUpdateBackingStoreState) { 81 // Wait for a DidUpdateBackingStoreState message that contains the new bits before we paint 82 // what's currently in the backing store. 83 waitForAndDispatchDidUpdateBackingStoreState(); 84 } 85 86 // Dispatching DidUpdateBackingStoreState (either beneath sendUpdateBackingStoreState or 87 // beneath waitForAndDispatchDidUpdateBackingStoreState) could destroy our backing store or 88 // change the compositing mode. 80 89 if (!m_backingStore || isInAcceleratedCompositingMode()) 81 90 return; 82 } 91 } else 92 ASSERT(!m_isWaitingForDidUpdateBackingStoreState); 83 93 84 94 m_backingStore->paint(context, rect); … … 104 114 void DrawingAreaProxyImpl::sizeDidChange() 105 115 { 106 backingStoreStateDidChange( );116 backingStoreStateDidChange(RespondImmediately); 107 117 } 108 118 … … 141 151 m_currentBackingStoreStateID = backingStoreStateID; 142 152 143 ASSERT(m_isWaitingForDidUpdateBackingStoreState);144 153 m_isWaitingForDidUpdateBackingStoreState = false; 145 154 146 155 if (m_nextBackingStoreStateID != m_currentBackingStoreStateID) 147 sendUpdateBackingStoreState( );156 sendUpdateBackingStoreState(RespondImmediately); 148 157 149 158 if (layerTreeContext != m_layerTreeContext) { … … 164 173 } 165 174 175 // FIXME: We could just reuse our existing backing store if it's the same size as 176 // updateInfo.viewSize. 166 177 m_backingStore = nullptr; 167 178 incorporateUpdate(updateInfo); … … 215 226 } 216 227 217 void DrawingAreaProxyImpl::backingStoreStateDidChange( )228 void DrawingAreaProxyImpl::backingStoreStateDidChange(RespondImmediatelyOrNot respondImmediatelyOrNot) 218 229 { 219 230 ++m_nextBackingStoreStateID; 220 sendUpdateBackingStoreState( );221 } 222 223 void DrawingAreaProxyImpl::sendUpdateBackingStoreState( )231 sendUpdateBackingStoreState(respondImmediatelyOrNot); 232 } 233 234 void DrawingAreaProxyImpl::sendUpdateBackingStoreState(RespondImmediatelyOrNot respondImmediatelyOrNot) 224 235 { 225 236 ASSERT(m_currentBackingStoreStateID < m_nextBackingStoreStateID); … … 231 242 return; 232 243 233 m_isWaitingForDidUpdateBackingStoreState = true;234 m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, m_size, m_scrollOffset), m_webPageProxy->pageID());244 m_isWaitingForDidUpdateBackingStoreState = respondImmediatelyOrNot == RespondImmediately; 245 m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, m_size, m_scrollOffset), m_webPageProxy->pageID()); 235 246 m_scrollOffset = IntSize(); 236 247 237 if ( !m_layerTreeContext.isEmpty()) {248 if (m_isWaitingForDidUpdateBackingStoreState && !m_layerTreeContext.isEmpty()) { 238 249 // Wait for the DidUpdateBackingStoreState message. Normally we don this in DrawingAreaProxyImpl::paint, but that 239 250 // function is never called when in accelerated compositing mode. -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
r79869 r80306 63 63 void incorporateUpdate(const UpdateInfo&); 64 64 65 void backingStoreStateDidChange(); 66 void sendUpdateBackingStoreState(); 65 enum RespondImmediatelyOrNot { DoNotRespondImmediately, RespondImmediately }; 66 void backingStoreStateDidChange(RespondImmediatelyOrNot); 67 void sendUpdateBackingStoreState(RespondImmediatelyOrNot); 67 68 void waitForAndDispatchDidUpdateBackingStoreState(); 68 69 -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
r79868 r80306 87 87 // CoreIPC message handlers. 88 88 // FIXME: These should be pure virtual. 89 virtual void updateBackingStoreState(uint64_t backingStoreStateID, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { }89 virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) { } 90 90 virtual void didUpdate() { } 91 91 virtual void suspendPainting() { } -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
r79868 r80306 22 22 23 23 messages -> DrawingArea { 24 UpdateBackingStoreState(uint64_t backingStoreStateID, WebCore::IntSize size, WebCore::IntSize scrollOffset)24 UpdateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, WebCore::IntSize size, WebCore::IntSize scrollOffset) 25 25 DidUpdate() 26 26 SuspendPainting() -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
r80292 r80306 61 61 , m_backingStoreStateID(0) 62 62 , m_inUpdateBackingStoreState(false) 63 , m_shouldSendDidUpdateBackingStoreState(false) 63 64 , m_isWaitingForDidUpdate(false) 64 65 , m_isPaintingSuspended(!parameters.isVisible) … … 188 189 189 190 m_layerTreeHost->forceRepaint(); 191 192 if (m_shouldSendDidUpdateBackingStoreState) { 193 sendDidUpdateBackingStoreState(); 194 return; 195 } 190 196 191 197 if (!m_layerTreeHost) … … 238 244 } 239 245 240 void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)246 void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImmediately, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) 241 247 { 242 248 ASSERT(!m_inUpdateBackingStoreState); 243 249 m_inUpdateBackingStoreState = true; 244 250 245 ASSERT_ARG(stateID, stateID > m_backingStoreStateID); 246 m_backingStoreStateID = stateID; 247 248 // Set this to false since we're about to call display(). 251 ASSERT_ARG(stateID, stateID >= m_backingStoreStateID); 252 if (stateID != m_backingStoreStateID) { 253 m_backingStoreStateID = stateID; 254 m_shouldSendDidUpdateBackingStoreState = true; 255 256 m_webPage->setSize(size); 257 m_webPage->layoutIfNeeded(); 258 m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset); 259 260 if (m_layerTreeHost) 261 m_layerTreeHost->sizeDidChange(size); 262 else 263 m_dirtyRegion = m_webPage->bounds(); 264 } else { 265 ASSERT(size == m_webPage->size()); 266 if (!m_shouldSendDidUpdateBackingStoreState) { 267 // We've already sent a DidUpdateBackingStoreState message for this state. We have nothing more to do. 268 m_inUpdateBackingStoreState = false; 269 return; 270 } 271 } 272 273 // The UI process has updated to a new backing store state. Any Update messages we sent before 274 // this point will be ignored. We wait to set this to false until after updating the page's 275 // size so that any displays triggered by the relayout will be ignored. If we're supposed to 276 // respond to the UpdateBackingStoreState message immediately, we'll do a display anyway in 277 // sendDidUpdateBackingStoreState; otherwise we shouldn't do one right now. 249 278 m_isWaitingForDidUpdate = false; 250 279 251 m_webPage->setSize(size); 252 m_webPage->layoutIfNeeded(); 253 m_webPage->scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset); 280 if (respondImmediately) 281 sendDidUpdateBackingStoreState(); 282 283 m_inUpdateBackingStoreState = false; 284 } 285 286 void DrawingAreaImpl::sendDidUpdateBackingStoreState() 287 { 288 ASSERT(!m_isWaitingForDidUpdate); 289 ASSERT(m_shouldSendDidUpdateBackingStoreState); 290 291 m_shouldSendDidUpdateBackingStoreState = false; 254 292 255 293 UpdateInfo updateInfo; 256 294 LayerTreeContext layerTreeContext; 257 295 258 if (m_layerTreeHost) { 259 m_layerTreeHost->sizeDidChange(size); 260 layerTreeContext = m_layerTreeHost->layerTreeContext(); 261 262 // We don't want the layer tree host to notify after the next scheduled 263 // layer flush because that might end up sending an EnterAcceleratedCompositingMode 264 // message back to the UI process, but the updated layer tree context 265 // will be sent back in the DidUpdateBackingStoreState message. 266 m_layerTreeHost->setShouldNotifyAfterNextScheduledLayerFlush(false); 267 } else 268 m_dirtyRegion = m_webPage->bounds(); 269 270 if (m_isPaintingSuspended || m_layerTreeHost) 296 if (!m_isPaintingSuspended && !m_layerTreeHost) 297 display(updateInfo); 298 299 if (m_isPaintingSuspended || m_layerTreeHost) { 271 300 updateInfo.viewSize = m_webPage->size(); 272 else { 273 // The display here should not cause layout to happen, so we can't enter accelerated compositing mode here. 274 display(updateInfo); 275 ASSERT(!m_layerTreeHost); 301 302 if (m_layerTreeHost) { 303 layerTreeContext = m_layerTreeHost->layerTreeContext(); 304 305 // We don't want the layer tree host to notify after the next scheduled 306 // layer flush because that might end up sending an EnterAcceleratedCompositingMode 307 // message back to the UI process, but the updated layer tree context 308 // will be sent back in the DidUpdateBackingStoreState message. 309 m_layerTreeHost->setShouldNotifyAfterNextScheduledLayerFlush(false); 310 } 276 311 } 277 312 278 313 m_webPage->send(Messages::DrawingAreaProxy::DidUpdateBackingStoreState(m_backingStoreStateID, updateInfo, layerTreeContext)); 279 280 m_inUpdateBackingStoreState = false;281 314 } 282 315 … … 343 376 m_layerTreeHost->invalidate(); 344 377 m_layerTreeHost = nullptr; 378 m_dirtyRegion = m_webPage->bounds(); 345 379 346 380 if (m_inUpdateBackingStoreState) 347 381 return; 382 383 if (m_shouldSendDidUpdateBackingStoreState) { 384 sendDidUpdateBackingStoreState(); 385 return; 386 } 348 387 349 388 UpdateInfo updateInfo; 350 389 if (m_isPaintingSuspended) 351 390 updateInfo.viewSize = m_webPage->size(); 352 else { 353 m_dirtyRegion = m_webPage->bounds(); 391 else 354 392 display(updateInfo); 355 }356 393 357 394 // Send along a complete update of the page so we can paint the contents right after we exit the 358 395 // accelerated compositing mode, eliminiating flicker. 359 if (!m_inUpdateBackingStoreState) 360 m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(m_backingStoreStateID, updateInfo)); 396 m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(m_backingStoreStateID, updateInfo)); 361 397 } 362 398 … … 390 426 ASSERT(!m_layerTreeHost); 391 427 ASSERT(!m_isWaitingForDidUpdate); 428 ASSERT(!m_inUpdateBackingStoreState); 392 429 393 430 if (m_isPaintingSuspended) … … 396 433 if (m_dirtyRegion.isEmpty()) 397 434 return; 435 436 if (m_shouldSendDidUpdateBackingStoreState) { 437 sendDidUpdateBackingStoreState(); 438 return; 439 } 398 440 399 441 UpdateInfo updateInfo; -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
r79868 r80306 61 61 62 62 // CoreIPC message handlers. 63 virtual void updateBackingStoreState(uint64_t backingStoreStateID, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);63 virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset); 64 64 virtual void didUpdate(); 65 65 virtual void suspendPainting(); 66 66 virtual void resumePainting(); 67 68 void sendDidUpdateBackingStoreState(); 67 69 68 70 void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*); … … 82 84 // Whether we're currently processing an UpdateBackingStoreState message. 83 85 bool m_inUpdateBackingStoreState; 86 87 // When true, we should send an UpdateBackingStoreState message instead of any other messages 88 // we normally send to the UI process. 89 bool m_shouldSendDidUpdateBackingStoreState; 84 90 85 91 // Whether we're waiting for a DidUpdate message. Used for throttling paints so that the
Note: See TracChangeset
for help on using the changeset viewer.