Changeset 80307 in webkit
- Timestamp:
- Mar 3, 2011 5:37:11 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r80306 r80307 1 2011-03-03 Adam Roben <aroben@apple.com> 2 3 Throw away DrawingAreaProxyImpl's backing store after not painting for 5 seconds 4 5 The intent is to save memory for views that aren't painting. 6 7 Fixes <http://webkit.org/b/51262> <rdar://problem/8782537> WebPageProxy should delete its 8 backing store after not painting for a while 9 10 Reviewed by Anders Carlsson. 11 12 * UIProcess/DrawingAreaProxyImpl.cpp: 13 (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl): Initialize our timer. 14 (WebKit::DrawingAreaProxyImpl::paint): Don't bail if we don't have a backing store (but do 15 bail if we're in accelerated compositing mode); we might have thrown it away to save memory 16 but now are being asked to paint by the view. The existing code in this function will handle 17 getting a new backing store if possible by blocking for a little while to try to receive a 18 DidUpdateBackingStoreState message. Added an assertion that we do have a backing store if we 19 don't have any outstanding UpdateBackingStoreState requests. After painting, call 20 discardBackingStoreSoon to update our timer. 21 (WebKit::DrawingAreaProxyImpl::discardBackingStoreSoon): Set the timer for 5 seconds in the 22 future. 23 (WebKit::DrawingAreaProxyImpl::discardBackingStore): Throw away the backing store, and tell 24 the web process we'll need a full backing store update on the next paint. 25 26 * UIProcess/DrawingAreaProxyImpl.h: Added m_discardBackingStoreTimer. 27 1 28 2011-03-03 Adam Roben <aroben@apple.com> 2 29 -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
r80306 r80307 53 53 , m_nextBackingStoreStateID(0) 54 54 , m_isWaitingForDidUpdateBackingStoreState(false) 55 , m_discardBackingStoreTimer(RunLoop::current(), this, &DrawingAreaProxyImpl::discardBackingStore) 55 56 { 56 57 } … … 67 68 unpaintedRegion = rect; 68 69 69 if (!m_backingStore) 70 return; 71 72 ASSERT(!isInAcceleratedCompositingMode()); 70 if (isInAcceleratedCompositingMode()) 71 return; 73 72 74 73 ASSERT(m_currentBackingStoreStateID <= m_nextBackingStoreStateID); … … 89 88 if (!m_backingStore || isInAcceleratedCompositingMode()) 90 89 return; 91 } else 90 } else { 92 91 ASSERT(!m_isWaitingForDidUpdateBackingStoreState); 92 ASSERT(m_backingStore); 93 } 93 94 94 95 m_backingStore->paint(context, rect); 95 96 unpaintedRegion.subtract(IntRect(IntPoint(), m_backingStore->size())); 97 98 discardBackingStoreSoon(); 96 99 } 97 100 … … 289 292 } 290 293 294 void DrawingAreaProxyImpl::discardBackingStoreSoon() 295 { 296 // We'll wait this many seconds after the last paint before throwing away our backing store to save memory. 297 // FIXME: It would be smarter to make this delay based on how expensive painting is. See <http://webkit.org/b/55733>. 298 static const double discardBackingStoreDelay = 5; 299 300 m_discardBackingStoreTimer.startOneShot(discardBackingStoreDelay); 301 } 302 303 void DrawingAreaProxyImpl::discardBackingStore() 304 { 305 m_backingStore = nullptr; 306 backingStoreStateDidChange(DoNotRespondImmediately); 307 } 308 291 309 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
r80306 r80307 30 30 #include "DrawingAreaProxy.h" 31 31 #include "LayerTreeContext.h" 32 #include "RunLoop.h" 32 33 #include <wtf/OwnPtr.h> 33 34 #include <wtf/PassOwnPtr.h> … … 73 74 bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); } 74 75 76 void discardBackingStoreSoon(); 77 void discardBackingStore(); 78 75 79 // The state ID corresponding to our current backing store. Updated whenever we allocate 76 80 // a new backing store. Any messages received that correspond to an earlier state are ignored, … … 90 94 91 95 OwnPtr<BackingStore> m_backingStore; 96 97 RunLoop::Timer<DrawingAreaProxyImpl> m_discardBackingStoreTimer; 92 98 }; 93 99
Note: See TracChangeset
for help on using the changeset viewer.