Index: cc/thread_proxy.cc |
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc |
index ee08f77cb3be14c3c6a6506e27944f14a1ccc0c1..2f419b27ebd50c715d95b8f17187b20b63ae7750 100644 |
--- a/cc/thread_proxy.cc |
+++ b/cc/thread_proxy.cc |
@@ -15,6 +15,7 @@ |
#include "cc/layer_tree_host.h" |
#include "cc/scheduler.h" |
#include "cc/scoped_thread_proxy.h" |
+#include "cc/thread.h" |
#include "cc/thread_task.h" |
#include <public/WebSharedGraphicsContext3D.h> |
#include <wtf/CurrentTime.h> |
@@ -30,13 +31,14 @@ const double contextRecreationTickRate = 0.03; |
namespace cc { |
-scoped_ptr<Proxy> ThreadProxy::create(LayerTreeHost* layerTreeHost) |
+scoped_ptr<Proxy> ThreadProxy::create(LayerTreeHost* layerTreeHost, Thread* implThread) |
{ |
- return make_scoped_ptr(new ThreadProxy(layerTreeHost)).PassAs<Proxy>(); |
+ return make_scoped_ptr(new ThreadProxy(layerTreeHost, implThread)).PassAs<Proxy>(); |
} |
-ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost) |
- : m_animateRequested(false) |
+ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost, Thread* implThread) |
+ : Proxy(implThread) |
+ , m_animateRequested(false) |
, m_commitRequested(false) |
, m_commitRequestSentToImplThread(false) |
, m_forcedCommitRequested(false) |
@@ -79,7 +81,7 @@ bool ThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) |
// Perform a synchronous commit. |
{ |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
CompletionEvent beginFrameCompletion; |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::forceBeginFrameOnImplThread, &beginFrameCompletion)); |
beginFrameCompletion.wait(); |
@@ -93,7 +95,7 @@ bool ThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) |
request.rect = rect; |
request.pixels = pixels; |
{ |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::requestReadbackOnImplThread, &request)); |
request.completion.wait(); |
} |
@@ -133,7 +135,7 @@ void ThreadProxy::finishAllRendering() |
DCHECK(Proxy::isMainThread()); |
// Make sure all GL drawing is finished on the impl thread. |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
CompletionEvent completion; |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::finishAllRenderingOnImplThread, &completion)); |
completion.wait(); |
@@ -172,7 +174,7 @@ void ThreadProxy::setSurfaceReadyOnImplThread() |
void ThreadProxy::setVisible(bool visible) |
{ |
TRACE_EVENT0("cc", "ThreadProxy::setVisible"); |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
CompletionEvent completion; |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::setVisibleOnImplThread, &completion, visible)); |
completion.wait(); |
@@ -194,7 +196,7 @@ bool ThreadProxy::initializeRenderer() |
CompletionEvent completion; |
bool initializeSucceeded = false; |
RendererCapabilities capabilities; |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::initializeRendererOnImplThread, |
&completion, |
&initializeSucceeded, |
@@ -227,7 +229,7 @@ bool ThreadProxy::recreateContext() |
CompletionEvent completion; |
bool recreateSucceeded = false; |
RendererCapabilities capabilities; |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::recreateContextOnImplThread, |
&completion, |
context.release(), |
@@ -244,7 +246,7 @@ void ThreadProxy::renderingStats(RenderingStats* stats) |
{ |
DCHECK(isMainThread()); |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
CompletionEvent completion; |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::renderingStatsOnImplThread, |
&completion, |
@@ -391,7 +393,7 @@ void ThreadProxy::start() |
DCHECK(isMainThread()); |
DCHECK(Proxy::implThread()); |
// Create LayerTreeHostImpl. |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
CompletionEvent completion; |
scoped_ptr<InputHandler> handler = m_layerTreeHost->createInputHandler(); |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::initializeImplOnImplThread, &completion, handler.release())); |
@@ -408,7 +410,7 @@ void ThreadProxy::stop() |
// Synchronously deletes the impl. |
{ |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
CompletionEvent completion; |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::layerTreeHostClosedOnImplThread, &completion)); |
@@ -424,7 +426,7 @@ void ThreadProxy::stop() |
void ThreadProxy::forceSerializeOnSwapBuffers() |
{ |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
CompletionEvent completion; |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::forceSerializeOnSwapBuffersOnImplThread, &completion)); |
completion.wait(); |
@@ -570,7 +572,7 @@ void ThreadProxy::beginFrame() |
{ |
TRACE_EVENT0("cc", "commit"); |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
base::TimeTicks startTime = base::TimeTicks::HighResNow(); |
CompletionEvent completion; |
@@ -613,7 +615,7 @@ void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, Te |
m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackings(); |
- m_currentTextureUpdateControllerOnImplThread = TextureUpdateController::create(this, Proxy::implThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider()); |
+ m_currentTextureUpdateControllerOnImplThread = TextureUpdateController::create(this, Proxy::implThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider(), hasImplThread()); |
m_currentTextureUpdateControllerOnImplThread->performMoreUpdates( |
m_schedulerOnImplThread->anticipatedDrawTime()); |
@@ -745,7 +747,7 @@ void ThreadProxy::acquireLayerTextures() |
return; |
TRACE_EVENT0("cc", "ThreadProxy::acquireLayerTextures"); |
- DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ DebugScopedSetMainThreadBlocked mainThreadBlocked(this); |
CompletionEvent completion; |
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::acquireLayerTexturesForMainThreadOnImplThread, &completion)); |
completion.wait(); // Block until it is safe to write to layer textures from the main thread. |
@@ -831,7 +833,7 @@ public: |
private: |
explicit ThreadProxyContextRecreationTimer(ThreadProxy* proxy) |
- : Timer(Proxy::mainThread(), this) |
+ : Timer(proxy->mainThread(), this) |
, m_proxy(proxy) |
{ |
} |