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

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

Issue 2317753002: cc: Abstract the LayerTreeHost. (Closed)
Patch Set: Rebase Created 4 years, 3 months 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/property_tree_builder.cc ('k') | cc/trees/proxy_main.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 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_impl.h" 5 #include "cc/trees/proxy_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 23 matching lines...) Expand all
34 34
35 unsigned int nextBeginFrameId = 0; 35 unsigned int nextBeginFrameId = 0;
36 36
37 } // namespace 37 } // namespace
38 38
39 ProxyImpl::ProxyImpl( 39 ProxyImpl::ProxyImpl(
40 ChannelImpl* channel_impl, 40 ChannelImpl* channel_impl,
41 LayerTreeHost* layer_tree_host, 41 LayerTreeHost* layer_tree_host,
42 TaskRunnerProvider* task_runner_provider, 42 TaskRunnerProvider* task_runner_provider,
43 std::unique_ptr<BeginFrameSource> external_begin_frame_source) 43 std::unique_ptr<BeginFrameSource> external_begin_frame_source)
44 : layer_tree_host_id_(layer_tree_host->id()), 44 : layer_tree_host_id_(layer_tree_host->GetId()),
45 commit_completion_waits_for_activation_(false), 45 commit_completion_waits_for_activation_(false),
46 commit_completion_event_(nullptr), 46 commit_completion_event_(nullptr),
47 activation_completion_event_(nullptr), 47 activation_completion_event_(nullptr),
48 next_frame_is_newly_committed_frame_(false), 48 next_frame_is_newly_committed_frame_(false),
49 inside_draw_(false), 49 inside_draw_(false),
50 input_throttled_until_commit_(false), 50 input_throttled_until_commit_(false),
51 task_runner_provider_(task_runner_provider), 51 task_runner_provider_(task_runner_provider),
52 smoothness_priority_expiration_notifier_( 52 smoothness_priority_expiration_notifier_(
53 task_runner_provider->ImplThreadTaskRunner(), 53 task_runner_provider->ImplThreadTaskRunner(),
54 base::Bind(&ProxyImpl::RenewTreePriority, base::Unretained(this)), 54 base::Bind(&ProxyImpl::RenewTreePriority, base::Unretained(this)),
55 base::TimeDelta::FromSecondsD( 55 base::TimeDelta::FromSecondsD(
56 kSmoothnessTakesPriorityExpirationDelay)), 56 kSmoothnessTakesPriorityExpirationDelay)),
57 external_begin_frame_source_(std::move(external_begin_frame_source)), 57 external_begin_frame_source_(std::move(external_begin_frame_source)),
58 rendering_stats_instrumentation_( 58 rendering_stats_instrumentation_(
59 layer_tree_host->rendering_stats_instrumentation()), 59 layer_tree_host->rendering_stats_instrumentation()),
60 channel_impl_(channel_impl) { 60 channel_impl_(channel_impl) {
61 TRACE_EVENT0("cc", "ProxyImpl::ProxyImpl"); 61 TRACE_EVENT0("cc", "ProxyImpl::ProxyImpl");
62 DCHECK(IsImplThread()); 62 DCHECK(IsImplThread());
63 DCHECK(IsMainThreadBlocked()); 63 DCHECK(IsMainThreadBlocked());
64 64
65 // Double checking we set this correctly since double->int truncations are 65 // Double checking we set this correctly since double->int truncations are
66 // silent and have been done mistakenly: crbug.com/568120. 66 // silent and have been done mistakenly: crbug.com/568120.
67 DCHECK(!smoothness_priority_expiration_notifier_.delay().is_zero()); 67 DCHECK(!smoothness_priority_expiration_notifier_.delay().is_zero());
68 68
69 layer_tree_host_impl_ = layer_tree_host->CreateLayerTreeHostImpl(this); 69 layer_tree_host_impl_ = layer_tree_host->CreateLayerTreeHostImpl(this);
70 const LayerTreeSettings& settings = layer_tree_host->GetSettings();
70 71
71 SchedulerSettings scheduler_settings( 72 SchedulerSettings scheduler_settings(settings.ToSchedulerSettings());
72 layer_tree_host->settings().ToSchedulerSettings());
73 73
74 std::unique_ptr<CompositorTimingHistory> compositor_timing_history( 74 std::unique_ptr<CompositorTimingHistory> compositor_timing_history(
75 new CompositorTimingHistory( 75 new CompositorTimingHistory(
76 scheduler_settings.using_synchronous_renderer_compositor, 76 scheduler_settings.using_synchronous_renderer_compositor,
77 CompositorTimingHistory::RENDERER_UMA, 77 CompositorTimingHistory::RENDERER_UMA,
78 rendering_stats_instrumentation_)); 78 rendering_stats_instrumentation_));
79 79
80 // BFS must either be external or come from the output surface. If 80 // BFS must either be external or come from the output surface. If
81 // external, it must be provided. If from the output surface, it must 81 // external, it must be provided. If from the output surface, it must
82 // not be provided. 82 // not be provided.
83 // TODO(enne): Make all BFS come from the output surface. 83 // TODO(enne): Make all BFS come from the output surface.
84 DCHECK(layer_tree_host->settings().use_external_begin_frame_source ^ 84 DCHECK(settings.use_external_begin_frame_source ^
85 layer_tree_host->settings().use_output_surface_begin_frame_source); 85 settings.use_output_surface_begin_frame_source);
86 DCHECK(!layer_tree_host->settings().use_external_begin_frame_source || 86 DCHECK(!settings.use_external_begin_frame_source ||
87 external_begin_frame_source_); 87 external_begin_frame_source_);
88 DCHECK(!layer_tree_host->settings().use_output_surface_begin_frame_source || 88 DCHECK(!settings.use_output_surface_begin_frame_source ||
89 !external_begin_frame_source_); 89 !external_begin_frame_source_);
90 scheduler_ = Scheduler::Create(this, scheduler_settings, layer_tree_host_id_, 90 scheduler_ = Scheduler::Create(this, scheduler_settings, layer_tree_host_id_,
91 task_runner_provider_->ImplThreadTaskRunner(), 91 task_runner_provider_->ImplThreadTaskRunner(),
92 external_begin_frame_source_.get(), 92 external_begin_frame_source_.get(),
93 std::move(compositor_timing_history)); 93 std::move(compositor_timing_history));
94 94
95 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible()); 95 DCHECK_EQ(scheduler_->visible(), layer_tree_host_impl_->visible());
96 } 96 }
97 97
98 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly() 98 ProxyImpl::BlockedMainCommitOnly::BlockedMainCommitOnly()
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 bool ProxyImpl::IsMainThreadBlocked() const { 632 bool ProxyImpl::IsMainThreadBlocked() const {
633 return task_runner_provider_->IsMainThreadBlocked(); 633 return task_runner_provider_->IsMainThreadBlocked();
634 } 634 }
635 635
636 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { 636 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() {
637 DCHECK(IsMainThreadBlocked() && commit_completion_event_); 637 DCHECK(IsMainThreadBlocked() && commit_completion_event_);
638 return main_thread_blocked_commit_vars_unsafe_; 638 return main_thread_blocked_commit_vars_unsafe_;
639 } 639 }
640 640
641 } // namespace cc 641 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree_builder.cc ('k') | cc/trees/proxy_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698