| Index: cc/trees/layer_tree_host.cc
|
| diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
|
| index 8312165c1165b6ae8bd1271e106eed1d0f3c04f2..74dc211045a01d8f229ce22cd0ab28ab45af6cb1 100644
|
| --- a/cc/trees/layer_tree_host.cc
|
| +++ b/cc/trees/layer_tree_host.cc
|
| @@ -137,9 +137,9 @@ void LayerTreeHost::InitializeThreaded(
|
| scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
|
| scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
|
| scoped_ptr<BeginFrameSource> external_begin_frame_source) {
|
| - InitializeProxy(ThreadProxy::Create(this,
|
| - main_task_runner,
|
| - impl_task_runner,
|
| + task_runner_provider_ =
|
| + TaskRunnerProvider::Create(main_task_runner, impl_task_runner);
|
| + InitializeProxy(ThreadProxy::Create(this, task_runner_provider_.get(),
|
| external_begin_frame_source.Pass()));
|
| }
|
|
|
| @@ -147,14 +147,16 @@ void LayerTreeHost::InitializeSingleThreaded(
|
| LayerTreeHostSingleThreadClient* single_thread_client,
|
| scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
|
| scoped_ptr<BeginFrameSource> external_begin_frame_source) {
|
| - InitializeProxy(
|
| - SingleThreadProxy::Create(this,
|
| - single_thread_client,
|
| - main_task_runner,
|
| - external_begin_frame_source.Pass()));
|
| + task_runner_provider_ = TaskRunnerProvider::Create(main_task_runner, nullptr);
|
| + InitializeProxy(SingleThreadProxy::Create(
|
| + this, single_thread_client, task_runner_provider_.get(),
|
| + external_begin_frame_source.Pass()));
|
| }
|
|
|
| -void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
|
| +void LayerTreeHost::InitializeForTesting(
|
| + scoped_ptr<TaskRunnerProvider> task_runner_provider,
|
| + scoped_ptr<Proxy> proxy_for_testing) {
|
| + task_runner_provider_ = task_runner_provider.Pass();
|
| InitializeProxy(proxy_for_testing.Pass());
|
| }
|
|
|
| @@ -187,8 +189,11 @@ LayerTreeHost::~LayerTreeHost() {
|
| BreakSwapPromises(SwapPromise::COMMIT_FAILS);
|
|
|
| if (proxy_) {
|
| - DCHECK(proxy_->IsMainThread());
|
| + DCHECK(task_runner_provider_->IsMainThread());
|
| proxy_->Stop();
|
| +
|
| + // Proxy must be destroyed before the Task Runner Provider.
|
| + proxy_ = nullptr;
|
| }
|
|
|
| // We must clear any pointers into the layer tree prior to destroying it.
|
| @@ -234,7 +239,7 @@ void LayerTreeHost::RequestMainFrameUpdate() {
|
| // should be delayed until the LayerTreeHost::CommitComplete, which will run
|
| // after the commit, but on the main thread.
|
| void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
|
| - DCHECK(proxy_->IsImplThread());
|
| + DCHECK(task_runner_provider_->IsImplThread());
|
|
|
| bool is_new_trace;
|
| TRACE_EVENT_IS_NEW_TRACE(&is_new_trace);
|
| @@ -419,11 +424,11 @@ void LayerTreeHost::DidFailToInitializeOutputSurface() {
|
|
|
| scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
|
| LayerTreeHostImplClient* client) {
|
| - DCHECK(proxy_->IsImplThread());
|
| + DCHECK(task_runner_provider_->IsImplThread());
|
| scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
|
| - settings_, client, proxy_.get(), rendering_stats_instrumentation_.get(),
|
| - shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_,
|
| - id_);
|
| + settings_, client, task_runner_provider_.get(),
|
| + rendering_stats_instrumentation_.get(), shared_bitmap_manager_,
|
| + gpu_memory_buffer_manager_, task_graph_runner_, id_);
|
| host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_);
|
| host_impl->SetContentIsSuitableForGpuRasterization(
|
| content_is_suitable_for_gpu_rasterization_);
|
| @@ -436,7 +441,7 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
|
|
|
| void LayerTreeHost::DidLoseOutputSurface() {
|
| TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface");
|
| - DCHECK(proxy_->IsMainThread());
|
| + DCHECK(task_runner_provider_->IsMainThread());
|
|
|
| if (output_surface_lost_)
|
| return;
|
| @@ -530,7 +535,7 @@ void LayerTreeHost::SetNextCommitForcesRedraw() {
|
|
|
| void LayerTreeHost::SetAnimationEvents(
|
| scoped_ptr<AnimationEventsVector> events) {
|
| - DCHECK(proxy_->IsMainThread());
|
| + DCHECK(task_runner_provider_->IsMainThread());
|
| if (animation_host_)
|
| animation_host_->SetAnimationEvents(events.Pass());
|
| else
|
| @@ -668,7 +673,7 @@ void LayerTreeHost::NotifyInputThrottledUntilCommit() {
|
| }
|
|
|
| void LayerTreeHost::LayoutAndUpdateLayers() {
|
| - DCHECK(!proxy_->HasImplThread());
|
| + DCHECK(!task_runner_provider_->HasImplThread());
|
| // This function is only valid when not using the scheduler.
|
| DCHECK(!settings_.single_thread_proxy_scheduler);
|
| SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get());
|
| @@ -686,7 +691,7 @@ void LayerTreeHost::LayoutAndUpdateLayers() {
|
| }
|
|
|
| void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) {
|
| - DCHECK(!proxy_->HasImplThread());
|
| + DCHECK(!task_runner_provider_->HasImplThread());
|
| // This function is only valid when not using the scheduler.
|
| DCHECK(!settings_.single_thread_proxy_scheduler);
|
| SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get());
|
| @@ -727,7 +732,8 @@ static Layer* FindFirstScrollableLayer(Layer* layer) {
|
| void LayerTreeHost::RecordGpuRasterizationHistogram() {
|
| // Gpu rasterization is only supported for Renderer compositors.
|
| // Checking for proxy_->HasImplThread() to exclude Browser compositors.
|
| - if (gpu_rasterization_histogram_recorded_ || !proxy_->HasImplThread())
|
| + if (gpu_rasterization_histogram_recorded_ ||
|
| + !task_runner_provider_->HasImplThread())
|
| return;
|
|
|
| // Record how widely gpu rasterization is enabled.
|
| @@ -895,7 +901,7 @@ void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints,
|
| TopControlsState current,
|
| bool animate) {
|
| // Top controls are only used in threaded mode.
|
| - DCHECK(proxy_->HasImplThread());
|
| + DCHECK(task_runner_provider_->HasImplThread());
|
| proxy_->UpdateTopControlsState(constraints, current, animate);
|
| }
|
|
|
|
|