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/debug/trace_event_argument.h" | 15 #include "base/debug/trace_event_argument.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "cc/animation/animation_registrar.h" | 20 #include "cc/animation/animation_registrar.h" |
21 #include "cc/animation/layer_animation_controller.h" | 21 #include "cc/animation/layer_animation_controller.h" |
22 #include "cc/base/math_util.h" | 22 #include "cc/base/math_util.h" |
23 #include "cc/debug/devtools_instrumentation.h" | 23 #include "cc/debug/devtools_instrumentation.h" |
24 #include "cc/debug/rendering_stats_instrumentation.h" | 24 #include "cc/debug/rendering_stats_instrumentation.h" |
25 #include "cc/input/layer_selection_bound.h" | 25 #include "cc/input/layer_selection_bound.h" |
| 26 #include "cc/input/page_scale_animation.h" |
26 #include "cc/input/top_controls_manager.h" | 27 #include "cc/input/top_controls_manager.h" |
27 #include "cc/layers/heads_up_display_layer.h" | 28 #include "cc/layers/heads_up_display_layer.h" |
28 #include "cc/layers/heads_up_display_layer_impl.h" | 29 #include "cc/layers/heads_up_display_layer_impl.h" |
29 #include "cc/layers/layer.h" | 30 #include "cc/layers/layer.h" |
30 #include "cc/layers/layer_iterator.h" | 31 #include "cc/layers/layer_iterator.h" |
31 #include "cc/layers/painted_scrollbar_layer.h" | 32 #include "cc/layers/painted_scrollbar_layer.h" |
32 #include "cc/layers/render_surface.h" | 33 #include "cc/layers/render_surface.h" |
33 #include "cc/resources/prioritized_resource_manager.h" | 34 #include "cc/resources/prioritized_resource_manager.h" |
34 #include "cc/resources/ui_resource_request.h" | 35 #include "cc/resources/ui_resource_request.h" |
35 #include "cc/scheduler/begin_frame_source.h" | 36 #include "cc/scheduler/begin_frame_source.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 sync_tree->sent_top_controls_delta()); | 375 sync_tree->sent_top_controls_delta()); |
375 sync_tree->set_sent_top_controls_delta(0.f); | 376 sync_tree->set_sent_top_controls_delta(0.f); |
376 | 377 |
377 host_impl->SetUseGpuRasterization(UseGpuRasterization()); | 378 host_impl->SetUseGpuRasterization(UseGpuRasterization()); |
378 RecordGpuRasterizationHistogram(); | 379 RecordGpuRasterizationHistogram(); |
379 | 380 |
380 host_impl->SetViewportSize(device_viewport_size_); | 381 host_impl->SetViewportSize(device_viewport_size_); |
381 host_impl->SetDeviceScaleFactor(device_scale_factor_); | 382 host_impl->SetDeviceScaleFactor(device_scale_factor_); |
382 host_impl->SetDebugState(debug_state_); | 383 host_impl->SetDebugState(debug_state_); |
383 if (pending_page_scale_animation_) { | 384 if (pending_page_scale_animation_) { |
384 sync_tree->SetPageScaleAnimation( | 385 sync_tree->SetPendingPageScaleAnimation( |
385 pending_page_scale_animation_->target_offset, | 386 pending_page_scale_animation_.Pass()); |
386 pending_page_scale_animation_->use_anchor, | |
387 pending_page_scale_animation_->scale, | |
388 pending_page_scale_animation_->duration); | |
389 pending_page_scale_animation_ = nullptr; | |
390 } | 387 } |
391 | 388 |
392 if (!ui_resource_request_queue_.empty()) { | 389 if (!ui_resource_request_queue_.empty()) { |
393 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); | 390 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); |
394 ui_resource_request_queue_.clear(); | 391 ui_resource_request_queue_.clear(); |
395 } | 392 } |
396 if (overhang_ui_resource_) { | 393 if (overhang_ui_resource_) { |
397 host_impl->SetOverhangUIResource( | 394 host_impl->SetOverhangUIResource( |
398 overhang_ui_resource_->id(), | 395 overhang_ui_resource_->id(), |
399 GetUIResourceSize(overhang_ui_resource_->id())); | 396 GetUIResourceSize(overhang_ui_resource_->id())); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 visible_ = visible; | 714 visible_ = visible; |
718 if (!visible) | 715 if (!visible) |
719 ReduceMemoryUsage(); | 716 ReduceMemoryUsage(); |
720 proxy_->SetVisible(visible); | 717 proxy_->SetVisible(visible); |
721 } | 718 } |
722 | 719 |
723 void LayerTreeHost::StartPageScaleAnimation(const gfx::Vector2d& target_offset, | 720 void LayerTreeHost::StartPageScaleAnimation(const gfx::Vector2d& target_offset, |
724 bool use_anchor, | 721 bool use_anchor, |
725 float scale, | 722 float scale, |
726 base::TimeDelta duration) { | 723 base::TimeDelta duration) { |
727 pending_page_scale_animation_.reset(new PendingPageScaleAnimation); | 724 pending_page_scale_animation_.reset( |
728 pending_page_scale_animation_->target_offset = target_offset; | 725 new PendingPageScaleAnimation( |
729 pending_page_scale_animation_->use_anchor = use_anchor; | 726 target_offset, |
730 pending_page_scale_animation_->scale = scale; | 727 use_anchor, |
731 pending_page_scale_animation_->duration = duration; | 728 scale, |
| 729 duration)); |
732 | 730 |
733 SetNeedsCommit(); | 731 SetNeedsCommit(); |
734 } | 732 } |
735 | 733 |
736 void LayerTreeHost::NotifyInputThrottledUntilCommit() { | 734 void LayerTreeHost::NotifyInputThrottledUntilCommit() { |
737 proxy_->NotifyInputThrottledUntilCommit(); | 735 proxy_->NotifyInputThrottledUntilCommit(); |
738 } | 736 } |
739 | 737 |
740 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { | 738 void LayerTreeHost::Composite(base::TimeTicks frame_begin_time) { |
741 DCHECK(!proxy_->HasImplThread()); | 739 DCHECK(!proxy_->HasImplThread()); |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 | 1344 |
1347 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { | 1345 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { |
1348 surface_id_namespace_ = id_namespace; | 1346 surface_id_namespace_ = id_namespace; |
1349 } | 1347 } |
1350 | 1348 |
1351 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | 1349 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { |
1352 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); | 1350 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); |
1353 } | 1351 } |
1354 | 1352 |
1355 } // namespace cc | 1353 } // namespace cc |
OLD | NEW |