Changeset 76157 in webkit
- Timestamp:
- Jan 19, 2011 1:56:58 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r76149 r76157 1 2011-01-19 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Suspend/resume painting as the WKView visibility changes 6 https://bugs.webkit.org/show_bug.cgi?id=52738 7 8 * UIProcess/DrawingAreaProxy.h: 9 (WebKit::DrawingAreaProxy::visibilityDidChange): 10 Add new member function. It should really be pure virtual once setPageIsVisible 11 is removed. 12 13 * UIProcess/DrawingAreaProxyImpl.cpp: 14 (WebKit::DrawingAreaProxyImpl::visibilityDidChange): 15 Send SuspendPainting/ResumePainting messages based on whether the view is visible or not. 16 17 (WebKit::DrawingAreaProxyImpl::setPageIsVisible): 18 Make this a stub; it should really be removed. 19 20 * UIProcess/WebPageProxy.cpp: 21 (WebKit::WebPageProxy::viewStateDidChange): 22 Call visibilityDidChange. 23 24 * UIProcess/WebPageProxy.h: 25 (WebKit::WebPageProxy::isViewVisible): 26 Add new getter. 27 28 * WebProcess/WebPage/DrawingArea.messages.in: 29 Add SuspendPainting and ResumePainting messages. 30 31 * WebProcess/WebPage/DrawingAreaImpl.cpp: 32 (WebKit::DrawingAreaImpl::DrawingAreaImpl): 33 Initialize m_isPaintingSuspended. 34 35 (WebKit::DrawingAreaImpl::suspendPainting): 36 Set m_isPaintingSuspended to true and stop the display timer. 37 38 (WebKit::DrawingAreaImpl::resumePainting): 39 Set m_isPaintingSuspended to false. 40 41 (WebKit::DrawingAreaImpl::scheduleDisplay): 42 (WebKit::DrawingAreaImpl::display): 43 Bail if m_isPaintingSuspended is true. 44 1 45 2011-01-19 Andreas Kling <kling@webkit.org> 2 46 -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h
r76143 r76157 66 66 67 67 virtual void sizeDidChange() = 0; 68 69 // FIXME: visibilityDidChange() should be pure virtual. 70 virtual void visibilityDidChange() { } 71 68 72 virtual void setPageIsVisible(bool isVisible) = 0; 69 73 -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
r76143 r76157 83 83 } 84 84 85 void DrawingAreaProxyImpl:: setPageIsVisible(bool pageIsVisible)85 void DrawingAreaProxyImpl::visibilityDidChange() 86 86 { 87 // FIXME: Implement. 87 if (!m_webPageProxy->isViewVisible()) { 88 // Suspend painting. 89 m_webPageProxy->process()->send(Messages::DrawingArea::SuspendPainting(), m_webPageProxy->pageID()); 90 return; 91 } 92 93 // Resume painting. 94 m_webPageProxy->process()->send(Messages::DrawingArea::ResumePainting(), m_webPageProxy->pageID()); 95 } 96 97 void DrawingAreaProxyImpl::setPageIsVisible(bool) 98 { 88 99 } 89 100 -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
r76143 r76157 47 47 virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext); 48 48 virtual void sizeDidChange(); 49 virtual void visibilityDidChange(); 49 50 virtual void setPageIsVisible(bool); 50 51 virtual void attachCompositingContext(uint32_t contextID); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r76092 r76157 498 498 if (isVisible != m_isVisible) { 499 499 m_isVisible = isVisible; 500 m_drawingArea->visibilityDidChange(); 500 501 m_drawingArea->setPageIsVisible(isVisible); 501 502 } -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r76087 r76157 186 186 187 187 WebCore::IntSize viewSize() const; 188 bool isViewVisible() const { return m_isVisible; } 188 189 189 190 void executeEditCommand(const String& commandName); -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
r76135 r76157 83 83 virtual void setSize(const WebCore::IntSize&) { } 84 84 virtual void didUpdate() { } 85 virtual void suspendPainting() { } 86 virtual void resumePainting() { } 85 87 }; 86 88 -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
r75630 r76157 23 23 messages -> DrawingArea { 24 24 SetSize(WebCore::IntSize size) 25 DidUpdate() 25 DidUpdate() 26 SuspendPainting() 27 ResumePainting() 26 28 } -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
r76143 r76157 54 54 : DrawingArea(DrawingAreaInfo::Impl, parameters.drawingAreaInfo.identifier, webPage) 55 55 , m_isWaitingForDidUpdate(false) 56 , m_isPaintingSuspended(!parameters.isVisible) 56 57 , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaImpl::display) 57 58 { … … 157 158 } 158 159 160 void DrawingAreaImpl::suspendPainting() 161 { 162 ASSERT(!m_isPaintingSuspended); 163 164 m_isPaintingSuspended = true; 165 m_displayTimer.stop(); 166 } 167 168 void DrawingAreaImpl::resumePainting() 169 { 170 ASSERT(m_isPaintingSuspended); 171 172 m_isPaintingSuspended = false; 173 174 // FIXME: Repaint if needed. 175 } 176 159 177 void DrawingAreaImpl::scheduleDisplay() 160 178 { … … 162 180 return; 163 181 182 if (m_isPaintingSuspended) 183 return; 184 164 185 if (m_dirtyRegion.isEmpty()) 165 186 return; … … 173 194 void DrawingAreaImpl::display() 174 195 { 196 ASSERT(!m_isWaitingForDidUpdate); 197 198 if (m_isPaintingSuspended) 199 return; 200 175 201 if (m_dirtyRegion.isEmpty()) 176 202 return; -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
r76135 r76157 56 56 virtual void setSize(const WebCore::IntSize&); 57 57 virtual void didUpdate(); 58 virtual void suspendPainting(); 59 virtual void resumePainting(); 58 60 59 61 void scheduleDisplay(); … … 68 70 // web process won't paint more frequent than the UI process can handle. 69 71 bool m_isWaitingForDidUpdate; 70 72 73 // Whether painting is suspended. We'll still keep track of the dirty region but we 74 // won't paint until painting has resumed again. 75 bool m_isPaintingSuspended; 76 71 77 RunLoop::Timer<DrawingAreaImpl> m_displayTimer; 72 78 };
Note: See TracChangeset
for help on using the changeset viewer.