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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 painted_device_scale_factor_(1.f), | 176 painted_device_scale_factor_(1.f), |
177 visible_(false), | 177 visible_(false), |
178 page_scale_factor_(1.f), | 178 page_scale_factor_(1.f), |
179 min_page_scale_factor_(1.f), | 179 min_page_scale_factor_(1.f), |
180 max_page_scale_factor_(1.f), | 180 max_page_scale_factor_(1.f), |
181 has_gpu_rasterization_trigger_(false), | 181 has_gpu_rasterization_trigger_(false), |
182 content_is_suitable_for_gpu_rasterization_(true), | 182 content_is_suitable_for_gpu_rasterization_(true), |
183 gpu_rasterization_histogram_recorded_(false), | 183 gpu_rasterization_histogram_recorded_(false), |
184 background_color_(SK_ColorWHITE), | 184 background_color_(SK_ColorWHITE), |
185 has_transparent_background_(false), | 185 has_transparent_background_(false), |
| 186 have_wheel_event_handlers_(false), |
186 did_complete_scale_animation_(false), | 187 did_complete_scale_animation_(false), |
187 in_paint_layer_contents_(false), | 188 in_paint_layer_contents_(false), |
188 id_(s_layer_tree_host_sequence_number.GetNext() + 1), | 189 id_(s_layer_tree_host_sequence_number.GetNext() + 1), |
189 next_commit_forces_redraw_(false), | 190 next_commit_forces_redraw_(false), |
190 shared_bitmap_manager_(params->shared_bitmap_manager), | 191 shared_bitmap_manager_(params->shared_bitmap_manager), |
191 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), | 192 gpu_memory_buffer_manager_(params->gpu_memory_buffer_manager), |
192 task_graph_runner_(params->task_graph_runner), | 193 task_graph_runner_(params->task_graph_runner), |
193 surface_id_namespace_(0u), | 194 surface_id_namespace_(0u), |
194 next_surface_sequence_(1u) { | 195 next_surface_sequence_(1u) { |
195 DCHECK(task_graph_runner_); | 196 DCHECK(task_graph_runner_); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (hud_layer_.get()) { | 385 if (hud_layer_.get()) { |
385 LayerImpl* hud_impl = LayerTreeHostCommon::FindLayerInSubtree( | 386 LayerImpl* hud_impl = LayerTreeHostCommon::FindLayerInSubtree( |
386 sync_tree->root_layer(), hud_layer_->id()); | 387 sync_tree->root_layer(), hud_layer_->id()); |
387 sync_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(hud_impl)); | 388 sync_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(hud_impl)); |
388 } else { | 389 } else { |
389 sync_tree->set_hud_layer(NULL); | 390 sync_tree->set_hud_layer(NULL); |
390 } | 391 } |
391 | 392 |
392 sync_tree->set_background_color(background_color_); | 393 sync_tree->set_background_color(background_color_); |
393 sync_tree->set_has_transparent_background(has_transparent_background_); | 394 sync_tree->set_has_transparent_background(has_transparent_background_); |
| 395 sync_tree->set_have_wheel_event_handlers(have_wheel_event_handlers_); |
394 | 396 |
395 if (page_scale_layer_.get() && inner_viewport_scroll_layer_.get()) { | 397 if (page_scale_layer_.get() && inner_viewport_scroll_layer_.get()) { |
396 sync_tree->SetViewportLayersFromIds( | 398 sync_tree->SetViewportLayersFromIds( |
397 overscroll_elasticity_layer_.get() ? overscroll_elasticity_layer_->id() | 399 overscroll_elasticity_layer_.get() ? overscroll_elasticity_layer_->id() |
398 : Layer::INVALID_ID, | 400 : Layer::INVALID_ID, |
399 page_scale_layer_->id(), inner_viewport_scroll_layer_->id(), | 401 page_scale_layer_->id(), inner_viewport_scroll_layer_->id(), |
400 outer_viewport_scroll_layer_.get() ? outer_viewport_scroll_layer_->id() | 402 outer_viewport_scroll_layer_.get() ? outer_viewport_scroll_layer_->id() |
401 : Layer::INVALID_ID); | 403 : Layer::INVALID_ID); |
402 DCHECK(inner_viewport_scroll_layer_->IsContainerForFixedPositionLayers()); | 404 DCHECK(inner_viewport_scroll_layer_->IsContainerForFixedPositionLayers()); |
403 } else { | 405 } else { |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 } | 1100 } |
1099 | 1101 |
1100 void LayerTreeHost::RegisterSelection(const LayerSelection& selection) { | 1102 void LayerTreeHost::RegisterSelection(const LayerSelection& selection) { |
1101 if (selection_ == selection) | 1103 if (selection_ == selection) |
1102 return; | 1104 return; |
1103 | 1105 |
1104 selection_ = selection; | 1106 selection_ = selection; |
1105 SetNeedsCommit(); | 1107 SetNeedsCommit(); |
1106 } | 1108 } |
1107 | 1109 |
| 1110 void LayerTreeHost::SetHaveWheelEventHandlers(bool have_event_handlers) { |
| 1111 if (have_wheel_event_handlers_ == have_event_handlers) |
| 1112 return; |
| 1113 |
| 1114 have_wheel_event_handlers_ = have_event_handlers; |
| 1115 SetNeedsCommit(); |
| 1116 } |
| 1117 |
1108 int LayerTreeHost::ScheduleMicroBenchmark( | 1118 int LayerTreeHost::ScheduleMicroBenchmark( |
1109 const std::string& benchmark_name, | 1119 const std::string& benchmark_name, |
1110 scoped_ptr<base::Value> value, | 1120 scoped_ptr<base::Value> value, |
1111 const MicroBenchmark::DoneCallback& callback) { | 1121 const MicroBenchmark::DoneCallback& callback) { |
1112 return micro_benchmark_controller_.ScheduleRun(benchmark_name, | 1122 return micro_benchmark_controller_.ScheduleRun(benchmark_name, |
1113 std::move(value), callback); | 1123 std::move(value), callback); |
1114 } | 1124 } |
1115 | 1125 |
1116 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, | 1126 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, |
1117 scoped_ptr<base::Value> value) { | 1127 scoped_ptr<base::Value> value) { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 proto->set_painted_device_scale_factor(painted_device_scale_factor_); | 1433 proto->set_painted_device_scale_factor(painted_device_scale_factor_); |
1424 proto->set_page_scale_factor(page_scale_factor_); | 1434 proto->set_page_scale_factor(page_scale_factor_); |
1425 proto->set_min_page_scale_factor(min_page_scale_factor_); | 1435 proto->set_min_page_scale_factor(min_page_scale_factor_); |
1426 proto->set_max_page_scale_factor(max_page_scale_factor_); | 1436 proto->set_max_page_scale_factor(max_page_scale_factor_); |
1427 Vector2dFToProto(elastic_overscroll_, proto->mutable_elastic_overscroll()); | 1437 Vector2dFToProto(elastic_overscroll_, proto->mutable_elastic_overscroll()); |
1428 proto->set_has_gpu_rasterization_trigger(has_gpu_rasterization_trigger_); | 1438 proto->set_has_gpu_rasterization_trigger(has_gpu_rasterization_trigger_); |
1429 proto->set_content_is_suitable_for_gpu_rasterization( | 1439 proto->set_content_is_suitable_for_gpu_rasterization( |
1430 content_is_suitable_for_gpu_rasterization_); | 1440 content_is_suitable_for_gpu_rasterization_); |
1431 proto->set_background_color(background_color_); | 1441 proto->set_background_color(background_color_); |
1432 proto->set_has_transparent_background(has_transparent_background_); | 1442 proto->set_has_transparent_background(has_transparent_background_); |
| 1443 proto->set_have_wheel_event_handlers(have_wheel_event_handlers_); |
1433 proto->set_in_paint_layer_contents(in_paint_layer_contents_); | 1444 proto->set_in_paint_layer_contents(in_paint_layer_contents_); |
1434 proto->set_id(id_); | 1445 proto->set_id(id_); |
1435 proto->set_next_commit_forces_redraw(next_commit_forces_redraw_); | 1446 proto->set_next_commit_forces_redraw(next_commit_forces_redraw_); |
1436 | 1447 |
1437 // Viewport layers. | 1448 // Viewport layers. |
1438 proto->set_overscroll_elasticity_layer_id( | 1449 proto->set_overscroll_elasticity_layer_id( |
1439 overscroll_elasticity_layer_ ? overscroll_elasticity_layer_->id() | 1450 overscroll_elasticity_layer_ ? overscroll_elasticity_layer_->id() |
1440 : Layer::INVALID_ID); | 1451 : Layer::INVALID_ID); |
1441 proto->set_page_scale_layer_id(page_scale_layer_ ? page_scale_layer_->id() | 1452 proto->set_page_scale_layer_id(page_scale_layer_ ? page_scale_layer_->id() |
1442 : Layer::INVALID_ID); | 1453 : Layer::INVALID_ID); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 painted_device_scale_factor_ = proto.painted_device_scale_factor(); | 1498 painted_device_scale_factor_ = proto.painted_device_scale_factor(); |
1488 page_scale_factor_ = proto.page_scale_factor(); | 1499 page_scale_factor_ = proto.page_scale_factor(); |
1489 min_page_scale_factor_ = proto.min_page_scale_factor(); | 1500 min_page_scale_factor_ = proto.min_page_scale_factor(); |
1490 max_page_scale_factor_ = proto.max_page_scale_factor(); | 1501 max_page_scale_factor_ = proto.max_page_scale_factor(); |
1491 elastic_overscroll_ = ProtoToVector2dF(proto.elastic_overscroll()); | 1502 elastic_overscroll_ = ProtoToVector2dF(proto.elastic_overscroll()); |
1492 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); | 1503 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); |
1493 content_is_suitable_for_gpu_rasterization_ = | 1504 content_is_suitable_for_gpu_rasterization_ = |
1494 proto.content_is_suitable_for_gpu_rasterization(); | 1505 proto.content_is_suitable_for_gpu_rasterization(); |
1495 background_color_ = proto.background_color(); | 1506 background_color_ = proto.background_color(); |
1496 has_transparent_background_ = proto.has_transparent_background(); | 1507 has_transparent_background_ = proto.has_transparent_background(); |
| 1508 have_wheel_event_handlers_ = proto.have_wheel_event_handlers(); |
1497 in_paint_layer_contents_ = proto.in_paint_layer_contents(); | 1509 in_paint_layer_contents_ = proto.in_paint_layer_contents(); |
1498 id_ = proto.id(); | 1510 id_ = proto.id(); |
1499 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); | 1511 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); |
1500 | 1512 |
1501 hud_layer_ = static_cast<HeadsUpDisplayLayer*>( | 1513 hud_layer_ = static_cast<HeadsUpDisplayLayer*>( |
1502 UpdateAndGetLayer(hud_layer_.get(), proto.hud_layer_id(), layer_id_map_)); | 1514 UpdateAndGetLayer(hud_layer_.get(), proto.hud_layer_id(), layer_id_map_)); |
1503 overscroll_elasticity_layer_ = | 1515 overscroll_elasticity_layer_ = |
1504 UpdateAndGetLayer(overscroll_elasticity_layer_.get(), | 1516 UpdateAndGetLayer(overscroll_elasticity_layer_.get(), |
1505 proto.overscroll_elasticity_layer_id(), layer_id_map_); | 1517 proto.overscroll_elasticity_layer_id(), layer_id_map_); |
1506 page_scale_layer_ = UpdateAndGetLayer( | 1518 page_scale_layer_ = UpdateAndGetLayer( |
(...skipping 20 matching lines...) Expand all Loading... |
1527 LayerTreeHostCommon::CallFunctionForSubtree( | 1539 LayerTreeHostCommon::CallFunctionForSubtree( |
1528 root_layer(), [seq_num](Layer* layer) { | 1540 root_layer(), [seq_num](Layer* layer) { |
1529 layer->set_property_tree_sequence_number(seq_num); | 1541 layer->set_property_tree_sequence_number(seq_num); |
1530 }); | 1542 }); |
1531 | 1543 |
1532 surface_id_namespace_ = proto.surface_id_namespace(); | 1544 surface_id_namespace_ = proto.surface_id_namespace(); |
1533 next_surface_sequence_ = proto.next_surface_sequence(); | 1545 next_surface_sequence_ = proto.next_surface_sequence(); |
1534 } | 1546 } |
1535 | 1547 |
1536 } // namespace cc | 1548 } // namespace cc |
OLD | NEW |