Changeset 58781 in webkit
- Timestamp:
- May 4, 2010 3:24:09 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r58720 r58781 1 2010-05-04 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 [WebKit2] The web process doesn't need to paint when the web view is hidden. 6 https://bugs.webkit.org/show_bug.cgi?id=38549 7 8 * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h: 9 (DrawingAreaMessage::): 10 Add SuspendPainting/ResumePainting messages. 11 12 * UIProcess/DrawingAreaProxyUpdateChunk.cpp: 13 (WebKit::DrawingAreaProxyUpdateChunk::setPageIsVisible): 14 Suspend and resume painting accordingly. 15 16 * WebProcess/WebPage/DrawingAreaUpdateChunk.cpp: 17 (WebKit::DrawingAreaUpdateChunk::DrawingAreaUpdateChunk): 18 Initialize m_shouldPaint to true. 19 20 (WebKit::DrawingAreaUpdateChunk::display): 21 Return if m_shouldPaint is false. 22 23 (WebKit::DrawingAreaUpdateChunk::scheduleDisplay): 24 Ditto. 25 26 (WebKit::DrawingAreaUpdateChunk::setSize): 27 Assert that we should paint here. 28 29 (WebKit::DrawingAreaUpdateChunk::suspendPainting): 30 Set m_shouldPaint to false and stop the timer. 31 32 (WebKit::DrawingAreaUpdateChunk::resumePainting): 33 Set m_shouldPaint to true and paint if needed. 34 35 (WebKit::DrawingAreaUpdateChunk::didReceiveMessage): 36 handle SuspendPainting/ResumePainting messages. 37 38 * WebProcess/WebPage/DrawingAreaUpdateChunk.h: 39 1 40 2010-05-03 Anders Carlsson <andersca@apple.com> 2 41 -
trunk/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h
r58119 r58781 34 34 35 35 enum Kind { 36 Initialize,36 // Called whenever the size of the drawing area needs to be updated. 37 37 SetSize, 38 38 39 // Called when the drawing area should stop painting. 40 SuspendPainting, 41 42 // Called when the drawing area should start painting again. 43 ResumePainting, 44 39 45 // Called when an update chunk sent to the drawing area has been 40 46 // incorporated into the backing store. -
trunk/WebKit2/UIProcess/DrawingAreaProxyUpdateChunk.cpp
r58714 r58781 95 95 if (!page->isValid()) 96 96 return; 97 98 if (!m_isVisible) { 99 // Tell the web process that it doesn't need to paint anything for now. 100 page->process()->connection()->send(DrawingAreaMessage::SuspendPainting, page->pageID(), CoreIPC::In()); 101 return; 102 } 97 103 98 // FIXME: Actually notify the web process that the visibility has changed. 104 // The page is now visible. 105 page->process()->connection()->send(DrawingAreaMessage::ResumePainting, page->pageID(), CoreIPC::In()); 106 107 // FIXME: We should request a full repaint here if needed. 99 108 } 100 109 -
trunk/WebKit2/WebProcess/WebPage/DrawingAreaUpdateChunk.cpp
r58189 r58781 41 41 : DrawingArea(DrawingAreaUpdateChunkType, webPage) 42 42 , m_isWaitingForUpdate(false) 43 , m_shouldPaint(true) 43 44 , m_displayTimer(WebProcess::shared().runLoop(), this, &DrawingAreaUpdateChunk::display) 44 45 { … … 80 81 { 81 82 ASSERT(!m_isWaitingForUpdate); 83 84 if (!m_shouldPaint) 85 return; 82 86 83 87 if (m_dirtyRect.isEmpty()) … … 102 106 void DrawingAreaUpdateChunk::scheduleDisplay() 103 107 { 108 if (!m_shouldPaint) 109 return; 110 104 111 if (m_isWaitingForUpdate) 105 112 return; … … 113 120 void DrawingAreaUpdateChunk::setSize(const IntSize& viewSize) 114 121 { 122 ASSERT(m_shouldPaint); 115 123 ASSERT_ARG(viewSize, !viewSize.isEmpty()); 116 124 … … 130 138 131 139 WebProcess::shared().connection()->send(DrawingAreaProxyMessage::DidSetSize, m_webPage->pageID(), CoreIPC::In(updateChunk)); 140 } 141 142 void DrawingAreaUpdateChunk::suspendPainting() 143 { 144 ASSERT(m_shouldPaint); 145 146 m_shouldPaint = false; 147 m_displayTimer.stop(); 148 } 149 150 void DrawingAreaUpdateChunk::resumePainting() 151 { 152 ASSERT(!m_shouldPaint); 153 154 m_shouldPaint = true; 155 156 // Display if needed. 157 display(); 132 158 } 133 159 … … 152 178 } 153 179 180 case DrawingAreaMessage::SuspendPainting: 181 suspendPainting(); 182 break; 183 184 case DrawingAreaMessage::ResumePainting: 185 resumePainting(); 186 break; 187 154 188 case DrawingAreaMessage::DidUpdate: 155 189 didUpdate(); -
trunk/WebKit2/WebProcess/WebPage/DrawingAreaUpdateChunk.h
r58189 r58781 51 51 private: 52 52 void scheduleDisplay(); 53 54 // CoreIPC message handlers. 53 55 void setSize(const WebCore::IntSize& viewSize); 54 56 void suspendPainting(); 57 void resumePainting(); 55 58 void didUpdate(); 56 59 … … 60 63 WebCore::IntRect m_dirtyRect; 61 64 bool m_isWaitingForUpdate; 65 bool m_shouldPaint; 62 66 RunLoop::Timer<DrawingAreaUpdateChunk> m_displayTimer; 63 67 };
Note: See TracChangeset
for help on using the changeset viewer.