Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 1131593007: NOT FOR REVIEW Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/containers/small_map.h" 14 #include "base/containers/small_map.h"
15 #include "base/json/json_writer.h" 15 #include "base/json/json_writer.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/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/trace_event/trace_event_argument.h" 19 #include "base/trace_event/trace_event_argument.h"
20 #include "cc/animation/animation_host.h"
20 #include "cc/animation/animation_id_provider.h" 21 #include "cc/animation/animation_id_provider.h"
21 #include "cc/animation/scroll_offset_animation_curve.h" 22 #include "cc/animation/scroll_offset_animation_curve.h"
22 #include "cc/animation/scrollbar_animation_controller.h" 23 #include "cc/animation/scrollbar_animation_controller.h"
23 #include "cc/animation/timing_function.h" 24 #include "cc/animation/timing_function.h"
24 #include "cc/base/math_util.h" 25 #include "cc/base/math_util.h"
25 #include "cc/base/util.h" 26 #include "cc/base/util.h"
26 #include "cc/debug/benchmark_instrumentation.h" 27 #include "cc/debug/benchmark_instrumentation.h"
27 #include "cc/debug/debug_rect_history.h" 28 #include "cc/debug/debug_rect_history.h"
28 #include "cc/debug/devtools_instrumentation.h" 29 #include "cc/debug/devtools_instrumentation.h"
29 #include "cc/debug/frame_rate_counter.h" 30 #include "cc/debug/frame_rate_counter.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 animation_registrar_(AnimationRegistrar::Create()), 223 animation_registrar_(AnimationRegistrar::Create()),
223 rendering_stats_instrumentation_(rendering_stats_instrumentation), 224 rendering_stats_instrumentation_(rendering_stats_instrumentation),
224 micro_benchmark_controller_(this), 225 micro_benchmark_controller_(this),
225 shared_bitmap_manager_(shared_bitmap_manager), 226 shared_bitmap_manager_(shared_bitmap_manager),
226 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), 227 gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
227 task_graph_runner_(task_graph_runner), 228 task_graph_runner_(task_graph_runner),
228 id_(id), 229 id_(id),
229 requires_high_res_to_draw_(false), 230 requires_high_res_to_draw_(false),
230 is_likely_to_require_a_draw_(false), 231 is_likely_to_require_a_draw_(false),
231 frame_timing_tracker_(FrameTimingTracker::Create()) { 232 frame_timing_tracker_(FrameTimingTracker::Create()) {
233 if (settings.use_compositor_animation_timelines) {
234 animation_host_ = AnimationHost::Create(true);
235 animation_host_->SetLayerTreeMutatorsClient(this);
236 }
237
232 DCHECK(proxy_->IsImplThread()); 238 DCHECK(proxy_->IsImplThread());
233 DidVisibilityChange(this, visible_); 239 DidVisibilityChange(this, visible_);
234 animation_registrar_->set_supports_scroll_animations( 240 animation_registrar_->set_supports_scroll_animations(
235 proxy_->SupportsImplScrolling()); 241 proxy_->SupportsImplScrolling());
236 242
237 SetDebugState(settings.initial_debug_state); 243 SetDebugState(settings.initial_debug_state);
238 244
239 // LTHI always has an active tree. 245 // LTHI always has an active tree.
240 active_tree_ = 246 active_tree_ =
241 LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), 247 LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(),
(...skipping 3131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3373 new_target.SetToMax(gfx::ScrollOffset()); 3379 new_target.SetToMax(gfx::ScrollOffset());
3374 new_target.SetToMin(layer_impl->MaxScrollOffset()); 3380 new_target.SetToMin(layer_impl->MaxScrollOffset());
3375 3381
3376 curve->UpdateTarget( 3382 curve->UpdateTarget(
3377 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) 3383 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time)
3378 .InSecondsF(), 3384 .InSecondsF(),
3379 new_target); 3385 new_target);
3380 3386
3381 return true; 3387 return true;
3382 } 3388 }
3389
3390 bool LayerTreeHostImpl::IsLayerInActiveTree(int layer_id) const {
3391 return active_tree() ? active_tree()->LayerById(layer_id) != nullptr : false;
3392 }
3393
3394 bool LayerTreeHostImpl::IsLayerInPendingTree(int layer_id) const {
3395 if (pending_tree() && pending_tree()->LayerById(layer_id))
3396 return true;
3397 if (recycle_tree() && recycle_tree()->LayerById(layer_id))
3398 return true;
3399
3400 return false;
3401 }
3402
3403 void LayerTreeHostImpl::SetMutatorsNeedCommit() {
3404 SetNeedsCommit();
3405 }
3406
3407 void LayerTreeHostImpl::SetTreeLayerFilterMutated(
3408 int layer_id,
3409 LayerTreeImpl* tree,
3410 const FilterOperations& filters) {
3411 if (!tree)
3412 return;
3413
3414 LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
3415 if (layer)
3416 layer->OnFilterAnimated(filters);
3417 }
3418
3419 void LayerTreeHostImpl::SetTreeLayerOpacityMutated(int layer_id,
3420 LayerTreeImpl* tree,
3421 float opacity) {
3422 if (!tree)
3423 return;
3424
3425 LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
3426 if (layer)
3427 layer->OnOpacityAnimated(opacity);
3428 }
3429
3430 void LayerTreeHostImpl::SetTreeLayerTransformMutated(
3431 int layer_id,
3432 LayerTreeImpl* tree,
3433 const gfx::Transform& transform) {
3434 if (!tree)
3435 return;
3436
3437 LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
3438 if (layer)
3439 layer->OnTransformAnimated(transform);
3440 }
3441
3442 void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated(
3443 int layer_id,
3444 LayerTreeImpl* tree,
3445 const gfx::ScrollOffset& scroll_offset) {
3446 if (!tree)
3447 return;
3448
3449 LayerAnimationValueObserver* layer = tree->LayerById(layer_id);
3450 if (layer)
3451 layer->OnScrollOffsetAnimated(scroll_offset);
3452 }
3453
3454 void LayerTreeHostImpl::SetLayerFilterMutated(int layer_id,
3455 bool affects_active_tree,
3456 const FilterOperations& filters) {
3457 if (affects_active_tree) {
3458 SetTreeLayerFilterMutated(layer_id, active_tree(), filters);
3459 } else {
3460 SetTreeLayerFilterMutated(layer_id, pending_tree(), filters);
3461 SetTreeLayerFilterMutated(layer_id, recycle_tree(), filters);
3462 }
3463 }
3464
3465 void LayerTreeHostImpl::SetLayerOpacityMutated(int layer_id,
3466 bool affects_active_tree,
3467 float opacity) {
3468 if (affects_active_tree) {
3469 SetTreeLayerOpacityMutated(layer_id, active_tree(), opacity);
3470 } else {
3471 SetTreeLayerOpacityMutated(layer_id, pending_tree(), opacity);
3472 SetTreeLayerOpacityMutated(layer_id, recycle_tree(), opacity);
3473 }
3474 }
3475
3476 void LayerTreeHostImpl::SetLayerTransformMutated(
3477 int layer_id,
3478 bool affects_active_tree,
3479 const gfx::Transform& transform) {
3480 if (affects_active_tree) {
3481 SetTreeLayerTransformMutated(layer_id, active_tree(), transform);
3482 } else {
3483 SetTreeLayerTransformMutated(layer_id, pending_tree(), transform);
3484 SetTreeLayerTransformMutated(layer_id, recycle_tree(), transform);
3485 }
3486 }
3487
3488 void LayerTreeHostImpl::SetLayerScrollOffsetMutated(
3489 int layer_id,
3490 bool affects_active_tree,
3491 const gfx::ScrollOffset& scroll_offset) {
3492 if (affects_active_tree) {
3493 SetTreeLayerScrollOffsetMutated(layer_id, active_tree(), scroll_offset);
3494 } else {
3495 SetTreeLayerScrollOffsetMutated(layer_id, pending_tree(), scroll_offset);
3496 SetTreeLayerScrollOffsetMutated(layer_id, recycle_tree(), scroll_offset);
3497 }
3498 }
3499
3383 } // namespace cc 3500 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698