| Index: cc/layer_tree_host.cc
|
| diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
|
| index f9eae126e9dcb9482065e4c413978826b2ecd0b2..22676d9c3f4cfca1f94b082161a9bff2486c8560 100644
|
| --- a/cc/layer_tree_host.cc
|
| +++ b/cc/layer_tree_host.cc
|
| @@ -24,6 +24,7 @@
|
| #include "cc/overdraw_metrics.h"
|
| #include "cc/settings.h"
|
| #include "cc/single_thread_proxy.h"
|
| +#include "cc/thread.h"
|
| #include "cc/thread_proxy.h"
|
| #include "cc/tree_synchronizer.h"
|
|
|
| @@ -83,10 +84,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, scoped_ptr<Thread> implThread)
|
| {
|
| scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings));
|
| - if (!layerTreeHost->initialize())
|
| + if (!layerTreeHost->initialize(implThread.Pass()))
|
| return scoped_ptr<LayerTreeHost>();
|
| return layerTreeHost.Pass();
|
| }
|
| @@ -112,16 +113,15 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
|
| , m_hasTransparentBackground(false)
|
| , m_partialTextureUpdateRequests(0)
|
| {
|
| - DCHECK(Proxy::isMainThread());
|
| numLayerTreeInstances++;
|
| }
|
|
|
| -bool LayerTreeHost::initialize()
|
| +bool LayerTreeHost::initialize(scoped_ptr<Thread> implThread)
|
| {
|
| TRACE_EVENT0("cc", "LayerTreeHost::initialize");
|
|
|
| - if (Proxy::hasImplThread())
|
| - m_proxy = ThreadProxy::create(this);
|
| + if (implThread)
|
| + m_proxy = ThreadProxy::create(this, implThread.Pass());
|
| else
|
| m_proxy = SingleThreadProxy::create(this);
|
| m_proxy->start();
|
| @@ -133,11 +133,10 @@ LayerTreeHost::~LayerTreeHost()
|
| {
|
| if (m_rootLayer)
|
| m_rootLayer->setLayerTreeHost(0);
|
| - DCHECK(Proxy::isMainThread());
|
| + DCHECK(m_proxy);
|
| + DCHECK(m_proxy->isMainThread());
|
| TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost");
|
| - DCHECK(m_proxy.get());
|
| m_proxy->stop();
|
| - m_proxy.reset();
|
| numLayerTreeInstances--;
|
| RateLimiterMap::iterator it = m_rateLimiters.begin();
|
| if (it != m_rateLimiters.end())
|
| @@ -164,7 +163,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(gfx::Size(), GL_RGBA);
|
|
|
| m_rendererInitialized = true;
|
| @@ -199,7 +198,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;
|
| }
|
| @@ -212,14 +211,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();
|
| }
|
|
|
| @@ -240,7 +239,7 @@ void LayerTreeHost::layout()
|
|
|
| void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl)
|
| {
|
| - DCHECK(Proxy::isImplThread());
|
| + DCHECK(m_proxy->isImplThread());
|
| TRACE_EVENT0("cc", "LayerTreeHost::commitTo");
|
| }
|
|
|
| @@ -251,7 +250,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();
|
| ResourceProvider::debugNotifyEnterZone(0xA000000);
|
| @@ -318,13 +317,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();
|
| @@ -367,7 +366,7 @@ const RendererCapabilities& LayerTreeHost::rendererCapabilities() const
|
|
|
| void LayerTreeHost::setNeedsAnimate()
|
| {
|
| - DCHECK(Proxy::hasImplThread());
|
| + DCHECK(m_proxy->hasImplThread());
|
| m_proxy->setNeedsAnimate();
|
| }
|
|
|
| @@ -383,7 +382,7 @@ void LayerTreeHost::setNeedsCommit()
|
| void LayerTreeHost::setNeedsRedraw()
|
| {
|
| m_proxy->setNeedsRedraw();
|
| - if (!ThreadProxy::implThread())
|
| + if (!m_proxy->implThread())
|
| m_client->scheduleComposite();
|
| }
|
|
|
| @@ -394,7 +393,7 @@ bool LayerTreeHost::commitRequested() const
|
|
|
| void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, base::Time wallClockTime)
|
| {
|
| - DCHECK(ThreadProxy::isMainThread());
|
| + DCHECK(m_proxy->isMainThread());
|
| setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime);
|
| }
|
|
|
| @@ -470,7 +469,7 @@ PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const
|
|
|
| void LayerTreeHost::composite()
|
| {
|
| - DCHECK(!ThreadProxy::implThread());
|
| + DCHECK(!m_proxy->implThread());
|
| static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately();
|
| }
|
|
|
| @@ -745,7 +744,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->mainThread());
|
| m_rateLimiters[context] = rateLimiter;
|
| rateLimiter->start();
|
| }
|
|
|