Index: cc/layer_tree_host.cc |
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc |
index ebc998ed856ed26077d979a67eb4c0e403b75039..41ae9b724ae9e75fcfb684d77716f6bb0c8b1ae6 100644 |
--- a/cc/layer_tree_host.cc |
+++ b/cc/layer_tree_host.cc |
@@ -82,10 +82,10 @@ bool LayerTreeHost::anyLayerTreeHostInstanceExists() |
return numLayerTreeInstances > 0; |
} |
-scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, const LayerTreeSettings& settings) |
+scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, const LayerTreeSettings& settings, Thread* implThread) |
{ |
scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings)); |
- if (!layerTreeHost->initialize()) |
+ if (!layerTreeHost->initialize(implThread)) |
return scoped_ptr<LayerTreeHost>(); |
return layerTreeHost.Pass(); |
} |
@@ -111,16 +111,15 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting |
, m_hasTransparentBackground(false) |
, m_partialTextureUpdateRequests(0) |
{ |
- DCHECK(Proxy::isMainThread()); |
numLayerTreeInstances++; |
} |
-bool LayerTreeHost::initialize() |
+bool LayerTreeHost::initialize(Thread* implThread) |
{ |
TRACE_EVENT0("cc", "LayerTreeHost::initialize"); |
- if (Proxy::hasImplThread()) |
- m_proxy = ThreadProxy::create(this); |
+ if (implThread) |
+ m_proxy = ThreadProxy::create(this, implThread); |
else |
m_proxy = SingleThreadProxy::create(this); |
m_proxy->start(); |
@@ -132,11 +131,10 @@ LayerTreeHost::~LayerTreeHost() |
{ |
if (m_rootLayer) |
m_rootLayer->setLayerTreeHost(0); |
- DCHECK(Proxy::isMainThread()); |
- TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
DCHECK(m_proxy.get()); |
+ DCHECK(m_proxy->isMainThread()); |
+ TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
m_proxy->stop(); |
- m_proxy.reset(); |
numLayerTreeInstances--; |
RateLimiterMap::iterator it = m_rateLimiters.begin(); |
if (it != m_rateLimiters.end()) |
@@ -163,7 +161,7 @@ void LayerTreeHost::initializeRenderer() |
// Update m_settings based on partial update capability. |
m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); |
- m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, Renderer::ContentPool); |
+ m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, Renderer::ContentPool, m_proxy.get()); |
m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GL_RGBA); |
m_rendererInitialized = true; |
@@ -198,7 +196,7 @@ LayerTreeHost::RecreateResult LayerTreeHost::recreateContext() |
// FIXME: The single thread does not self-schedule context |
// recreation. So force another recreation attempt to happen by requesting |
// another commit. |
- if (!Proxy::hasImplThread()) |
+ if (!m_proxy->hasImplThread()) |
setNeedsCommit(); |
return RecreateFailedButTryAgain; |
} |
@@ -211,14 +209,14 @@ LayerTreeHost::RecreateResult LayerTreeHost::recreateContext() |
void LayerTreeHost::deleteContentsTexturesOnImplThread(ResourceProvider* resourceProvider) |
{ |
- DCHECK(Proxy::isImplThread()); |
+ DCHECK(m_proxy->isImplThread()); |
if (m_rendererInitialized) |
m_contentsTextureManager->clearAllMemory(resourceProvider); |
} |
void LayerTreeHost::acquireLayerTextures() |
{ |
- DCHECK(Proxy::isMainThread()); |
+ DCHECK(m_proxy->isMainThread()); |
m_proxy->acquireLayerTextures(); |
} |
@@ -239,7 +237,7 @@ void LayerTreeHost::layout() |
void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl) |
{ |
- DCHECK(Proxy::isImplThread()); |
+ DCHECK(m_proxy->isImplThread()); |
TRACE_EVENT0("cc", "LayerTreeHost::commitTo"); |
} |
@@ -250,7 +248,7 @@ void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl) |
// after the commit, but on the main thread. |
void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) |
{ |
- DCHECK(Proxy::isImplThread()); |
+ DCHECK(m_proxy->isImplThread()); |
m_contentsTextureManager->updateBackingsInDrawingImplTree(); |
m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); |
@@ -316,13 +314,13 @@ scoped_ptr<InputHandler> LayerTreeHost::createInputHandler() |
scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHostImplClient* client) |
{ |
- return LayerTreeHostImpl::create(m_settings, client); |
+ return LayerTreeHostImpl::create(m_settings, client, m_proxy.get()); |
} |
void LayerTreeHost::didLoseContext() |
{ |
TRACE_EVENT0("cc", "LayerTreeHost::didLoseContext"); |
- DCHECK(Proxy::isMainThread()); |
+ DCHECK(m_proxy->isMainThread()); |
m_contextLost = true; |
m_numFailedRecreateAttempts = 0; |
setNeedsCommit(); |
@@ -356,7 +354,7 @@ const RendererCapabilities& LayerTreeHost::rendererCapabilities() const |
void LayerTreeHost::setNeedsAnimate() |
{ |
- DCHECK(Proxy::hasImplThread()); |
+ DCHECK(m_proxy->hasImplThread()); |
m_proxy->setNeedsAnimate(); |
} |
@@ -368,7 +366,7 @@ void LayerTreeHost::setNeedsCommit() |
void LayerTreeHost::setNeedsRedraw() |
{ |
m_proxy->setNeedsRedraw(); |
- if (!ThreadProxy::implThread()) |
+ if (!m_proxy->implThread()) |
m_client->scheduleComposite(); |
} |
@@ -379,7 +377,7 @@ bool LayerTreeHost::commitRequested() const |
void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, double wallClockTime) |
{ |
- DCHECK(ThreadProxy::isMainThread()); |
+ DCHECK(m_proxy->isMainThread()); |
setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime); |
} |
@@ -455,7 +453,7 @@ PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const |
void LayerTreeHost::composite() |
{ |
- DCHECK(!ThreadProxy::implThread()); |
+ DCHECK(!m_proxy->implThread()); |
static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately(); |
} |
@@ -725,7 +723,7 @@ void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) |
if (it != m_rateLimiters.end()) |
it->second->start(); |
else { |
- scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, this); |
+ scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, this, m_proxy.get()); |
m_rateLimiters[context] = rateLimiter; |
rateLimiter->start(); |
} |