| OLD | NEW |
| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 debug_state_(settings.initial_debug_state), | 90 debug_state_(settings.initial_debug_state), |
| 91 overdraw_bottom_height_(0.f), | 91 overdraw_bottom_height_(0.f), |
| 92 device_scale_factor_(1.f), | 92 device_scale_factor_(1.f), |
| 93 visible_(true), | 93 visible_(true), |
| 94 page_scale_factor_(1.f), | 94 page_scale_factor_(1.f), |
| 95 min_page_scale_factor_(1.f), | 95 min_page_scale_factor_(1.f), |
| 96 max_page_scale_factor_(1.f), | 96 max_page_scale_factor_(1.f), |
| 97 trigger_idle_updates_(true), | 97 trigger_idle_updates_(true), |
| 98 background_color_(SK_ColorWHITE), | 98 background_color_(SK_ColorWHITE), |
| 99 has_transparent_background_(false), | 99 has_transparent_background_(false), |
| 100 partial_texture_update_requests_(0) { | 100 partial_texture_update_requests_(0), |
| 101 in_paint_layer_contents_(false) { |
| 101 if (settings_.accelerated_animation_enabled) | 102 if (settings_.accelerated_animation_enabled) |
| 102 animation_registrar_ = AnimationRegistrar::Create(); | 103 animation_registrar_ = AnimationRegistrar::Create(); |
| 103 s_num_layer_tree_instances++; | 104 s_num_layer_tree_instances++; |
| 104 | 105 |
| 105 rendering_stats_instrumentation_->set_record_rendering_stats( | 106 rendering_stats_instrumentation_->set_record_rendering_stats( |
| 106 debug_state_.RecordRenderingStats()); | 107 debug_state_.RecordRenderingStats()); |
| 107 } | 108 } |
| 108 | 109 |
| 109 bool LayerTreeHost::Initialize(scoped_ptr<Thread> impl_thread) { | 110 bool LayerTreeHost::Initialize(scoped_ptr<Thread> impl_thread) { |
| 110 if (impl_thread) | 111 if (impl_thread) |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 settings_.minimum_occlusion_tracking_size); | 929 settings_.minimum_occlusion_tracking_size); |
| 929 | 930 |
| 930 PrioritizeTextures(render_surface_layer_list, | 931 PrioritizeTextures(render_surface_layer_list, |
| 931 occlusion_tracker.overdraw_metrics()); | 932 occlusion_tracker.overdraw_metrics()); |
| 932 | 933 |
| 933 // TODO(egraether): Use RenderingStatsInstrumentation in Layer::update() | 934 // TODO(egraether): Use RenderingStatsInstrumentation in Layer::update() |
| 934 RenderingStats stats; | 935 RenderingStats stats; |
| 935 RenderingStats* stats_ptr = | 936 RenderingStats* stats_ptr = |
| 936 debug_state_.RecordRenderingStats() ? &stats : NULL; | 937 debug_state_.RecordRenderingStats() ? &stats : NULL; |
| 937 | 938 |
| 939 in_paint_layer_contents_ = true; |
| 940 |
| 938 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list); | 941 LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list); |
| 939 for (LayerIteratorType it = | 942 for (LayerIteratorType it = |
| 940 LayerIteratorType::Begin(&render_surface_layer_list); | 943 LayerIteratorType::Begin(&render_surface_layer_list); |
| 941 it != end; | 944 it != end; |
| 942 ++it) { | 945 ++it) { |
| 943 occlusion_tracker.EnterLayer(it); | 946 occlusion_tracker.EnterLayer(it); |
| 944 | 947 |
| 945 if (it.represents_target_render_surface()) { | 948 if (it.represents_target_render_surface()) { |
| 946 DCHECK(it->render_surface()->draw_opacity() || | 949 DCHECK(it->render_surface()->draw_opacity() || |
| 947 it->render_surface()->draw_opacity_is_animating()); | 950 it->render_surface()->draw_opacity_is_animating()); |
| 948 need_more_updates |= PaintMasksForRenderSurface(*it, queue, stats_ptr); | 951 need_more_updates |= PaintMasksForRenderSurface(*it, queue, stats_ptr); |
| 949 } else if (it.represents_itself()) { | 952 } else if (it.represents_itself()) { |
| 950 DCHECK(!it->bounds().IsEmpty()); | 953 DCHECK(!it->bounds().IsEmpty()); |
| 951 it->Update(queue, &occlusion_tracker, stats_ptr); | 954 it->Update(queue, &occlusion_tracker, stats_ptr); |
| 952 need_more_updates |= it->NeedMoreUpdates(); | 955 need_more_updates |= it->NeedMoreUpdates(); |
| 953 } | 956 } |
| 954 | 957 |
| 955 occlusion_tracker.LeaveLayer(it); | 958 occlusion_tracker.LeaveLayer(it); |
| 956 } | 959 } |
| 957 | 960 |
| 961 in_paint_layer_contents_ = false; |
| 962 |
| 958 rendering_stats_instrumentation_->AddStats(stats); | 963 rendering_stats_instrumentation_->AddStats(stats); |
| 959 | 964 |
| 960 occlusion_tracker.overdraw_metrics()->RecordMetrics(this); | 965 occlusion_tracker.overdraw_metrics()->RecordMetrics(this); |
| 961 | 966 |
| 962 return need_more_updates; | 967 return need_more_updates; |
| 963 } | 968 } |
| 964 | 969 |
| 965 void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) { | 970 void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) { |
| 966 if (!root_layer_) | 971 if (!root_layer_) |
| 967 return; | 972 return; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 bool start_ready_animations = true; | 1085 bool start_ready_animations = true; |
| 1081 (*iter).second->UpdateState(start_ready_animations, NULL); | 1086 (*iter).second->UpdateState(start_ready_animations, NULL); |
| 1082 } | 1087 } |
| 1083 } | 1088 } |
| 1084 | 1089 |
| 1085 skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() { | 1090 skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() { |
| 1086 return proxy_->CapturePicture(); | 1091 return proxy_->CapturePicture(); |
| 1087 } | 1092 } |
| 1088 | 1093 |
| 1089 } // namespace cc | 1094 } // namespace cc |
| OLD | NEW |