Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: cc/trees/proxy_main.cc

Issue 1513643010: cc:: Add remote mode to the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use LayerTreeSettings::ToProtobuf, update comments. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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<BeginFrameSource> external_begin_frame_source) { 28 scoped_ptr<BeginFrameSource> external_begin_frame_source) {
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 std::move(external_begin_frame_source))); 31 std::move(external_begin_frame_source)));
31 proxy_main->SetChannel( 32 proxy_main->SetChannel(
32 ThreadedChannel::Create(proxy_main.get(), task_runner_provider)); 33 ThreadedChannel::Create(proxy_main.get(), task_runner_provider));
33 return proxy_main; 34 return proxy_main;
34 } 35 }
35 36
37 scoped_ptr<ProxyMain> ProxyMain::CreateRemote(
38 RemoteProtoChannel* remote_proto_channel,
39 LayerTreeHost* layer_tree_host,
40 TaskRunnerProvider* task_runner_provider) {
41 scoped_ptr<ProxyMain> proxy_main(
42 new ProxyMain(layer_tree_host, task_runner_provider, nullptr));
43 proxy_main->SetChannel(RemoteChannelMain::Create(
44 remote_proto_channel, proxy_main.get(), task_runner_provider));
45 return proxy_main;
46 }
47
36 ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host, 48 ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host,
37 TaskRunnerProvider* task_runner_provider, 49 TaskRunnerProvider* task_runner_provider,
38 scoped_ptr<BeginFrameSource> external_begin_frame_source) 50 scoped_ptr<BeginFrameSource> external_begin_frame_source)
39 : layer_tree_host_(layer_tree_host), 51 : layer_tree_host_(layer_tree_host),
40 task_runner_provider_(task_runner_provider), 52 task_runner_provider_(task_runner_provider),
41 layer_tree_host_id_(layer_tree_host->id()), 53 layer_tree_host_id_(layer_tree_host->id()),
42 max_requested_pipeline_stage_(NO_PIPELINE_STAGE), 54 max_requested_pipeline_stage_(NO_PIPELINE_STAGE),
43 current_pipeline_stage_(NO_PIPELINE_STAGE), 55 current_pipeline_stage_(NO_PIPELINE_STAGE),
44 final_pipeline_stage_(NO_PIPELINE_STAGE), 56 final_pipeline_stage_(NO_PIPELINE_STAGE),
45 commit_waits_for_activation_(false), 57 commit_waits_for_activation_(false),
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 return max_requested_pipeline_stage_ != NO_PIPELINE_STAGE; 387 return max_requested_pipeline_stage_ != NO_PIPELINE_STAGE;
376 } 388 }
377 389
378 void ProxyMain::MainThreadHasStoppedFlinging() { 390 void ProxyMain::MainThreadHasStoppedFlinging() {
379 DCHECK(IsMainThread()); 391 DCHECK(IsMainThread());
380 channel_main_->MainThreadHasStoppedFlingingOnImpl(); 392 channel_main_->MainThreadHasStoppedFlingingOnImpl();
381 } 393 }
382 394
383 void ProxyMain::Start() { 395 void ProxyMain::Start() {
384 DCHECK(IsMainThread()); 396 DCHECK(IsMainThread());
385 DCHECK(task_runner_provider_->HasImplThread());
386 DCHECK(channel_main_); 397 DCHECK(channel_main_);
387 398
388 // Create LayerTreeHostImpl. 399 // Create LayerTreeHostImpl.
389 channel_main_->SynchronouslyInitializeImpl( 400 channel_main_->SynchronouslyInitializeImpl(
390 layer_tree_host_, std::move(external_begin_frame_source_)); 401 layer_tree_host_, std::move(external_begin_frame_source_));
391 402
392 started_ = true; 403 started_ = true;
393 } 404 }
394 405
395 void ProxyMain::Stop() { 406 void ProxyMain::Stop() {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 return false; 467 return false;
457 channel_main_->SetNeedsCommitOnImpl(); 468 channel_main_->SetNeedsCommitOnImpl();
458 return true; 469 return true;
459 } 470 }
460 471
461 bool ProxyMain::IsMainThread() const { 472 bool ProxyMain::IsMainThread() const {
462 return task_runner_provider_->IsMainThread(); 473 return task_runner_provider_->IsMainThread();
463 } 474 }
464 475
465 } // namespace cc 476 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698