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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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
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>
45 43
46 namespace blink { 44 namespace blink {
47 45
48 namespace { 46 namespace {
49 47
50 WebLayer* toWebLayer(GraphicsLayer* layer) 48 WebLayer* toWebLayer(GraphicsLayer* layer)
51 { 49 {
52 return layer ? layer->platformLayer() : nullptr; 50 return layer ? layer->platformLayer() : nullptr;
53 } 51 }
54 52
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 removeMainThreadScrollingReason(); 260 removeMainThreadScrollingReason();
263 261
264 resetAnimationState(); 262 resetAnimationState();
265 } 263 }
266 264
267 bool ScrollAnimator::sendAnimationToCompositor() 265 bool ScrollAnimator::sendAnimationToCompositor()
268 { 266 {
269 if (m_scrollableArea->shouldScrollOnMainThread()) 267 if (m_scrollableArea->shouldScrollOnMainThread())
270 return false; 268 return false;
271 269
272 std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::create (*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0); 270 OwnPtr<CompositorAnimation> animation = CompositorAnimation::create(*m_anima tionCurve, CompositorTargetProperty::SCROLL_OFFSET, 0, 0);
273 // Being here means that either there is an animation that needs 271 // Being here means that either there is an animation that needs
274 // to be sent to the compositor, or an animation that needs to 272 // to be sent to the compositor, or an animation that needs to
275 // be updated (a new scroll event before the previous animation 273 // be updated (a new scroll event before the previous animation
276 // is finished). In either case, the start time is when the 274 // is finished). In either case, the start time is when the
277 // first animation was initiated. This re-targets the animation 275 // first animation was initiated. This re-targets the animation
278 // using the current time on main thread. 276 // using the current time on main thread.
279 animation->setStartTime(m_startTime); 277 animation->setStartTime(m_startTime);
280 278
281 int animationId = animation->id(); 279 int animationId = animation->id();
282 int animationGroupId = animation->group(); 280 int animationGroupId = animation->group();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 457 }
460 return true; 458 return true;
461 } 459 }
462 460
463 DEFINE_TRACE(ScrollAnimator) 461 DEFINE_TRACE(ScrollAnimator)
464 { 462 {
465 ScrollAnimatorBase::trace(visitor); 463 ScrollAnimatorBase::trace(visitor);
466 } 464 }
467 465
468 } // namespace blink 466 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698