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