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

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

Issue 634083002: gpu: Compositor management of GpuMemoryBuffer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-pre-chromium-image-refactor
Patch Set: rebase Created 6 years, 2 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/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('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/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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 RendererCapabilities::RendererCapabilities() 60 RendererCapabilities::RendererCapabilities()
61 : best_texture_format(RGBA_8888), 61 : best_texture_format(RGBA_8888),
62 allow_partial_texture_updates(false), 62 allow_partial_texture_updates(false),
63 max_texture_size(0), 63 max_texture_size(0),
64 using_shared_memory_resources(false) {} 64 using_shared_memory_resources(false) {}
65 65
66 RendererCapabilities::~RendererCapabilities() {} 66 RendererCapabilities::~RendererCapabilities() {}
67 67
68 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( 68 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
69 LayerTreeHostClient* client, 69 LayerTreeHostClient* client,
70 SharedBitmapManager* manager, 70 SharedBitmapManager* shared_bitmap_manager,
71 GpuMemoryBufferManager* gpu_memory_buffer_manager,
71 const LayerTreeSettings& settings, 72 const LayerTreeSettings& settings,
72 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 73 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
73 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 74 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
74 DCHECK(main_task_runner.get()); 75 DCHECK(main_task_runner.get());
75 DCHECK(impl_task_runner.get()); 76 DCHECK(impl_task_runner.get());
76 scoped_ptr<LayerTreeHost> layer_tree_host( 77 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost(
77 new LayerTreeHost(client, manager, settings)); 78 client, shared_bitmap_manager, gpu_memory_buffer_manager, settings));
78 layer_tree_host->InitializeThreaded(main_task_runner, impl_task_runner); 79 layer_tree_host->InitializeThreaded(main_task_runner, impl_task_runner);
79 return layer_tree_host.Pass(); 80 return layer_tree_host.Pass();
80 } 81 }
81 82
82 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( 83 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
83 LayerTreeHostClient* client, 84 LayerTreeHostClient* client,
84 LayerTreeHostSingleThreadClient* single_thread_client, 85 LayerTreeHostSingleThreadClient* single_thread_client,
85 SharedBitmapManager* manager, 86 SharedBitmapManager* shared_bitmap_manager,
87 GpuMemoryBufferManager* gpu_memory_buffer_manager,
86 const LayerTreeSettings& settings, 88 const LayerTreeSettings& settings,
87 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { 89 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) {
88 scoped_ptr<LayerTreeHost> layer_tree_host( 90 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost(
89 new LayerTreeHost(client, manager, settings)); 91 client, shared_bitmap_manager, gpu_memory_buffer_manager, settings));
90 layer_tree_host->InitializeSingleThreaded(single_thread_client, 92 layer_tree_host->InitializeSingleThreaded(single_thread_client,
91 main_task_runner); 93 main_task_runner);
92 return layer_tree_host.Pass(); 94 return layer_tree_host.Pass();
93 } 95 }
94 96
95 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, 97 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
96 SharedBitmapManager* manager, 98 SharedBitmapManager* shared_bitmap_manager,
99 GpuMemoryBufferManager* gpu_memory_buffer_manager,
97 const LayerTreeSettings& settings) 100 const LayerTreeSettings& settings)
98 : micro_benchmark_controller_(this), 101 : micro_benchmark_controller_(this),
99 next_ui_resource_id_(1), 102 next_ui_resource_id_(1),
100 inside_begin_main_frame_(false), 103 inside_begin_main_frame_(false),
101 needs_full_tree_sync_(true), 104 needs_full_tree_sync_(true),
102 client_(client), 105 client_(client),
103 source_frame_number_(0), 106 source_frame_number_(0),
104 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), 107 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),
105 output_surface_lost_(true), 108 output_surface_lost_(true),
106 num_failed_recreate_attempts_(0), 109 num_failed_recreate_attempts_(0),
107 settings_(settings), 110 settings_(settings),
108 debug_state_(settings.initial_debug_state), 111 debug_state_(settings.initial_debug_state),
109 top_controls_layout_height_(0.f), 112 top_controls_layout_height_(0.f),
110 top_controls_content_offset_(0.f), 113 top_controls_content_offset_(0.f),
111 device_scale_factor_(1.f), 114 device_scale_factor_(1.f),
112 visible_(true), 115 visible_(true),
113 page_scale_factor_(1.f), 116 page_scale_factor_(1.f),
114 min_page_scale_factor_(1.f), 117 min_page_scale_factor_(1.f),
115 max_page_scale_factor_(1.f), 118 max_page_scale_factor_(1.f),
116 has_gpu_rasterization_trigger_(false), 119 has_gpu_rasterization_trigger_(false),
117 content_is_suitable_for_gpu_rasterization_(true), 120 content_is_suitable_for_gpu_rasterization_(true),
118 gpu_rasterization_histogram_recorded_(false), 121 gpu_rasterization_histogram_recorded_(false),
119 background_color_(SK_ColorWHITE), 122 background_color_(SK_ColorWHITE),
120 has_transparent_background_(false), 123 has_transparent_background_(false),
121 partial_texture_update_requests_(0), 124 partial_texture_update_requests_(0),
122 in_paint_layer_contents_(false), 125 in_paint_layer_contents_(false),
123 total_frames_used_for_lcd_text_metrics_(0), 126 total_frames_used_for_lcd_text_metrics_(0),
124 id_(s_layer_tree_host_sequence_number.GetNext() + 1), 127 id_(s_layer_tree_host_sequence_number.GetNext() + 1),
125 next_commit_forces_redraw_(false), 128 next_commit_forces_redraw_(false),
126 shared_bitmap_manager_(manager) { 129 shared_bitmap_manager_(shared_bitmap_manager),
130 gpu_memory_buffer_manager_(gpu_memory_buffer_manager) {
127 if (settings_.accelerated_animation_enabled) 131 if (settings_.accelerated_animation_enabled)
128 animation_registrar_ = AnimationRegistrar::Create(); 132 animation_registrar_ = AnimationRegistrar::Create();
129 rendering_stats_instrumentation_->set_record_rendering_stats( 133 rendering_stats_instrumentation_->set_record_rendering_stats(
130 debug_state_.RecordRenderingStats()); 134 debug_state_.RecordRenderingStats());
131 } 135 }
132 136
133 void LayerTreeHost::InitializeThreaded( 137 void LayerTreeHost::InitializeThreaded(
134 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 138 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
135 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 139 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
136 InitializeProxy( 140 InitializeProxy(
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 427
424 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( 428 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
425 LayerTreeHostImplClient* client) { 429 LayerTreeHostImplClient* client) {
426 DCHECK(proxy_->IsImplThread()); 430 DCHECK(proxy_->IsImplThread());
427 scoped_ptr<LayerTreeHostImpl> host_impl = 431 scoped_ptr<LayerTreeHostImpl> host_impl =
428 LayerTreeHostImpl::Create(settings_, 432 LayerTreeHostImpl::Create(settings_,
429 client, 433 client,
430 proxy_.get(), 434 proxy_.get(),
431 rendering_stats_instrumentation_.get(), 435 rendering_stats_instrumentation_.get(),
432 shared_bitmap_manager_, 436 shared_bitmap_manager_,
437 gpu_memory_buffer_manager_,
433 id_); 438 id_);
434 host_impl->SetUseGpuRasterization(UseGpuRasterization()); 439 host_impl->SetUseGpuRasterization(UseGpuRasterization());
435 shared_bitmap_manager_ = NULL; 440 shared_bitmap_manager_ = NULL;
441 gpu_memory_buffer_manager_ = NULL;
436 if (settings_.calculate_top_controls_position && 442 if (settings_.calculate_top_controls_position &&
437 host_impl->top_controls_manager()) { 443 host_impl->top_controls_manager()) {
438 top_controls_manager_weak_ptr_ = 444 top_controls_manager_weak_ptr_ =
439 host_impl->top_controls_manager()->AsWeakPtr(); 445 host_impl->top_controls_manager()->AsWeakPtr();
440 } 446 }
441 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); 447 input_handler_weak_ptr_ = host_impl->AsWeakPtr();
442 return host_impl.Pass(); 448 return host_impl.Pass();
443 } 449 }
444 450
445 void LayerTreeHost::DidLoseOutputSurface() { 451 void LayerTreeHost::DidLoseOutputSurface() {
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 swap_promise_list_.push_back(swap_promise.Pass()); 1340 swap_promise_list_.push_back(swap_promise.Pass());
1335 } 1341 }
1336 1342
1337 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1343 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1338 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1344 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1339 swap_promise_list_[i]->DidNotSwap(reason); 1345 swap_promise_list_[i]->DidNotSwap(reason);
1340 swap_promise_list_.clear(); 1346 swap_promise_list_.clear();
1341 } 1347 }
1342 1348
1343 } // namespace cc 1349 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698