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

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

Issue 1455023002: cc: Replace Pass() with std::move() in some subdirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-cc
Patch Set: pass-cc2: . Created 5 years, 1 month 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
« no previous file with comments | « cc/trees/occlusion_tracker_unittest.cc ('k') | cc/trees/thread_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/profiler/scoped_tracker.h" 8 #include "base/profiler/scoped_tracker.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/debug/benchmark_instrumentation.h" 10 #include "cc/debug/benchmark_instrumentation.h"
(...skipping 11 matching lines...) Expand all
22 22
23 namespace cc { 23 namespace cc {
24 24
25 scoped_ptr<Proxy> SingleThreadProxy::Create( 25 scoped_ptr<Proxy> SingleThreadProxy::Create(
26 LayerTreeHost* layer_tree_host, 26 LayerTreeHost* layer_tree_host,
27 LayerTreeHostSingleThreadClient* client, 27 LayerTreeHostSingleThreadClient* client,
28 TaskRunnerProvider* task_runner_provider, 28 TaskRunnerProvider* task_runner_provider,
29 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 29 scoped_ptr<BeginFrameSource> external_begin_frame_source) {
30 return make_scoped_ptr( 30 return make_scoped_ptr(
31 new SingleThreadProxy(layer_tree_host, client, task_runner_provider, 31 new SingleThreadProxy(layer_tree_host, client, task_runner_provider,
32 external_begin_frame_source.Pass())); 32 std::move(external_begin_frame_source)));
33 } 33 }
34 34
35 SingleThreadProxy::SingleThreadProxy( 35 SingleThreadProxy::SingleThreadProxy(
36 LayerTreeHost* layer_tree_host, 36 LayerTreeHost* layer_tree_host,
37 LayerTreeHostSingleThreadClient* client, 37 LayerTreeHostSingleThreadClient* client,
38 TaskRunnerProvider* task_runner_provider, 38 TaskRunnerProvider* task_runner_provider,
39 scoped_ptr<BeginFrameSource> external_begin_frame_source) 39 scoped_ptr<BeginFrameSource> external_begin_frame_source)
40 : layer_tree_host_(layer_tree_host), 40 : layer_tree_host_(layer_tree_host),
41 client_(client), 41 client_(client),
42 task_runner_provider_(task_runner_provider), 42 task_runner_provider_(task_runner_provider),
43 external_begin_frame_source_(external_begin_frame_source.Pass()), 43 external_begin_frame_source_(std::move(external_begin_frame_source)),
44 next_frame_is_newly_committed_frame_(false), 44 next_frame_is_newly_committed_frame_(false),
45 #if DCHECK_IS_ON() 45 #if DCHECK_IS_ON()
46 inside_impl_frame_(false), 46 inside_impl_frame_(false),
47 #endif 47 #endif
48 inside_draw_(false), 48 inside_draw_(false),
49 defer_commits_(false), 49 defer_commits_(false),
50 animate_requested_(false), 50 animate_requested_(false),
51 commit_requested_(false), 51 commit_requested_(false),
52 inside_synchronous_composite_(false), 52 inside_synchronous_composite_(false),
53 output_surface_creation_requested_(false), 53 output_surface_creation_requested_(false),
54 weak_factory_(this) { 54 weak_factory_(this) {
55 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); 55 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
56 DCHECK(task_runner_provider_); 56 DCHECK(task_runner_provider_);
57 DCHECK(task_runner_provider_->IsMainThread()); 57 DCHECK(task_runner_provider_->IsMainThread());
58 DCHECK(layer_tree_host); 58 DCHECK(layer_tree_host);
59 59
60 if (layer_tree_host->settings().single_thread_proxy_scheduler && 60 if (layer_tree_host->settings().single_thread_proxy_scheduler &&
61 !scheduler_on_impl_thread_) { 61 !scheduler_on_impl_thread_) {
62 SchedulerSettings scheduler_settings( 62 SchedulerSettings scheduler_settings(
63 layer_tree_host->settings().ToSchedulerSettings()); 63 layer_tree_host->settings().ToSchedulerSettings());
64 scheduler_settings.commit_to_active_tree = CommitToActiveTree(); 64 scheduler_settings.commit_to_active_tree = CommitToActiveTree();
65 65
66 scoped_ptr<CompositorTimingHistory> compositor_timing_history( 66 scoped_ptr<CompositorTimingHistory> compositor_timing_history(
67 new CompositorTimingHistory( 67 new CompositorTimingHistory(
68 CompositorTimingHistory::BROWSER_UMA, 68 CompositorTimingHistory::BROWSER_UMA,
69 layer_tree_host->rendering_stats_instrumentation())); 69 layer_tree_host->rendering_stats_instrumentation()));
70 70
71 scheduler_on_impl_thread_ = Scheduler::Create( 71 scheduler_on_impl_thread_ =
72 this, scheduler_settings, layer_tree_host_->id(), 72 Scheduler::Create(this, scheduler_settings, layer_tree_host_->id(),
73 task_runner_provider_->MainThreadTaskRunner(), 73 task_runner_provider_->MainThreadTaskRunner(),
74 external_begin_frame_source_.get(), compositor_timing_history.Pass()); 74 external_begin_frame_source_.get(),
75 std::move(compositor_timing_history));
75 } 76 }
76 } 77 }
77 78
78 void SingleThreadProxy::Start() { 79 void SingleThreadProxy::Start() {
79 DebugScopedSetImplThread impl(task_runner_provider_); 80 DebugScopedSetImplThread impl(task_runner_provider_);
80 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); 81 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
81 } 82 }
82 83
83 SingleThreadProxy::~SingleThreadProxy() { 84 SingleThreadProxy::~SingleThreadProxy() {
84 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); 85 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 if (scheduler_on_impl_thread_) 418 if (scheduler_on_impl_thread_)
418 scheduler_on_impl_thread_->SetVideoNeedsBeginFrames(needs_begin_frames); 419 scheduler_on_impl_thread_->SetVideoNeedsBeginFrames(needs_begin_frames);
419 } 420 }
420 421
421 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( 422 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread(
422 scoped_ptr<AnimationEventsVector> events) { 423 scoped_ptr<AnimationEventsVector> events) {
423 TRACE_EVENT0( 424 TRACE_EVENT0(
424 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); 425 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread");
425 DCHECK(task_runner_provider_->IsImplThread()); 426 DCHECK(task_runner_provider_->IsImplThread());
426 DebugScopedSetMainThread main(task_runner_provider_); 427 DebugScopedSetMainThread main(task_runner_provider_);
427 layer_tree_host_->SetAnimationEvents(events.Pass()); 428 layer_tree_host_->SetAnimationEvents(std::move(events));
428 } 429 }
429 430
430 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } 431 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; }
431 432
432 void SingleThreadProxy::DidActivateSyncTree() { 433 void SingleThreadProxy::DidActivateSyncTree() {
433 // Synchronously call to CommitComplete. Resetting 434 // Synchronously call to CommitComplete. Resetting
434 // |commit_blocking_task_runner| would make sure all tasks posted during 435 // |commit_blocking_task_runner| would make sure all tasks posted during
435 // commit/activation before CommitComplete. 436 // commit/activation before CommitComplete.
436 CommitComplete(); 437 CommitComplete();
437 } 438 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 layer_tree_host_->DidCompleteSwapBuffers(); 498 layer_tree_host_->DidCompleteSwapBuffers();
498 } 499 }
499 500
500 void SingleThreadProxy::OnDrawForOutputSurface() { 501 void SingleThreadProxy::OnDrawForOutputSurface() {
501 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; 502 NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor.";
502 } 503 }
503 504
504 void SingleThreadProxy::PostFrameTimingEventsOnImplThread( 505 void SingleThreadProxy::PostFrameTimingEventsOnImplThread(
505 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 506 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
506 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 507 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
507 layer_tree_host_->RecordFrameTimingEvents(composite_events.Pass(), 508 layer_tree_host_->RecordFrameTimingEvents(std::move(composite_events),
508 main_frame_events.Pass()); 509 std::move(main_frame_events));
509 } 510 }
510 511
511 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { 512 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
512 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); 513 TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately");
513 DCHECK(task_runner_provider_->IsMainThread()); 514 DCHECK(task_runner_provider_->IsMainThread());
514 #if DCHECK_IS_ON() 515 #if DCHECK_IS_ON()
515 DCHECK(!inside_impl_frame_); 516 DCHECK(!inside_impl_frame_);
516 #endif 517 #endif
517 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); 518 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true);
518 519
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 << "DidFinishImplFrame called while not inside an impl frame!"; 882 << "DidFinishImplFrame called while not inside an impl frame!";
882 inside_impl_frame_ = false; 883 inside_impl_frame_ = false;
883 #endif 884 #endif
884 } 885 }
885 886
886 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { 887 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) {
887 layer_tree_host_->SendBeginFramesToChildren(args); 888 layer_tree_host_->SendBeginFramesToChildren(args);
888 } 889 }
889 890
890 } // namespace cc 891 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker_unittest.cc ('k') | cc/trees/thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698