| 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 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/atomic_sequence_num.h" | 11 #include "base/atomic_sequence_num.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "cc/animation/animation_registrar.h" | 19 #include "cc/animation/animation_registrar.h" |
| 20 #include "cc/animation/layer_animation_controller.h" | 20 #include "cc/animation/layer_animation_controller.h" |
| 21 #include "cc/base/math_util.h" | 21 #include "cc/base/math_util.h" |
| 22 #include "cc/debug/devtools_instrumentation.h" | 22 #include "cc/debug/devtools_instrumentation.h" |
| 23 #include "cc/debug/rendering_stats_instrumentation.h" | 23 #include "cc/debug/rendering_stats_instrumentation.h" |
| 24 #include "cc/input/layer_selection_bound.h" |
| 24 #include "cc/input/top_controls_manager.h" | 25 #include "cc/input/top_controls_manager.h" |
| 25 #include "cc/layers/heads_up_display_layer.h" | 26 #include "cc/layers/heads_up_display_layer.h" |
| 26 #include "cc/layers/heads_up_display_layer_impl.h" | 27 #include "cc/layers/heads_up_display_layer_impl.h" |
| 27 #include "cc/layers/layer.h" | 28 #include "cc/layers/layer.h" |
| 28 #include "cc/layers/layer_iterator.h" | 29 #include "cc/layers/layer_iterator.h" |
| 29 #include "cc/layers/painted_scrollbar_layer.h" | 30 #include "cc/layers/painted_scrollbar_layer.h" |
| 30 #include "cc/layers/render_surface.h" | 31 #include "cc/layers/render_surface.h" |
| 31 #include "cc/resources/prioritized_resource_manager.h" | 32 #include "cc/resources/prioritized_resource_manager.h" |
| 32 #include "cc/resources/ui_resource_request.h" | 33 #include "cc/resources/ui_resource_request.h" |
| 33 #include "cc/trees/layer_tree_host_client.h" | 34 #include "cc/trees/layer_tree_host_client.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (page_scale_layer_ && inner_viewport_scroll_layer_) { | 309 if (page_scale_layer_ && inner_viewport_scroll_layer_) { |
| 309 sync_tree->SetViewportLayersFromIds( | 310 sync_tree->SetViewportLayersFromIds( |
| 310 page_scale_layer_->id(), | 311 page_scale_layer_->id(), |
| 311 inner_viewport_scroll_layer_->id(), | 312 inner_viewport_scroll_layer_->id(), |
| 312 outer_viewport_scroll_layer_ ? outer_viewport_scroll_layer_->id() | 313 outer_viewport_scroll_layer_ ? outer_viewport_scroll_layer_->id() |
| 313 : Layer::INVALID_ID); | 314 : Layer::INVALID_ID); |
| 314 } else { | 315 } else { |
| 315 sync_tree->ClearViewportLayers(); | 316 sync_tree->ClearViewportLayers(); |
| 316 } | 317 } |
| 317 | 318 |
| 319 sync_tree->RegisterSelection(selection_anchor_, selection_focus_); |
| 320 |
| 318 float page_scale_delta = | 321 float page_scale_delta = |
| 319 sync_tree->page_scale_delta() / sync_tree->sent_page_scale_delta(); | 322 sync_tree->page_scale_delta() / sync_tree->sent_page_scale_delta(); |
| 320 sync_tree->SetPageScaleValues(page_scale_factor_, | 323 sync_tree->SetPageScaleValues(page_scale_factor_, |
| 321 min_page_scale_factor_, | 324 min_page_scale_factor_, |
| 322 max_page_scale_factor_, | 325 max_page_scale_factor_, |
| 323 page_scale_delta); | 326 page_scale_delta); |
| 324 sync_tree->set_sent_page_scale_delta(1.f); | 327 sync_tree->set_sent_page_scale_delta(1.f); |
| 325 | 328 |
| 326 sync_tree->PassSwapPromises(&swap_promise_list_); | 329 sync_tree->PassSwapPromises(&swap_promise_list_); |
| 327 | 330 |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 | 1217 |
| 1215 void LayerTreeHost::RegisterViewportLayers( | 1218 void LayerTreeHost::RegisterViewportLayers( |
| 1216 scoped_refptr<Layer> page_scale_layer, | 1219 scoped_refptr<Layer> page_scale_layer, |
| 1217 scoped_refptr<Layer> inner_viewport_scroll_layer, | 1220 scoped_refptr<Layer> inner_viewport_scroll_layer, |
| 1218 scoped_refptr<Layer> outer_viewport_scroll_layer) { | 1221 scoped_refptr<Layer> outer_viewport_scroll_layer) { |
| 1219 page_scale_layer_ = page_scale_layer; | 1222 page_scale_layer_ = page_scale_layer; |
| 1220 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; | 1223 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; |
| 1221 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; | 1224 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; |
| 1222 } | 1225 } |
| 1223 | 1226 |
| 1227 void LayerTreeHost::RegisterSelection(const LayerSelectionBound& anchor, |
| 1228 const LayerSelectionBound& focus) { |
| 1229 if (selection_anchor_ == anchor && selection_focus_ == focus) |
| 1230 return; |
| 1231 |
| 1232 selection_anchor_ = anchor; |
| 1233 selection_focus_ = focus; |
| 1234 SetNeedsCommit(); |
| 1235 } |
| 1236 |
| 1224 int LayerTreeHost::ScheduleMicroBenchmark( | 1237 int LayerTreeHost::ScheduleMicroBenchmark( |
| 1225 const std::string& benchmark_name, | 1238 const std::string& benchmark_name, |
| 1226 scoped_ptr<base::Value> value, | 1239 scoped_ptr<base::Value> value, |
| 1227 const MicroBenchmark::DoneCallback& callback) { | 1240 const MicroBenchmark::DoneCallback& callback) { |
| 1228 return micro_benchmark_controller_.ScheduleRun( | 1241 return micro_benchmark_controller_.ScheduleRun( |
| 1229 benchmark_name, value.Pass(), callback); | 1242 benchmark_name, value.Pass(), callback); |
| 1230 } | 1243 } |
| 1231 | 1244 |
| 1232 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, | 1245 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, |
| 1233 scoped_ptr<base::Value> value) { | 1246 scoped_ptr<base::Value> value) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1255 swap_promise_list_.push_back(swap_promise.Pass()); | 1268 swap_promise_list_.push_back(swap_promise.Pass()); |
| 1256 } | 1269 } |
| 1257 | 1270 |
| 1258 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1271 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
| 1259 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1272 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
| 1260 swap_promise_list_[i]->DidNotSwap(reason); | 1273 swap_promise_list_[i]->DidNotSwap(reason); |
| 1261 swap_promise_list_.clear(); | 1274 swap_promise_list_.clear(); |
| 1262 } | 1275 } |
| 1263 | 1276 |
| 1264 } // namespace cc | 1277 } // namespace cc |
| OLD | NEW |