| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/trees/proxy_main.h" | 5 #include "cc/trees/proxy_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 11 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
| 12 #include "base/trace_event/trace_event_synthetic_delay.h" | 12 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 13 #include "cc/debug/benchmark_instrumentation.h" | 13 #include "cc/debug/benchmark_instrumentation.h" |
| 14 #include "cc/debug/devtools_instrumentation.h" | 14 #include "cc/debug/devtools_instrumentation.h" |
| 15 #include "cc/output/output_surface.h" | 15 #include "cc/output/output_surface.h" |
| 16 #include "cc/output/swap_promise.h" | 16 #include "cc/output/swap_promise.h" |
| 17 #include "cc/trees/blocking_task_runner.h" | 17 #include "cc/trees/blocking_task_runner.h" |
| 18 #include "cc/trees/layer_tree_host.h" | 18 #include "cc/trees/layer_tree_host.h" |
| 19 #include "cc/trees/remote_channel_main.h" |
| 19 #include "cc/trees/scoped_abort_remaining_swap_promises.h" | 20 #include "cc/trees/scoped_abort_remaining_swap_promises.h" |
| 20 #include "cc/trees/threaded_channel.h" | 21 #include "cc/trees/threaded_channel.h" |
| 21 | 22 |
| 22 namespace cc { | 23 namespace cc { |
| 23 | 24 |
| 24 scoped_ptr<ProxyMain> ProxyMain::CreateThreaded( | 25 scoped_ptr<ProxyMain> ProxyMain::CreateThreaded( |
| 25 LayerTreeHost* layer_tree_host, | 26 LayerTreeHost* layer_tree_host, |
| 26 TaskRunnerProvider* task_runner_provider) { | 27 TaskRunnerProvider* task_runner_provider) { |
| 27 scoped_ptr<ProxyMain> proxy_main( | 28 scoped_ptr<ProxyMain> proxy_main( |
| 28 new ProxyMain(layer_tree_host, task_runner_provider)); | 29 new ProxyMain(layer_tree_host, task_runner_provider)); |
| 29 proxy_main->SetChannel( | 30 proxy_main->SetChannel( |
| 30 ThreadedChannel::Create(proxy_main.get(), task_runner_provider)); | 31 ThreadedChannel::Create(proxy_main.get(), task_runner_provider)); |
| 31 return proxy_main; | 32 return proxy_main; |
| 32 } | 33 } |
| 33 | 34 |
| 35 scoped_ptr<ProxyMain> ProxyMain::CreateRemote( |
| 36 RemoteProtoChannel* remote_proto_channel, |
| 37 LayerTreeHost* layer_tree_host, |
| 38 TaskRunnerProvider* task_runner_provider) { |
| 39 scoped_ptr<ProxyMain> proxy_main( |
| 40 new ProxyMain(layer_tree_host, task_runner_provider)); |
| 41 proxy_main->SetChannel(RemoteChannelMain::Create( |
| 42 remote_proto_channel, proxy_main.get(), task_runner_provider)); |
| 43 return proxy_main; |
| 44 } |
| 45 |
| 34 ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host, | 46 ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host, |
| 35 TaskRunnerProvider* task_runner_provider) | 47 TaskRunnerProvider* task_runner_provider) |
| 36 : layer_tree_host_(layer_tree_host), | 48 : layer_tree_host_(layer_tree_host), |
| 37 task_runner_provider_(task_runner_provider), | 49 task_runner_provider_(task_runner_provider), |
| 38 layer_tree_host_id_(layer_tree_host->id()), | 50 layer_tree_host_id_(layer_tree_host->id()), |
| 39 max_requested_pipeline_stage_(NO_PIPELINE_STAGE), | 51 max_requested_pipeline_stage_(NO_PIPELINE_STAGE), |
| 40 current_pipeline_stage_(NO_PIPELINE_STAGE), | 52 current_pipeline_stage_(NO_PIPELINE_STAGE), |
| 41 final_pipeline_stage_(NO_PIPELINE_STAGE), | 53 final_pipeline_stage_(NO_PIPELINE_STAGE), |
| 42 commit_waits_for_activation_(false), | 54 commit_waits_for_activation_(false), |
| 43 started_(false), | 55 started_(false), |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 382 } |
| 371 | 383 |
| 372 void ProxyMain::MainThreadHasStoppedFlinging() { | 384 void ProxyMain::MainThreadHasStoppedFlinging() { |
| 373 DCHECK(IsMainThread()); | 385 DCHECK(IsMainThread()); |
| 374 channel_main_->MainThreadHasStoppedFlingingOnImpl(); | 386 channel_main_->MainThreadHasStoppedFlingingOnImpl(); |
| 375 } | 387 } |
| 376 | 388 |
| 377 void ProxyMain::Start( | 389 void ProxyMain::Start( |
| 378 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 390 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 379 DCHECK(IsMainThread()); | 391 DCHECK(IsMainThread()); |
| 380 DCHECK(task_runner_provider_->HasImplThread()); | |
| 381 DCHECK(channel_main_); | 392 DCHECK(channel_main_); |
| 382 DCHECK(!layer_tree_host_->settings().use_external_begin_frame_source || | 393 DCHECK(!layer_tree_host_->settings().use_external_begin_frame_source || |
| 383 external_begin_frame_source); | 394 external_begin_frame_source); |
| 384 | 395 |
| 385 // Create LayerTreeHostImpl. | 396 // Create LayerTreeHostImpl. |
| 386 channel_main_->SynchronouslyInitializeImpl( | 397 channel_main_->SynchronouslyInitializeImpl( |
| 387 layer_tree_host_, std::move(external_begin_frame_source)); | 398 layer_tree_host_, std::move(external_begin_frame_source)); |
| 388 | 399 |
| 389 started_ = true; | 400 started_ = true; |
| 390 } | 401 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 return false; | 464 return false; |
| 454 channel_main_->SetNeedsCommitOnImpl(); | 465 channel_main_->SetNeedsCommitOnImpl(); |
| 455 return true; | 466 return true; |
| 456 } | 467 } |
| 457 | 468 |
| 458 bool ProxyMain::IsMainThread() const { | 469 bool ProxyMain::IsMainThread() const { |
| 459 return task_runner_provider_->IsMainThread(); | 470 return task_runner_provider_->IsMainThread(); |
| 460 } | 471 } |
| 461 | 472 |
| 462 } // namespace cc | 473 } // namespace cc |
| OLD | NEW |