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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 if (page_scale_layer_ && inner_viewport_scroll_layer_) { | 322 if (page_scale_layer_ && inner_viewport_scroll_layer_) { |
322 sync_tree->SetViewportLayersFromIds( | 323 sync_tree->SetViewportLayersFromIds( |
323 page_scale_layer_->id(), | 324 page_scale_layer_->id(), |
324 inner_viewport_scroll_layer_->id(), | 325 inner_viewport_scroll_layer_->id(), |
325 outer_viewport_scroll_layer_ ? outer_viewport_scroll_layer_->id() | 326 outer_viewport_scroll_layer_ ? outer_viewport_scroll_layer_->id() |
326 : Layer::INVALID_ID); | 327 : Layer::INVALID_ID); |
327 } else { | 328 } else { |
328 sync_tree->ClearViewportLayers(); | 329 sync_tree->ClearViewportLayers(); |
329 } | 330 } |
330 | 331 |
| 332 sync_tree->RegisterSelection(selection_anchor_, selection_focus_); |
| 333 |
331 float page_scale_delta, sent_page_scale_delta; | 334 float page_scale_delta, sent_page_scale_delta; |
332 if (settings_.impl_side_painting) { | 335 if (settings_.impl_side_painting) { |
333 // Update the delta from the active tree, which may have | 336 // Update the delta from the active tree, which may have |
334 // adjusted its delta prior to the pending tree being created. | 337 // adjusted its delta prior to the pending tree being created. |
335 // This code is equivalent to that in LayerTreeImpl::SetPageScaleDelta. | 338 // This code is equivalent to that in LayerTreeImpl::SetPageScaleDelta. |
336 DCHECK_EQ(1.f, sync_tree->sent_page_scale_delta()); | 339 DCHECK_EQ(1.f, sync_tree->sent_page_scale_delta()); |
337 page_scale_delta = host_impl->active_tree()->page_scale_delta(); | 340 page_scale_delta = host_impl->active_tree()->page_scale_delta(); |
338 sent_page_scale_delta = host_impl->active_tree()->sent_page_scale_delta(); | 341 sent_page_scale_delta = host_impl->active_tree()->sent_page_scale_delta(); |
339 } else { | 342 } else { |
340 page_scale_delta = sync_tree->page_scale_delta(); | 343 page_scale_delta = sync_tree->page_scale_delta(); |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 | 1253 |
1251 void LayerTreeHost::RegisterViewportLayers( | 1254 void LayerTreeHost::RegisterViewportLayers( |
1252 scoped_refptr<Layer> page_scale_layer, | 1255 scoped_refptr<Layer> page_scale_layer, |
1253 scoped_refptr<Layer> inner_viewport_scroll_layer, | 1256 scoped_refptr<Layer> inner_viewport_scroll_layer, |
1254 scoped_refptr<Layer> outer_viewport_scroll_layer) { | 1257 scoped_refptr<Layer> outer_viewport_scroll_layer) { |
1255 page_scale_layer_ = page_scale_layer; | 1258 page_scale_layer_ = page_scale_layer; |
1256 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; | 1259 inner_viewport_scroll_layer_ = inner_viewport_scroll_layer; |
1257 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; | 1260 outer_viewport_scroll_layer_ = outer_viewport_scroll_layer; |
1258 } | 1261 } |
1259 | 1262 |
| 1263 void LayerTreeHost::RegisterSelection(const LayerSelectionBound& anchor, |
| 1264 const LayerSelectionBound& focus) { |
| 1265 if (selection_anchor_ == anchor && selection_focus_ == focus) |
| 1266 return; |
| 1267 |
| 1268 selection_anchor_ = anchor; |
| 1269 selection_focus_ = focus; |
| 1270 SetNeedsCommit(); |
| 1271 } |
| 1272 |
1260 int LayerTreeHost::ScheduleMicroBenchmark( | 1273 int LayerTreeHost::ScheduleMicroBenchmark( |
1261 const std::string& benchmark_name, | 1274 const std::string& benchmark_name, |
1262 scoped_ptr<base::Value> value, | 1275 scoped_ptr<base::Value> value, |
1263 const MicroBenchmark::DoneCallback& callback) { | 1276 const MicroBenchmark::DoneCallback& callback) { |
1264 return micro_benchmark_controller_.ScheduleRun( | 1277 return micro_benchmark_controller_.ScheduleRun( |
1265 benchmark_name, value.Pass(), callback); | 1278 benchmark_name, value.Pass(), callback); |
1266 } | 1279 } |
1267 | 1280 |
1268 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, | 1281 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, |
1269 scoped_ptr<base::Value> value) { | 1282 scoped_ptr<base::Value> value) { |
(...skipping 21 matching lines...) Expand all Loading... |
1291 swap_promise_list_.push_back(swap_promise.Pass()); | 1304 swap_promise_list_.push_back(swap_promise.Pass()); |
1292 } | 1305 } |
1293 | 1306 |
1294 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1307 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1295 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1308 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1296 swap_promise_list_[i]->DidNotSwap(reason); | 1309 swap_promise_list_[i]->DidNotSwap(reason); |
1297 swap_promise_list_.clear(); | 1310 swap_promise_list_.clear(); |
1298 } | 1311 } |
1299 | 1312 |
1300 } // namespace cc | 1313 } // namespace cc |
OLD | NEW |