OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "cc/animation/scroll_offset_animation_curve.h" | 33 #include "cc/animation/scroll_offset_animation_curve.h" |
34 #include "platform/TraceEvent.h" | 34 #include "platform/TraceEvent.h" |
35 #include "platform/animation/CompositorAnimation.h" | 35 #include "platform/animation/CompositorAnimation.h" |
36 #include "platform/graphics/GraphicsLayer.h" | 36 #include "platform/graphics/GraphicsLayer.h" |
37 #include "platform/scroll/MainThreadScrollingReason.h" | 37 #include "platform/scroll/MainThreadScrollingReason.h" |
38 #include "platform/scroll/ScrollableArea.h" | 38 #include "platform/scroll/ScrollableArea.h" |
39 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
40 #include "public/platform/WebCompositorSupport.h" | 40 #include "public/platform/WebCompositorSupport.h" |
41 #include "wtf/CurrentTime.h" | 41 #include "wtf/CurrentTime.h" |
42 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
| 43 #include "wtf/PtrUtil.h" |
| 44 #include <memory> |
43 | 45 |
44 namespace blink { | 46 namespace blink { |
45 | 47 |
46 namespace { | 48 namespace { |
47 | 49 |
48 WebLayer* toWebLayer(GraphicsLayer* layer) | 50 WebLayer* toWebLayer(GraphicsLayer* layer) |
49 { | 51 { |
50 return layer ? layer->platformLayer() : nullptr; | 52 return layer ? layer->platformLayer() : nullptr; |
51 } | 53 } |
52 | 54 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 removeMainThreadScrollingReason(); | 262 removeMainThreadScrollingReason(); |
261 | 263 |
262 resetAnimationState(); | 264 resetAnimationState(); |
263 } | 265 } |
264 | 266 |
265 bool ScrollAnimator::sendAnimationToCompositor() | 267 bool ScrollAnimator::sendAnimationToCompositor() |
266 { | 268 { |
267 if (m_scrollableArea->shouldScrollOnMainThread()) | 269 if (m_scrollableArea->shouldScrollOnMainThread()) |
268 return false; | 270 return false; |
269 | 271 |
270 OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*m_anima
tionCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); | 272 std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create
(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); |
271 // Being here means that either there is an animation that needs | 273 // Being here means that either there is an animation that needs |
272 // to be sent to the compositor, or an animation that needs to | 274 // to be sent to the compositor, or an animation that needs to |
273 // be updated (a new scroll event before the previous animation | 275 // be updated (a new scroll event before the previous animation |
274 // is finished). In either case, the start time is when the | 276 // is finished). In either case, the start time is when the |
275 // first animation was initiated. This re-targets the animation | 277 // first animation was initiated. This re-targets the animation |
276 // using the current time on main thread. | 278 // using the current time on main thread. |
277 animation->setStartTime(m_startTime); | 279 animation->setStartTime(m_startTime); |
278 | 280 |
279 int animationId = animation->id(); | 281 int animationId = animation->id(); |
280 int animationGroupId = animation->group(); | 282 int animationGroupId = animation->group(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 } | 459 } |
458 return true; | 460 return true; |
459 } | 461 } |
460 | 462 |
461 DEFINE_TRACE(ScrollAnimator) | 463 DEFINE_TRACE(ScrollAnimator) |
462 { | 464 { |
463 ScrollAnimatorBase::trace(visitor); | 465 ScrollAnimatorBase::trace(visitor); |
464 } | 466 } |
465 | 467 |
466 } // namespace blink | 468 } // namespace blink |
OLD | NEW |