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

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

Issue 1126253005: cc: Add LayerTreeHost::InitParams for LayerTreeHost creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: all Created 5 years, 7 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
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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 #include <string> 9 #include <string>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "cc/trees/tree_synchronizer.h" 47 #include "cc/trees/tree_synchronizer.h"
48 #include "ui/gfx/geometry/size_conversions.h" 48 #include "ui/gfx/geometry/size_conversions.h"
49 #include "ui/gfx/geometry/vector2d_conversions.h" 49 #include "ui/gfx/geometry/vector2d_conversions.h"
50 50
51 namespace { 51 namespace {
52 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number; 52 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number;
53 } 53 }
54 54
55 namespace cc { 55 namespace cc {
56 56
57 LayerTreeHost::InitParams::InitParams() {
58 }
59
60 LayerTreeHost::InitParams::~InitParams() {
61 }
62
57 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( 63 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
58 LayerTreeHostClient* client,
59 SharedBitmapManager* shared_bitmap_manager,
60 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
61 TaskGraphRunner* task_graph_runner,
62 const LayerTreeSettings& settings,
63 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
64 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 64 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
65 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 65 InitParams* params) {
66 DCHECK(main_task_runner.get()); 66 DCHECK(params->main_task_runner.get());
67 DCHECK(impl_task_runner.get()); 67 DCHECK(impl_task_runner.get());
68 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( 68 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost(params));
69 client, shared_bitmap_manager, gpu_memory_buffer_manager, 69 layer_tree_host->InitializeThreaded(
70 task_graph_runner, settings)); 70 params->main_task_runner, impl_task_runner,
71 layer_tree_host->InitializeThreaded(main_task_runner, 71 params->external_begin_frame_source.Pass());
72 impl_task_runner,
73 external_begin_frame_source.Pass());
74 return layer_tree_host.Pass(); 72 return layer_tree_host.Pass();
75 } 73 }
76 74
77 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( 75 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
78 LayerTreeHostClient* client,
79 LayerTreeHostSingleThreadClient* single_thread_client, 76 LayerTreeHostSingleThreadClient* single_thread_client,
80 SharedBitmapManager* shared_bitmap_manager, 77 InitParams* params) {
81 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 78 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost(params));
82 TaskGraphRunner* task_graph_runner, 79 layer_tree_host->InitializeSingleThreaded(
83 const LayerTreeSettings& settings, 80 single_thread_client, params->main_task_runner,
84 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 81 params->external_begin_frame_source.Pass());
85 scoped_ptr<BeginFrameSource> external_begin_frame_source) {
86 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost(
87 client, shared_bitmap_manager, gpu_memory_buffer_manager,
88 task_graph_runner, settings));
89 layer_tree_host->InitializeSingleThreaded(single_thread_client,
90 main_task_runner,
91 external_begin_frame_source.Pass());
92 return layer_tree_host.Pass(); 82 return layer_tree_host.Pass();
93 } 83 }
94 84
95 LayerTreeHost::LayerTreeHost( 85 LayerTreeHost::LayerTreeHost(InitParams* params)
96 LayerTreeHostClient* client,
97 SharedBitmapManager* shared_bitmap_manager,
98 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
99 TaskGraphRunner* task_graph_runner,
100 const LayerTreeSettings& settings)
101 : micro_benchmark_controller_(this), 86 : micro_benchmark_controller_(this),
102 next_ui_resource_id_(1), 87 next_ui_resource_id_(1),
103 inside_begin_main_frame_(false), 88 inside_begin_main_frame_(false),
104 needs_full_tree_sync_(true), 89 needs_full_tree_sync_(true),
105 needs_meta_info_recomputation_(true), 90 needs_meta_info_recomputation_(true),
106 client_(client), 91 client_(params->client),
107 source_frame_number_(0), 92 source_frame_number_(0),
108 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), 93 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),
109 output_surface_lost_(true), 94 output_surface_lost_(true),
110 settings_(settings), 95 settings_(params->settings ? *params->settings : LayerTreeSettings()),
danakj 2015/05/07 00:59:56 similar, not a fan of this
sadrul 2015/05/07 04:39:25 Removed this.
111 debug_state_(settings.initial_debug_state), 96 debug_state_(settings_.initial_debug_state),
112 top_controls_shrink_blink_size_(false), 97 top_controls_shrink_blink_size_(false),
113 top_controls_height_(0.f), 98 top_controls_height_(0.f),
114 top_controls_shown_ratio_(0.f), 99 top_controls_shown_ratio_(0.f),
115 device_scale_factor_(1.f), 100 device_scale_factor_(1.f),
116 visible_(true), 101 visible_(true),
117 page_scale_factor_(1.f), 102 page_scale_factor_(1.f),
118 min_page_scale_factor_(1.f), 103 min_page_scale_factor_(1.f),
119 max_page_scale_factor_(1.f), 104 max_page_scale_factor_(1.f),
120 has_gpu_rasterization_trigger_(false), 105 has_gpu_rasterization_trigger_(false),
121 content_is_suitable_for_gpu_rasterization_(true), 106 content_is_suitable_for_gpu_rasterization_(true),
122 gpu_rasterization_histogram_recorded_(false), 107 gpu_rasterization_histogram_recorded_(false),
123 background_color_(SK_ColorWHITE), 108 background_color_(SK_ColorWHITE),
124 has_transparent_background_(false), 109 has_transparent_background_(false),
125 partial_texture_update_requests_(0), 110 partial_texture_update_requests_(0),
126 did_complete_scale_animation_(false), 111 did_complete_scale_animation_(false),
127 in_paint_layer_contents_(false), 112 in_paint_layer_contents_(false),
128 id_(s_layer_tree_host_sequence_number.GetNext() + 1), 113 id_(s_layer_tree_host_sequence_number.GetNext() + 1),
129 next_commit_forces_redraw_(false), 114 next_commit_forces_redraw_(false),
130 shared_bitmap_manager_(shared_bitmap_manager), 115 shared_bitmap_manager_(params->shared_bitmap_manager),
131 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 116 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager),
132 task_graph_runner_(task_graph_runner), 117 task_graph_runner_(params->task_graph_runner),
133 surface_id_namespace_(0u), 118 surface_id_namespace_(0u),
134 next_surface_sequence_(1u) { 119 next_surface_sequence_(1u) {
135 if (settings_.accelerated_animation_enabled) 120 if (settings_.accelerated_animation_enabled)
136 animation_registrar_ = AnimationRegistrar::Create(); 121 animation_registrar_ = AnimationRegistrar::Create();
137 rendering_stats_instrumentation_->set_record_rendering_stats( 122 rendering_stats_instrumentation_->set_record_rendering_stats(
138 debug_state_.RecordRenderingStats()); 123 debug_state_.RecordRenderingStats());
139 } 124 }
140 125
141 void LayerTreeHost::InitializeThreaded( 126 void LayerTreeHost::InitializeThreaded(
142 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 127 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 const BeginFrameArgs& args) const { 1253 const BeginFrameArgs& args) const {
1269 client_->SendBeginFramesToChildren(args); 1254 client_->SendBeginFramesToChildren(args);
1270 } 1255 }
1271 1256
1272 void LayerTreeHost::SetAuthoritativeVSyncInterval( 1257 void LayerTreeHost::SetAuthoritativeVSyncInterval(
1273 const base::TimeDelta& interval) { 1258 const base::TimeDelta& interval) {
1274 proxy_->SetAuthoritativeVSyncInterval(interval); 1259 proxy_->SetAuthoritativeVSyncInterval(interval);
1275 } 1260 }
1276 1261
1277 } // namespace cc 1262 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698