| OLD | NEW |
| 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 "cc/thread_proxy.h" | 7 #include "cc/thread_proxy.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "cc/delay_based_time_source.h" | 11 #include "cc/delay_based_time_source.h" |
| 12 #include "cc/draw_quad.h" | 12 #include "cc/draw_quad.h" |
| 13 #include "cc/frame_rate_controller.h" | 13 #include "cc/frame_rate_controller.h" |
| 14 #include "cc/graphics_context.h" | 14 #include "cc/graphics_context.h" |
| 15 #include "cc/input_handler.h" | 15 #include "cc/input_handler.h" |
| 16 #include "cc/layer_tree_host.h" | 16 #include "cc/layer_tree_host.h" |
| 17 #include "cc/scheduler.h" | 17 #include "cc/scheduler.h" |
| 18 #include "cc/scoped_thread_proxy.h" | 18 #include "cc/scoped_thread_proxy.h" |
| 19 #include "cc/thread.h" | |
| 20 #include <public/WebSharedGraphicsContext3D.h> | 19 #include <public/WebSharedGraphicsContext3D.h> |
| 21 | 20 |
| 22 using WebKit::WebSharedGraphicsContext3D; | 21 using WebKit::WebSharedGraphicsContext3D; |
| 23 | 22 |
| 24 namespace { | 23 namespace { |
| 25 | 24 |
| 26 // Measured in seconds. | 25 // Measured in seconds. |
| 27 const double contextRecreationTickRate = 0.03; | 26 const double contextRecreationTickRate = 0.03; |
| 28 | 27 |
| 29 } // namespace | 28 } // namespace |
| 30 | 29 |
| 31 namespace cc { | 30 namespace cc { |
| 32 | 31 |
| 33 scoped_ptr<Proxy> ThreadProxy::create(LayerTreeHost* layerTreeHost, scoped_ptr<T
hread> implThread) | 32 scoped_ptr<Proxy> ThreadProxy::create(LayerTreeHost* layerTreeHost) |
| 34 { | 33 { |
| 35 return make_scoped_ptr(new ThreadProxy(layerTreeHost, implThread.Pass())).Pa
ssAs<Proxy>(); | 34 return make_scoped_ptr(new ThreadProxy(layerTreeHost)).PassAs<Proxy>(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost, scoped_ptr<Thread> implTh
read) | 37 ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost) |
| 39 : Proxy(implThread.Pass()) | 38 : m_animateRequested(false) |
| 40 , m_animateRequested(false) | |
| 41 , m_commitRequested(false) | 39 , m_commitRequested(false) |
| 42 , m_commitRequestSentToImplThread(false) | 40 , m_commitRequestSentToImplThread(false) |
| 43 , m_forcedCommitRequested(false) | 41 , m_forcedCommitRequested(false) |
| 44 , m_layerTreeHost(layerTreeHost) | 42 , m_layerTreeHost(layerTreeHost) |
| 45 , m_rendererInitialized(false) | 43 , m_rendererInitialized(false) |
| 46 , m_started(false) | 44 , m_started(false) |
| 47 , m_texturesAcquired(true) | 45 , m_texturesAcquired(true) |
| 48 , m_inCompositeAndReadback(false) | 46 , m_inCompositeAndReadback(false) |
| 49 , m_mainThreadProxy(ScopedThreadProxy::create(Proxy::mainThread())) | 47 , m_mainThreadProxy(ScopedThreadProxy::create(Proxy::mainThread())) |
| 50 , m_beginFrameCompletionEventOnImplThread(0) | 48 , m_beginFrameCompletionEventOnImplThread(0) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 76 DCHECK(!m_deferCommits); | 74 DCHECK(!m_deferCommits); |
| 77 | 75 |
| 78 if (!m_layerTreeHost->initializeRendererIfNeeded()) { | 76 if (!m_layerTreeHost->initializeRendererIfNeeded()) { |
| 79 TRACE_EVENT0("cc", "compositeAndReadback_EarlyOut_LR_Uninitialized"); | 77 TRACE_EVENT0("cc", "compositeAndReadback_EarlyOut_LR_Uninitialized"); |
| 80 return false; | 78 return false; |
| 81 } | 79 } |
| 82 | 80 |
| 83 | 81 |
| 84 // Perform a synchronous commit. | 82 // Perform a synchronous commit. |
| 85 { | 83 { |
| 86 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 84 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 87 CompletionEvent beginFrameCompletion; | 85 CompletionEvent beginFrameCompletion; |
| 88 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::forceBeginFrameOn
ImplThread, base::Unretained(this), &beginFrameCompletion)); | 86 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::forceBeginFrameOn
ImplThread, base::Unretained(this), &beginFrameCompletion)); |
| 89 beginFrameCompletion.wait(); | 87 beginFrameCompletion.wait(); |
| 90 } | 88 } |
| 91 m_inCompositeAndReadback = true; | 89 m_inCompositeAndReadback = true; |
| 92 beginFrame(); | 90 beginFrame(); |
| 93 m_inCompositeAndReadback = false; | 91 m_inCompositeAndReadback = false; |
| 94 | 92 |
| 95 // Perform a synchronous readback. | 93 // Perform a synchronous readback. |
| 96 ReadbackRequest request; | 94 ReadbackRequest request; |
| 97 request.rect = rect; | 95 request.rect = rect; |
| 98 request.pixels = pixels; | 96 request.pixels = pixels; |
| 99 { | 97 { |
| 100 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 98 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 101 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::requestReadbackOn
ImplThread, base::Unretained(this), &request)); | 99 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::requestReadbackOn
ImplThread, base::Unretained(this), &request)); |
| 102 request.completion.wait(); | 100 request.completion.wait(); |
| 103 } | 101 } |
| 104 return request.success; | 102 return request.success; |
| 105 } | 103 } |
| 106 | 104 |
| 107 void ThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request) | 105 void ThreadProxy::requestReadbackOnImplThread(ReadbackRequest* request) |
| 108 { | 106 { |
| 109 DCHECK(Proxy::isImplThread()); | 107 DCHECK(Proxy::isImplThread()); |
| 110 DCHECK(!m_readbackRequestOnImplThread); | 108 DCHECK(!m_readbackRequestOnImplThread); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 131 if (m_layerTreeHostImpl.get()) | 129 if (m_layerTreeHostImpl.get()) |
| 132 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor,
scale, base::TimeTicks::Now(), duration); | 130 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor,
scale, base::TimeTicks::Now(), duration); |
| 133 } | 131 } |
| 134 | 132 |
| 135 void ThreadProxy::finishAllRendering() | 133 void ThreadProxy::finishAllRendering() |
| 136 { | 134 { |
| 137 DCHECK(Proxy::isMainThread()); | 135 DCHECK(Proxy::isMainThread()); |
| 138 DCHECK(!m_deferCommits); | 136 DCHECK(!m_deferCommits); |
| 139 | 137 |
| 140 // Make sure all GL drawing is finished on the impl thread. | 138 // Make sure all GL drawing is finished on the impl thread. |
| 141 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 139 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 142 CompletionEvent completion; | 140 CompletionEvent completion; |
| 143 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::finishAllRenderingOnI
mplThread, base::Unretained(this), &completion)); | 141 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::finishAllRenderingOnI
mplThread, base::Unretained(this), &completion)); |
| 144 completion.wait(); | 142 completion.wait(); |
| 145 } | 143 } |
| 146 | 144 |
| 147 bool ThreadProxy::isStarted() const | 145 bool ThreadProxy::isStarted() const |
| 148 { | 146 { |
| 149 DCHECK(Proxy::isMainThread()); | 147 DCHECK(Proxy::isMainThread()); |
| 150 return m_started; | 148 return m_started; |
| 151 } | 149 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 169 | 167 |
| 170 void ThreadProxy::setSurfaceReadyOnImplThread() | 168 void ThreadProxy::setSurfaceReadyOnImplThread() |
| 171 { | 169 { |
| 172 TRACE_EVENT0("cc", "ThreadProxy::setSurfaceReadyOnImplThread"); | 170 TRACE_EVENT0("cc", "ThreadProxy::setSurfaceReadyOnImplThread"); |
| 173 m_schedulerOnImplThread->setCanBeginFrame(true); | 171 m_schedulerOnImplThread->setCanBeginFrame(true); |
| 174 } | 172 } |
| 175 | 173 |
| 176 void ThreadProxy::setVisible(bool visible) | 174 void ThreadProxy::setVisible(bool visible) |
| 177 { | 175 { |
| 178 TRACE_EVENT0("cc", "ThreadProxy::setVisible"); | 176 TRACE_EVENT0("cc", "ThreadProxy::setVisible"); |
| 179 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 177 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 180 CompletionEvent completion; | 178 CompletionEvent completion; |
| 181 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::setVisibleOnImplThrea
d, base::Unretained(this), &completion, visible)); | 179 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::setVisibleOnImplThrea
d, base::Unretained(this), &completion, visible)); |
| 182 completion.wait(); | 180 completion.wait(); |
| 183 } | 181 } |
| 184 | 182 |
| 185 void ThreadProxy::setVisibleOnImplThread(CompletionEvent* completion, bool visib
le) | 183 void ThreadProxy::setVisibleOnImplThread(CompletionEvent* completion, bool visib
le) |
| 186 { | 184 { |
| 187 TRACE_EVENT0("cc", "ThreadProxy::setVisibleOnImplThread"); | 185 TRACE_EVENT0("cc", "ThreadProxy::setVisibleOnImplThread"); |
| 188 m_layerTreeHostImpl->setVisible(visible); | 186 m_layerTreeHostImpl->setVisible(visible); |
| 189 m_schedulerOnImplThread->setVisible(visible); | 187 m_schedulerOnImplThread->setVisible(visible); |
| 190 completion->signal(); | 188 completion->signal(); |
| 191 } | 189 } |
| 192 | 190 |
| 193 bool ThreadProxy::initializeRenderer() | 191 bool ThreadProxy::initializeRenderer() |
| 194 { | 192 { |
| 195 TRACE_EVENT0("cc", "ThreadProxy::initializeRenderer"); | 193 TRACE_EVENT0("cc", "ThreadProxy::initializeRenderer"); |
| 196 // Make a blocking call to initializeRendererOnImplThread. The results of th
at call | 194 // Make a blocking call to initializeRendererOnImplThread. The results of th
at call |
| 197 // are pushed into the initializeSucceeded and capabilities local variables. | 195 // are pushed into the initializeSucceeded and capabilities local variables. |
| 198 CompletionEvent completion; | 196 CompletionEvent completion; |
| 199 bool initializeSucceeded = false; | 197 bool initializeSucceeded = false; |
| 200 RendererCapabilities capabilities; | 198 RendererCapabilities capabilities; |
| 201 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 199 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 202 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::initializeRendererOnI
mplThread, | 200 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::initializeRendererOnI
mplThread, |
| 203 base::Unretained(this), | 201 base::Unretained(this), |
| 204 &completion, | 202 &completion, |
| 205 &initializeSucceeded, | 203 &initializeSucceeded, |
| 206 &capabilities)); | 204 &capabilities)); |
| 207 completion.wait(); | 205 completion.wait(); |
| 208 | 206 |
| 209 if (initializeSucceeded) { | 207 if (initializeSucceeded) { |
| 210 m_rendererInitialized = true; | 208 m_rendererInitialized = true; |
| 211 m_RendererCapabilitiesMainThreadCopy = capabilities; | 209 m_RendererCapabilitiesMainThreadCopy = capabilities; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 225 if (m_layerTreeHost->needsSharedContext()) | 223 if (m_layerTreeHost->needsSharedContext()) |
| 226 if (!WebSharedGraphicsContext3D::createCompositorThreadContext()) | 224 if (!WebSharedGraphicsContext3D::createCompositorThreadContext()) |
| 227 return false; | 225 return false; |
| 228 | 226 |
| 229 // Make a blocking call to recreateContextOnImplThread. The results of that | 227 // Make a blocking call to recreateContextOnImplThread. The results of that |
| 230 // call are pushed into the recreateSucceeded and capabilities local | 228 // call are pushed into the recreateSucceeded and capabilities local |
| 231 // variables. | 229 // variables. |
| 232 CompletionEvent completion; | 230 CompletionEvent completion; |
| 233 bool recreateSucceeded = false; | 231 bool recreateSucceeded = false; |
| 234 RendererCapabilities capabilities; | 232 RendererCapabilities capabilities; |
| 235 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 233 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 236 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::recreateContextOnImpl
Thread, | 234 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::recreateContextOnImpl
Thread, |
| 237 base::Unretained(this), | 235 base::Unretained(this), |
| 238 &completion, | 236 &completion, |
| 239 base::Passed(context.Pass()), | 237 base::Passed(context.Pass()), |
| 240 &recreateSucceeded, | 238 &recreateSucceeded, |
| 241 &capabilities)); | 239 &capabilities)); |
| 242 completion.wait(); | 240 completion.wait(); |
| 243 | 241 |
| 244 if (recreateSucceeded) | 242 if (recreateSucceeded) |
| 245 m_RendererCapabilitiesMainThreadCopy = capabilities; | 243 m_RendererCapabilitiesMainThreadCopy = capabilities; |
| 246 return recreateSucceeded; | 244 return recreateSucceeded; |
| 247 } | 245 } |
| 248 | 246 |
| 249 void ThreadProxy::renderingStats(RenderingStats* stats) | 247 void ThreadProxy::renderingStats(RenderingStats* stats) |
| 250 { | 248 { |
| 251 DCHECK(isMainThread()); | 249 DCHECK(isMainThread()); |
| 252 | 250 |
| 253 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 251 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 254 CompletionEvent completion; | 252 CompletionEvent completion; |
| 255 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::renderingStatsOnImplT
hread, | 253 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::renderingStatsOnImplT
hread, |
| 256 base::Unretained(this), &completio
n, stats)); | 254 base::Unretained(this), &completio
n, stats)); |
| 257 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); | 255 stats->totalCommitTimeInSeconds = m_totalCommitTime.InSecondsF(); |
| 258 stats->totalCommitCount = m_totalCommitCount; | 256 stats->totalCommitCount = m_totalCommitCount; |
| 259 | 257 |
| 260 completion.wait(); | 258 completion.wait(); |
| 261 } | 259 } |
| 262 | 260 |
| 263 const RendererCapabilities& ThreadProxy::rendererCapabilities() const | 261 const RendererCapabilities& ThreadProxy::rendererCapabilities() const |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 DCHECK(isImplThread()); | 421 DCHECK(isImplThread()); |
| 424 TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedrawOnImplThread"); | 422 TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedrawOnImplThread"); |
| 425 m_schedulerOnImplThread->setNeedsRedraw(); | 423 m_schedulerOnImplThread->setNeedsRedraw(); |
| 426 } | 424 } |
| 427 | 425 |
| 428 void ThreadProxy::start() | 426 void ThreadProxy::start() |
| 429 { | 427 { |
| 430 DCHECK(isMainThread()); | 428 DCHECK(isMainThread()); |
| 431 DCHECK(Proxy::implThread()); | 429 DCHECK(Proxy::implThread()); |
| 432 // Create LayerTreeHostImpl. | 430 // Create LayerTreeHostImpl. |
| 433 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 431 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 434 CompletionEvent completion; | 432 CompletionEvent completion; |
| 435 scoped_ptr<InputHandler> handler = m_layerTreeHost->createInputHandler(); | 433 scoped_ptr<InputHandler> handler = m_layerTreeHost->createInputHandler(); |
| 436 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::initializeImplOnImplT
hread, base::Unretained(this), &completion, handler.release())); | 434 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::initializeImplOnImplT
hread, base::Unretained(this), &completion, handler.release())); |
| 437 completion.wait(); | 435 completion.wait(); |
| 438 | 436 |
| 439 m_started = true; | 437 m_started = true; |
| 440 } | 438 } |
| 441 | 439 |
| 442 void ThreadProxy::stop() | 440 void ThreadProxy::stop() |
| 443 { | 441 { |
| 444 TRACE_EVENT0("cc", "ThreadProxy::stop"); | 442 TRACE_EVENT0("cc", "ThreadProxy::stop"); |
| 445 DCHECK(isMainThread()); | 443 DCHECK(isMainThread()); |
| 446 DCHECK(m_started); | 444 DCHECK(m_started); |
| 447 | 445 |
| 448 // Synchronously deletes the impl. | 446 // Synchronously deletes the impl. |
| 449 { | 447 { |
| 450 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 448 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 451 | 449 |
| 452 CompletionEvent completion; | 450 CompletionEvent completion; |
| 453 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::layerTreeHostClos
edOnImplThread, base::Unretained(this), &completion)); | 451 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::layerTreeHostClos
edOnImplThread, base::Unretained(this), &completion)); |
| 454 completion.wait(); | 452 completion.wait(); |
| 455 } | 453 } |
| 456 | 454 |
| 457 m_mainThreadProxy->shutdown(); // Stop running tasks posted to us. | 455 m_mainThreadProxy->shutdown(); // Stop running tasks posted to us. |
| 458 | 456 |
| 459 DCHECK(!m_layerTreeHostImpl.get()); // verify that the impl deleted. | 457 DCHECK(!m_layerTreeHostImpl.get()); // verify that the impl deleted. |
| 460 m_layerTreeHost = 0; | 458 m_layerTreeHost = 0; |
| 461 m_started = false; | 459 m_started = false; |
| 462 } | 460 } |
| 463 | 461 |
| 464 void ThreadProxy::forceSerializeOnSwapBuffers() | 462 void ThreadProxy::forceSerializeOnSwapBuffers() |
| 465 { | 463 { |
| 466 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 464 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 467 CompletionEvent completion; | 465 CompletionEvent completion; |
| 468 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::forceSerializeOnSwapB
uffersOnImplThread, base::Unretained(this), &completion)); | 466 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::forceSerializeOnSwapB
uffersOnImplThread, base::Unretained(this), &completion)); |
| 469 completion.wait(); | 467 completion.wait(); |
| 470 } | 468 } |
| 471 | 469 |
| 472 void ThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CompletionEvent* compl
etion) | 470 void ThreadProxy::forceSerializeOnSwapBuffersOnImplThread(CompletionEvent* compl
etion) |
| 473 { | 471 { |
| 474 if (m_rendererInitialized) | 472 if (m_rendererInitialized) |
| 475 m_layerTreeHostImpl->renderer()->doNoOp(); | 473 m_layerTreeHostImpl->renderer()->doNoOp(); |
| 476 completion->signal(); | 474 completion->signal(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 setNeedsAnimate(); | 607 setNeedsAnimate(); |
| 610 } | 608 } |
| 611 | 609 |
| 612 // Notify the impl thread that the beginFrame has completed. This will | 610 // Notify the impl thread that the beginFrame has completed. This will |
| 613 // begin the commit process, which is blocking from the main thread's | 611 // begin the commit process, which is blocking from the main thread's |
| 614 // point of view, but asynchronously performed on the impl thread, | 612 // point of view, but asynchronously performed on the impl thread, |
| 615 // coordinated by the Scheduler. | 613 // coordinated by the Scheduler. |
| 616 { | 614 { |
| 617 TRACE_EVENT0("cc", "commit"); | 615 TRACE_EVENT0("cc", "commit"); |
| 618 | 616 |
| 619 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 617 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 620 | 618 |
| 621 base::TimeTicks startTime = base::TimeTicks::HighResNow(); | 619 base::TimeTicks startTime = base::TimeTicks::HighResNow(); |
| 622 CompletionEvent completion; | 620 CompletionEvent completion; |
| 623 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::beginFrameComplet
eOnImplThread, base::Unretained(this), &completion, queue.release())); | 621 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::beginFrameComplet
eOnImplThread, base::Unretained(this), &completion, queue.release())); |
| 624 completion.wait(); | 622 completion.wait(); |
| 625 base::TimeTicks endTime = base::TimeTicks::HighResNow(); | 623 base::TimeTicks endTime = base::TimeTicks::HighResNow(); |
| 626 | 624 |
| 627 m_totalCommitTime += endTime - startTime; | 625 m_totalCommitTime += endTime - startTime; |
| 628 m_totalCommitCount++; | 626 m_totalCommitCount++; |
| 629 } | 627 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 652 // Clear any uploads we were making to textures linked to evicted | 650 // Clear any uploads we were making to textures linked to evicted |
| 653 // resources | 651 // resources |
| 654 queue->clearUploadsToEvictedResources(); | 652 queue->clearUploadsToEvictedResources(); |
| 655 // Some textures in the layer tree are invalid. Kick off another commit | 653 // Some textures in the layer tree are invalid. Kick off another commit |
| 656 // to fill them again. | 654 // to fill them again. |
| 657 setNeedsCommitOnImplThread(); | 655 setNeedsCommitOnImplThread(); |
| 658 } | 656 } |
| 659 | 657 |
| 660 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackings()
; | 658 m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackings()
; |
| 661 | 659 |
| 662 m_currentResourceUpdateControllerOnImplThread = ResourceUpdateController::cr
eate(this, Proxy::implThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvi
der(), hasImplThread()); | 660 m_currentResourceUpdateControllerOnImplThread = ResourceUpdateController::cr
eate(this, Proxy::implThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvi
der()); |
| 663 ResourceProvider::debugNotifyEnterZone(0x2000000); | 661 ResourceProvider::debugNotifyEnterZone(0x2000000); |
| 664 m_currentResourceUpdateControllerOnImplThread->performMoreUpdates( | 662 m_currentResourceUpdateControllerOnImplThread->performMoreUpdates( |
| 665 m_schedulerOnImplThread->anticipatedDrawTime()); | 663 m_schedulerOnImplThread->anticipatedDrawTime()); |
| 666 ResourceProvider::debugNotifyLeaveZone(); | 664 ResourceProvider::debugNotifyLeaveZone(); |
| 667 | 665 |
| 668 m_commitCompletionEventOnImplThread = completion; | 666 m_commitCompletionEventOnImplThread = completion; |
| 669 } | 667 } |
| 670 | 668 |
| 671 void ThreadProxy::beginFrameAbortedOnImplThread() | 669 void ThreadProxy::beginFrameAbortedOnImplThread() |
| 672 { | 670 { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 // directly by the compositor. | 788 // directly by the compositor. |
| 791 // This method will block until the next compositor draw if there is a | 789 // This method will block until the next compositor draw if there is a |
| 792 // previously committed frame that is still undrawn. This is necessary to | 790 // previously committed frame that is still undrawn. This is necessary to |
| 793 // ensure that the main thread does not monopolize access to the textures. | 791 // ensure that the main thread does not monopolize access to the textures. |
| 794 DCHECK(isMainThread()); | 792 DCHECK(isMainThread()); |
| 795 | 793 |
| 796 if (m_texturesAcquired) | 794 if (m_texturesAcquired) |
| 797 return; | 795 return; |
| 798 | 796 |
| 799 TRACE_EVENT0("cc", "ThreadProxy::acquireLayerTextures"); | 797 TRACE_EVENT0("cc", "ThreadProxy::acquireLayerTextures"); |
| 800 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); | 798 DebugScopedSetMainThreadBlocked mainThreadBlocked; |
| 801 CompletionEvent completion; | 799 CompletionEvent completion; |
| 802 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::acquireLayerTexturesF
orMainThreadOnImplThread, base::Unretained(this), &completion)); | 800 Proxy::implThread()->postTask(base::Bind(&ThreadProxy::acquireLayerTexturesF
orMainThreadOnImplThread, base::Unretained(this), &completion)); |
| 803 completion.wait(); // Block until it is safe to write to layer textures from
the main thread. | 801 completion.wait(); // Block until it is safe to write to layer textures from
the main thread. |
| 804 | 802 |
| 805 m_texturesAcquired = true; | 803 m_texturesAcquired = true; |
| 806 } | 804 } |
| 807 | 805 |
| 808 void ThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CompletionEvent*
completion) | 806 void ThreadProxy::acquireLayerTexturesForMainThreadOnImplThread(CompletionEvent*
completion) |
| 809 { | 807 { |
| 810 DCHECK(isImplThread()); | 808 DCHECK(isImplThread()); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 | 981 |
| 984 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() | 982 ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() |
| 985 { | 983 { |
| 986 } | 984 } |
| 987 | 985 |
| 988 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() | 986 ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() |
| 989 { | 987 { |
| 990 } | 988 } |
| 991 | 989 |
| 992 } // namespace cc | 990 } // namespace cc |
| OLD | NEW |