Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: cc/CCThreadProxy.cpp

Issue 10920059: Rolls cc and webkit_compositor up to 127340 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/CCSingleThreadProxy.h ('k') | cc/cc_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "CCThreadProxy.h" 7 #include "CCThreadProxy.h"
8 8
9 #include "CCDelayBasedTimeSource.h" 9 #include "CCDelayBasedTimeSource.h"
10 #include "CCDrawQuad.h" 10 #include "CCDrawQuad.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ASSERT(isMainThread()); 82 ASSERT(isMainThread());
83 ASSERT(m_layerTreeHost); 83 ASSERT(m_layerTreeHost);
84 84
85 if (!m_layerTreeHost->initializeRendererIfNeeded()) { 85 if (!m_layerTreeHost->initializeRendererIfNeeded()) {
86 TRACE_EVENT0("cc", "compositeAndReadback_EarlyOut_LR_Uninitialized"); 86 TRACE_EVENT0("cc", "compositeAndReadback_EarlyOut_LR_Uninitialized");
87 return false; 87 return false;
88 } 88 }
89 89
90 90
91 // Perform a synchronous commit. 91 // Perform a synchronous commit.
92 CCCompletionEvent beginFrameCompletion; 92 {
93 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::for ceBeginFrameOnImplThread, &beginFrameCompletion)); 93 DebugScopedSetMainThreadBlocked mainThreadBlocked;
94 beginFrameCompletion.wait(); 94 CCCompletionEvent beginFrameCompletion;
95 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy: :forceBeginFrameOnImplThread, &beginFrameCompletion));
96 beginFrameCompletion.wait();
97 }
95 m_inCompositeAndReadback = true; 98 m_inCompositeAndReadback = true;
96 beginFrame(); 99 beginFrame();
97 m_inCompositeAndReadback = false; 100 m_inCompositeAndReadback = false;
98 101
99 // Perform a synchronous readback. 102 // Perform a synchronous readback.
100 ReadbackRequest request; 103 ReadbackRequest request;
101 request.rect = rect; 104 request.rect = rect;
102 request.pixels = pixels; 105 request.pixels = pixels;
103 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::req uestReadbackOnImplThread, &request)); 106 {
104 request.completion.wait(); 107 DebugScopedSetMainThreadBlocked mainThreadBlocked;
108 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy: :requestReadbackOnImplThread, &request));
109 request.completion.wait();
110 }
105 return request.success; 111 return request.success;
106 } 112 }
107 113
108 void CCThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request) 114 void CCThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request)
109 { 115 {
110 ASSERT(CCProxy::isImplThread()); 116 ASSERT(CCProxy::isImplThread());
111 ASSERT(!m_readbackRequestOnImplThread); 117 ASSERT(!m_readbackRequestOnImplThread);
112 if (!m_layerTreeHostImpl) { 118 if (!m_layerTreeHostImpl) {
113 request->success = false; 119 request->success = false;
114 request->completion.signal(); 120 request->completion.signal();
(...skipping 16 matching lines...) Expand all
131 ASSERT(CCProxy::isImplThread()); 137 ASSERT(CCProxy::isImplThread());
132 if (m_layerTreeHostImpl) 138 if (m_layerTreeHostImpl)
133 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime(), duration); 139 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime(), duration);
134 } 140 }
135 141
136 void CCThreadProxy::finishAllRendering() 142 void CCThreadProxy::finishAllRendering()
137 { 143 {
138 ASSERT(CCProxy::isMainThread()); 144 ASSERT(CCProxy::isMainThread());
139 145
140 // Make sure all GL drawing is finished on the impl thread. 146 // Make sure all GL drawing is finished on the impl thread.
147 DebugScopedSetMainThreadBlocked mainThreadBlocked;
141 CCCompletionEvent completion; 148 CCCompletionEvent completion;
142 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::fin ishAllRenderingOnImplThread, &completion)); 149 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::fin ishAllRenderingOnImplThread, &completion));
143 completion.wait(); 150 completion.wait();
144 } 151 }
145 152
146 bool CCThreadProxy::isStarted() const 153 bool CCThreadProxy::isStarted() const
147 { 154 {
148 ASSERT(CCProxy::isMainThread()); 155 ASSERT(CCProxy::isMainThread());
149 return m_started; 156 return m_started;
150 } 157 }
(...skipping 18 matching lines...) Expand all
169 176
170 void CCThreadProxy::setSurfaceReadyOnImplThread() 177 void CCThreadProxy::setSurfaceReadyOnImplThread()
171 { 178 {
172 TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReadyOnImplThread"); 179 TRACE_EVENT0("cc", "CCThreadProxy::setSurfaceReadyOnImplThread");
173 m_schedulerOnImplThread->setCanBeginFrame(true); 180 m_schedulerOnImplThread->setCanBeginFrame(true);
174 } 181 }
175 182
176 void CCThreadProxy::setVisible(bool visible) 183 void CCThreadProxy::setVisible(bool visible)
177 { 184 {
178 TRACE_EVENT0("cc", "CCThreadProxy::setVisible"); 185 TRACE_EVENT0("cc", "CCThreadProxy::setVisible");
186 DebugScopedSetMainThreadBlocked mainThreadBlocked;
179 CCCompletionEvent completion; 187 CCCompletionEvent completion;
180 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set VisibleOnImplThread, &completion, visible)); 188 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::set VisibleOnImplThread, &completion, visible));
181 completion.wait(); 189 completion.wait();
182 } 190 }
183 191
184 void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool v isible) 192 void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool v isible)
185 { 193 {
186 TRACE_EVENT0("cc", "CCThreadProxy::setVisibleOnImplThread"); 194 TRACE_EVENT0("cc", "CCThreadProxy::setVisibleOnImplThread");
187 m_layerTreeHostImpl->setVisible(visible); 195 m_layerTreeHostImpl->setVisible(visible);
188 m_schedulerOnImplThread->setVisible(visible); 196 m_schedulerOnImplThread->setVisible(visible);
189 completion->signal(); 197 completion->signal();
190 } 198 }
191 199
192 bool CCThreadProxy::initializeRenderer() 200 bool CCThreadProxy::initializeRenderer()
193 { 201 {
194 TRACE_EVENT0("cc", "CCThreadProxy::initializeRenderer"); 202 TRACE_EVENT0("cc", "CCThreadProxy::initializeRenderer");
195 // Make a blocking call to initializeRendererOnImplThread. The results of th at call 203 // Make a blocking call to initializeRendererOnImplThread. The results of th at call
196 // are pushed into the initializeSucceeded and capabilities local variables. 204 // are pushed into the initializeSucceeded and capabilities local variables.
197 CCCompletionEvent completion; 205 CCCompletionEvent completion;
198 bool initializeSucceeded = false; 206 bool initializeSucceeded = false;
199 RendererCapabilities capabilities; 207 RendererCapabilities capabilities;
208 DebugScopedSetMainThreadBlocked mainThreadBlocked;
200 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini tializeRendererOnImplThread, 209 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini tializeRendererOnImplThread,
201 &completion, 210 &completion,
202 &initializeSucceeded, 211 &initializeSucceeded,
203 &capabilities)); 212 &capabilities));
204 completion.wait(); 213 completion.wait();
205 214
206 if (initializeSucceeded) { 215 if (initializeSucceeded) {
207 m_rendererInitialized = true; 216 m_rendererInitialized = true;
208 m_RendererCapabilitiesMainThreadCopy = capabilities; 217 m_RendererCapabilitiesMainThreadCopy = capabilities;
209 } 218 }
(...skipping 12 matching lines...) Expand all
222 if (m_layerTreeHost->needsSharedContext()) 231 if (m_layerTreeHost->needsSharedContext())
223 if (!WebSharedGraphicsContext3D::createCompositorThreadContext()) 232 if (!WebSharedGraphicsContext3D::createCompositorThreadContext())
224 return false; 233 return false;
225 234
226 // Make a blocking call to recreateContextOnImplThread. The results of that 235 // Make a blocking call to recreateContextOnImplThread. The results of that
227 // call are pushed into the recreateSucceeded and capabilities local 236 // call are pushed into the recreateSucceeded and capabilities local
228 // variables. 237 // variables.
229 CCCompletionEvent completion; 238 CCCompletionEvent completion;
230 bool recreateSucceeded = false; 239 bool recreateSucceeded = false;
231 RendererCapabilities capabilities; 240 RendererCapabilities capabilities;
241 DebugScopedSetMainThreadBlocked mainThreadBlocked;
232 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::rec reateContextOnImplThread, 242 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::rec reateContextOnImplThread,
233 &completion, 243 &completion,
234 context.leakPtr(), 244 context.leakPtr(),
235 &recreateSucceeded, 245 &recreateSucceeded,
236 &capabilities)); 246 &capabilities));
237 completion.wait(); 247 completion.wait();
238 248
239 if (recreateSucceeded) 249 if (recreateSucceeded)
240 m_RendererCapabilitiesMainThreadCopy = capabilities; 250 m_RendererCapabilitiesMainThreadCopy = capabilities;
241 return recreateSucceeded; 251 return recreateSucceeded;
242 } 252 }
243 253
244 int CCThreadProxy::compositorIdentifier() const 254 int CCThreadProxy::compositorIdentifier() const
245 { 255 {
246 ASSERT(isMainThread()); 256 ASSERT(isMainThread());
247 return m_compositorIdentifier; 257 return m_compositorIdentifier;
248 } 258 }
249 259
250 void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats) 260 void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats)
251 { 261 {
252 ASSERT(isMainThread()); 262 ASSERT(isMainThread());
253 263
264 DebugScopedSetMainThreadBlocked mainThreadBlocked;
254 CCCompletionEvent completion; 265 CCCompletionEvent completion;
255 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::imp lSideRenderingStatsOnImplThread, 266 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::imp lSideRenderingStatsOnImplThread,
256 &completion, 267 &completion,
257 &stats)); 268 &stats));
258 completion.wait(); 269 completion.wait();
259 } 270 }
260 271
261 const RendererCapabilities& CCThreadProxy::rendererCapabilities() const 272 const RendererCapabilities& CCThreadProxy::rendererCapabilities() const
262 { 273 {
263 ASSERT(m_rendererInitialized); 274 ASSERT(m_rendererInitialized);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ASSERT(isImplThread()); 373 ASSERT(isImplThread());
363 TRACE_EVENT0("cc", "CCThreadProxy::setNeedsRedrawOnImplThread"); 374 TRACE_EVENT0("cc", "CCThreadProxy::setNeedsRedrawOnImplThread");
364 m_schedulerOnImplThread->setNeedsRedraw(); 375 m_schedulerOnImplThread->setNeedsRedraw();
365 } 376 }
366 377
367 void CCThreadProxy::start() 378 void CCThreadProxy::start()
368 { 379 {
369 ASSERT(isMainThread()); 380 ASSERT(isMainThread());
370 ASSERT(CCProxy::implThread()); 381 ASSERT(CCProxy::implThread());
371 // Create LayerTreeHostImpl. 382 // Create LayerTreeHostImpl.
383 DebugScopedSetMainThreadBlocked mainThreadBlocked;
372 CCCompletionEvent completion; 384 CCCompletionEvent completion;
373 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini tializeImplOnImplThread, &completion)); 385 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::ini tializeImplOnImplThread, &completion));
374 completion.wait(); 386 completion.wait();
375 387
376 m_started = true; 388 m_started = true;
377 } 389 }
378 390
379 void CCThreadProxy::stop() 391 void CCThreadProxy::stop()
380 { 392 {
381 TRACE_EVENT0("cc", "CCThreadProxy::stop"); 393 TRACE_EVENT0("cc", "CCThreadProxy::stop");
(...skipping 11 matching lines...) Expand all
393 405
394 m_mainThreadProxy->shutdown(); // Stop running tasks posted to us. 406 m_mainThreadProxy->shutdown(); // Stop running tasks posted to us.
395 407
396 ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted. 408 ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted.
397 m_layerTreeHost = 0; 409 m_layerTreeHost = 0;
398 m_started = false; 410 m_started = false;
399 } 411 }
400 412
401 void CCThreadProxy::forceSerializeOnSwapBuffers() 413 void CCThreadProxy::forceSerializeOnSwapBuffers()
402 { 414 {
415 DebugScopedSetMainThreadBlocked mainThreadBlocked;
403 CCCompletionEvent completion; 416 CCCompletionEvent completion;
404 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::for ceSerializeOnSwapBuffersOnImplThread, &completion)); 417 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::for ceSerializeOnSwapBuffersOnImplThread, &completion));
405 completion.wait(); 418 completion.wait();
406 } 419 }
407 420
408 void CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent* c ompletion) 421 void CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent* c ompletion)
409 { 422 {
410 if (m_rendererInitialized) 423 if (m_rendererInitialized)
411 m_layerTreeHostImpl->renderer()->doNoOp(); 424 m_layerTreeHostImpl->renderer()->doNoOp();
412 completion->signal(); 425 completion->signal();
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 // directly by the compositor. 727 // directly by the compositor.
715 // This method will block until the next compositor draw if there is a 728 // This method will block until the next compositor draw if there is a
716 // previously committed frame that is still undrawn. This is necessary to 729 // previously committed frame that is still undrawn. This is necessary to
717 // ensure that the main thread does not monopolize access to the textures. 730 // ensure that the main thread does not monopolize access to the textures.
718 ASSERT(isMainThread()); 731 ASSERT(isMainThread());
719 732
720 if (m_texturesAcquired) 733 if (m_texturesAcquired)
721 return; 734 return;
722 735
723 TRACE_EVENT0("cc", "CCThreadProxy::acquireLayerTextures"); 736 TRACE_EVENT0("cc", "CCThreadProxy::acquireLayerTextures");
737 DebugScopedSetMainThreadBlocked mainThreadBlocked;
724 CCCompletionEvent completion; 738 CCCompletionEvent completion;
725 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::acq uireLayerTexturesForMainThreadOnImplThread, &completion)); 739 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::acq uireLayerTexturesForMainThreadOnImplThread, &completion));
726 completion.wait(); // Block until it is safe to write to layer textures from the main thread. 740 completion.wait(); // Block until it is safe to write to layer textures from the main thread.
727 741
728 m_texturesAcquired = true; 742 m_texturesAcquired = true;
729 } 743 }
730 744
731 void CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEv ent* completion) 745 void CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEv ent* completion)
732 { 746 {
733 ASSERT(isImplThread()); 747 ASSERT(isImplThread());
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } 913 }
900 914
901 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple tion, CCRenderingStats* stats) 915 void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* comple tion, CCRenderingStats* stats)
902 { 916 {
903 ASSERT(isImplThread()); 917 ASSERT(isImplThread());
904 m_layerTreeHostImpl->renderingStats(*stats); 918 m_layerTreeHostImpl->renderingStats(*stats);
905 completion->signal(); 919 completion->signal();
906 } 920 }
907 921
908 } // namespace WebCore 922 } // namespace WebCore
OLDNEW
« no previous file with comments | « cc/CCSingleThreadProxy.h ('k') | cc/cc_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698