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

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

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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/test/test_web_graphics_context_3d.cc ('k') | cc/trees/layer_tree_host_common.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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // made a contract with our animation controllers that the registrar 204 // made a contract with our animation controllers that the registrar
205 // will outlive them, and we must make good. 205 // will outlive them, and we must make good.
206 root_layer_ = NULL; 206 root_layer_ = NULL;
207 } 207 }
208 } 208 }
209 209
210 void LayerTreeHost::SetLayerTreeHostClientReady() { 210 void LayerTreeHost::SetLayerTreeHostClientReady() {
211 proxy_->SetLayerTreeHostClientReady(); 211 proxy_->SetLayerTreeHostClientReady();
212 } 212 }
213 213
214 static void LayerTreeHostOnOutputSurfaceCreatedCallback(Layer* layer) {
215 layer->OnOutputSurfaceCreated();
216 }
217
218 void LayerTreeHost::DeleteContentsTexturesOnImplThread( 214 void LayerTreeHost::DeleteContentsTexturesOnImplThread(
219 ResourceProvider* resource_provider) { 215 ResourceProvider* resource_provider) {
220 DCHECK(proxy_->IsImplThread()); 216 DCHECK(proxy_->IsImplThread());
221 if (contents_texture_manager_) 217 if (contents_texture_manager_)
222 contents_texture_manager_->ClearAllMemory(resource_provider); 218 contents_texture_manager_->ClearAllMemory(resource_provider);
223 } 219 }
224 220
225 void LayerTreeHost::WillBeginMainFrame() { 221 void LayerTreeHost::WillBeginMainFrame() {
226 devtools_instrumentation::WillBeginMainThreadFrame(id(), 222 devtools_instrumentation::WillBeginMainThreadFrame(id(),
227 source_frame_number()); 223 source_frame_number());
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 416
421 if (!contents_texture_manager_ && !settings_.impl_side_painting) { 417 if (!contents_texture_manager_ && !settings_.impl_side_painting) {
422 contents_texture_manager_ = 418 contents_texture_manager_ =
423 PrioritizedResourceManager::Create(proxy_.get()); 419 PrioritizedResourceManager::Create(proxy_.get());
424 surface_memory_placeholder_ = 420 surface_memory_placeholder_ =
425 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888); 421 contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888);
426 } 422 }
427 423
428 if (root_layer()) { 424 if (root_layer()) {
429 LayerTreeHostCommon::CallFunctionForSubtree( 425 LayerTreeHostCommon::CallFunctionForSubtree(
430 root_layer(), base::Bind(&LayerTreeHostOnOutputSurfaceCreatedCallback)); 426 root_layer(), [](Layer* layer) { layer->OnOutputSurfaceCreated(); });
431 } 427 }
432 428
433 client_->DidInitializeOutputSurface(); 429 client_->DidInitializeOutputSurface();
434 } 430 }
435 431
436 void LayerTreeHost::DidFailToInitializeOutputSurface() { 432 void LayerTreeHost::DidFailToInitializeOutputSurface() {
437 DCHECK(output_surface_lost_); 433 DCHECK(output_surface_lost_);
438 client_->DidFailToInitializeOutputSurface(); 434 client_->DidFailToInitializeOutputSurface();
439 } 435 }
440 436
441 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( 437 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
442 LayerTreeHostImplClient* client) { 438 LayerTreeHostImplClient* client) {
443 DCHECK(proxy_->IsImplThread()); 439 DCHECK(proxy_->IsImplThread());
444 scoped_ptr<LayerTreeHostImpl> host_impl = 440 scoped_ptr<LayerTreeHostImpl> host_impl =
445 LayerTreeHostImpl::Create(settings_, 441 LayerTreeHostImpl::Create(settings_,
446 client, 442 client,
447 proxy_.get(), 443 proxy_.get(),
448 rendering_stats_instrumentation_.get(), 444 rendering_stats_instrumentation_.get(),
449 shared_bitmap_manager_, 445 shared_bitmap_manager_,
450 gpu_memory_buffer_manager_, 446 gpu_memory_buffer_manager_,
451 id_); 447 id_);
452 host_impl->SetUseGpuRasterization(UseGpuRasterization()); 448 host_impl->SetUseGpuRasterization(UseGpuRasterization());
453 shared_bitmap_manager_ = NULL; 449 shared_bitmap_manager_ = NULL;
454 gpu_memory_buffer_manager_ = NULL; 450 gpu_memory_buffer_manager_ = NULL;
455 if (settings_.calculate_top_controls_position && 451 top_controls_manager_weak_ptr_ =
456 host_impl->top_controls_manager()) { 452 host_impl->top_controls_manager()->AsWeakPtr();
457 top_controls_manager_weak_ptr_ =
458 host_impl->top_controls_manager()->AsWeakPtr();
459 }
460 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); 453 input_handler_weak_ptr_ = host_impl->AsWeakPtr();
461 return host_impl.Pass(); 454 return host_impl.Pass();
462 } 455 }
463 456
464 void LayerTreeHost::DidLoseOutputSurface() { 457 void LayerTreeHost::DidLoseOutputSurface() {
465 TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface"); 458 TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface");
466 DCHECK(proxy_->IsMainThread()); 459 DCHECK(proxy_->IsMainThread());
467 460
468 if (output_surface_lost_) 461 if (output_surface_lost_)
469 return; 462 return;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 859
867 return did_paint_content; 860 return did_paint_content;
868 } 861 }
869 862
870 void LayerTreeHost::TriggerPrepaint() { 863 void LayerTreeHost::TriggerPrepaint() {
871 prepaint_callback_.Cancel(); 864 prepaint_callback_.Cancel();
872 TRACE_EVENT0("cc", "LayerTreeHost::TriggerPrepaint"); 865 TRACE_EVENT0("cc", "LayerTreeHost::TriggerPrepaint");
873 SetNeedsCommit(); 866 SetNeedsCommit();
874 } 867 }
875 868
876 static void LayerTreeHostReduceMemoryCallback(Layer* layer) {
877 layer->ReduceMemoryUsage();
878 }
879
880 void LayerTreeHost::ReduceMemoryUsage() { 869 void LayerTreeHost::ReduceMemoryUsage() {
881 if (!root_layer()) 870 if (!root_layer())
882 return; 871 return;
883 872
884 LayerTreeHostCommon::CallFunctionForSubtree( 873 LayerTreeHostCommon::CallFunctionForSubtree(
885 root_layer(), 874 root_layer(), [](Layer* layer) { layer->ReduceMemoryUsage(); });
886 base::Bind(&LayerTreeHostReduceMemoryCallback));
887 } 875 }
888 876
889 void LayerTreeHost::SetPrioritiesForSurfaces(size_t surface_memory_bytes) { 877 void LayerTreeHost::SetPrioritiesForSurfaces(size_t surface_memory_bytes) {
890 DCHECK(surface_memory_placeholder_); 878 DCHECK(surface_memory_placeholder_);
891 879
892 // Surfaces have a place holder for their memory since they are managed 880 // Surfaces have a place holder for their memory since they are managed
893 // independantly but should still be tracked and reduce other memory usage. 881 // independantly but should still be tracked and reduce other memory usage.
894 surface_memory_placeholder_->SetTextureManager( 882 surface_memory_placeholder_->SetTextureManager(
895 contents_texture_manager_.get()); 883 contents_texture_manager_.get());
896 surface_memory_placeholder_->set_request_priority( 884 surface_memory_placeholder_->set_request_priority(
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 if (device_scale_factor == device_scale_factor_) 1148 if (device_scale_factor == device_scale_factor_)
1161 return; 1149 return;
1162 device_scale_factor_ = device_scale_factor; 1150 device_scale_factor_ = device_scale_factor;
1163 1151
1164 SetNeedsCommit(); 1152 SetNeedsCommit();
1165 } 1153 }
1166 1154
1167 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, 1155 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints,
1168 TopControlsState current, 1156 TopControlsState current,
1169 bool animate) { 1157 bool animate) {
1170 if (!settings_.calculate_top_controls_position)
1171 return;
1172
1173 // Top controls are only used in threaded mode. 1158 // Top controls are only used in threaded mode.
1174 proxy_->ImplThreadTaskRunner()->PostTask( 1159 proxy_->ImplThreadTaskRunner()->PostTask(
1175 FROM_HERE, 1160 FROM_HERE,
1176 base::Bind(&TopControlsManager::UpdateTopControlsState, 1161 base::Bind(&TopControlsManager::UpdateTopControlsState,
1177 top_controls_manager_weak_ptr_, 1162 top_controls_manager_weak_ptr_,
1178 constraints, 1163 constraints,
1179 current, 1164 current,
1180 animate)); 1165 animate));
1181 } 1166 }
1182 1167
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 bool children_need_begin_frames) const { 1312 bool children_need_begin_frames) const {
1328 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); 1313 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames);
1329 } 1314 }
1330 1315
1331 void LayerTreeHost::SendBeginFramesToChildren( 1316 void LayerTreeHost::SendBeginFramesToChildren(
1332 const BeginFrameArgs& args) const { 1317 const BeginFrameArgs& args) const {
1333 client_->SendBeginFramesToChildren(args); 1318 client_->SendBeginFramesToChildren(args);
1334 } 1319 }
1335 1320
1336 } // namespace cc 1321 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_web_graphics_context_3d.cc ('k') | cc/trees/layer_tree_host_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698