| 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_impl.h" |     5 #include "cc/trees/layer_tree_host_impl.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> | 
|    11 #include <limits> |    11 #include <limits> | 
|    12 #include <map> |    12 #include <map> | 
|    13 #include <set> |    13 #include <set> | 
|    14 #include <unordered_map> |    14 #include <unordered_map> | 
|    15 #include <utility> |    15 #include <utility> | 
|    16  |    16  | 
|    17 #include "base/auto_reset.h" |    17 #include "base/auto_reset.h" | 
 |    18 #include "base/bind.h" | 
|    18 #include "base/containers/small_map.h" |    19 #include "base/containers/small_map.h" | 
|    19 #include "base/json/json_writer.h" |    20 #include "base/json/json_writer.h" | 
|    20 #include "base/metrics/histogram.h" |    21 #include "base/metrics/histogram.h" | 
|    21 #include "base/numerics/safe_conversions.h" |    22 #include "base/numerics/safe_conversions.h" | 
|    22 #include "base/stl_util.h" |    23 #include "base/stl_util.h" | 
|    23 #include "base/strings/stringprintf.h" |    24 #include "base/strings/stringprintf.h" | 
|    24 #include "base/trace_event/trace_event_argument.h" |    25 #include "base/trace_event/trace_event_argument.h" | 
|    25 #include "cc/animation/animation_events.h" |    26 #include "cc/animation/animation_events.h" | 
|    26 #include "cc/animation/animation_host.h" |    27 #include "cc/animation/animation_host.h" | 
|    27 #include "cc/animation/animation_id_provider.h" |    28 #include "cc/animation/animation_id_provider.h" | 
 |    29 #include "cc/animation/layer_tree_mutations_callback.h" | 
|    28 #include "cc/animation/scroll_offset_animation_curve.h" |    30 #include "cc/animation/scroll_offset_animation_curve.h" | 
|    29 #include "cc/animation/timing_function.h" |    31 #include "cc/animation/timing_function.h" | 
|    30 #include "cc/base/histograms.h" |    32 #include "cc/base/histograms.h" | 
|    31 #include "cc/base/math_util.h" |    33 #include "cc/base/math_util.h" | 
|    32 #include "cc/debug/benchmark_instrumentation.h" |    34 #include "cc/debug/benchmark_instrumentation.h" | 
|    33 #include "cc/debug/debug_rect_history.h" |    35 #include "cc/debug/debug_rect_history.h" | 
|    34 #include "cc/debug/devtools_instrumentation.h" |    36 #include "cc/debug/devtools_instrumentation.h" | 
|    35 #include "cc/debug/frame_rate_counter.h" |    37 #include "cc/debug/frame_rate_counter.h" | 
|    36 #include "cc/debug/frame_viewer_instrumentation.h" |    38 #include "cc/debug/frame_viewer_instrumentation.h" | 
|    37 #include "cc/debug/rendering_stats_instrumentation.h" |    39 #include "cc/debug/rendering_stats_instrumentation.h" | 
| (...skipping 3208 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3246   viewport()->PinchEnd(); |  3248   viewport()->PinchEnd(); | 
|  3247   top_controls_manager_->PinchEnd(); |  3249   top_controls_manager_->PinchEnd(); | 
|  3248   client_->SetNeedsCommitOnImplThread(); |  3250   client_->SetNeedsCommitOnImplThread(); | 
|  3249   // When a pinch ends, we may be displaying content cached at incorrect scales, |  3251   // When a pinch ends, we may be displaying content cached at incorrect scales, | 
|  3250   // so updating draw properties and drawing will ensure we are using the right |  3252   // so updating draw properties and drawing will ensure we are using the right | 
|  3251   // scales that we want when we're not inside a pinch. |  3253   // scales that we want when we're not inside a pinch. | 
|  3252   active_tree_->set_needs_update_draw_properties(); |  3254   active_tree_->set_needs_update_draw_properties(); | 
|  3253   SetNeedsRedraw(); |  3255   SetNeedsRedraw(); | 
|  3254 } |  3256 } | 
|  3255  |  3257  | 
 |  3258 scoped_ptr<BeginFrameCallbackList> | 
 |  3259 LayerTreeHostImpl::ProcessLayerTreeMutations() { | 
 |  3260   // TODO(majidvp): This is where we turn |LayerTreeMutationsCallback| into | 
 |  3261   // a list of closures. | 
 |  3262   auto callbacks = make_scoped_ptr(new BeginFrameCallbackList()); | 
 |  3263   return callbacks; | 
 |  3264 } | 
 |  3265  | 
|  3256 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, |  3266 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, | 
|  3257                                 LayerImpl* layer_impl) { |  3267                                 LayerImpl* layer_impl) { | 
|  3258   if (!layer_impl) |  3268   if (!layer_impl) | 
|  3259     return; |  3269     return; | 
|  3260  |  3270  | 
|  3261   gfx::ScrollOffset scroll_delta = layer_impl->PullDeltaForMainThread(); |  3271   gfx::ScrollOffset scroll_delta = layer_impl->PullDeltaForMainThread(); | 
|  3262  |  3272  | 
|  3263   if (!scroll_delta.IsZero()) { |  3273   if (!scroll_delta.IsZero()) { | 
|  3264     LayerTreeHostCommon::ScrollUpdateInfo scroll; |  3274     LayerTreeHostCommon::ScrollUpdateInfo scroll; | 
|  3265     scroll.layer_id = layer_impl->id(); |  3275     scroll.layer_id = layer_impl->id(); | 
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3980   return task_runner_provider_->HasImplThread(); |  3990   return task_runner_provider_->HasImplThread(); | 
|  3981 } |  3991 } | 
|  3982  |  3992  | 
|  3983 bool LayerTreeHostImpl::CommitToActiveTree() const { |  3993 bool LayerTreeHostImpl::CommitToActiveTree() const { | 
|  3984   // In single threaded mode we skip the pending tree and commit directly to the |  3994   // In single threaded mode we skip the pending tree and commit directly to the | 
|  3985   // active tree. |  3995   // active tree. | 
|  3986   return !task_runner_provider_->HasImplThread(); |  3996   return !task_runner_provider_->HasImplThread(); | 
|  3987 } |  3997 } | 
|  3988  |  3998  | 
|  3989 }  // namespace cc |  3999 }  // namespace cc | 
| OLD | NEW |