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

Unified Diff: Source/core/animation/CompositorAnimationsTest.cpp

Issue 895543002: Oilpan: fix webkit unit tests after r189319 (df44f48). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tidy up RenderObjectProxy destruction Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/CompositorAnimationsTest.cpp
diff --git a/Source/core/animation/CompositorAnimationsTest.cpp b/Source/core/animation/CompositorAnimationsTest.cpp
index 1cac5630ca717e99a3a48693e483e8c90acadbf5..4cc6e91e1464e049dc9b4f36e09b1587557454c2 100644
--- a/Source/core/animation/CompositorAnimationsTest.cpp
+++ b/Source/core/animation/CompositorAnimationsTest.cpp
@@ -256,13 +256,23 @@ public:
class RenderObjectProxy : public RenderObject {
public:
- explicit RenderObjectProxy(Node* node)
- : RenderObject(node)
+ static PassOwnPtrWillBeRawPtr<RenderObjectProxy> create(Node* node)
+ {
+ return adoptPtrWillBeNoop(new RenderObjectProxy(node));
+ }
+
+ static void dispose(PassOwnPtrWillBeRawPtr<RenderObjectProxy> object)
{
+ object.leakPtr()->destroy();
}
const char* renderName() const override { return nullptr; }
void layout() override { }
+private:
+ explicit RenderObjectProxy(Node* node)
+ : RenderObject(node)
+ {
+ }
};
// -----------------------------------------------------------------------
@@ -1190,10 +1200,10 @@ TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations
WebCompositorSupportMock mockCompositor;
setCompositorForTesting(mockCompositor);
- RefPtrWillBeRawPtr<Element> element = m_document->createElement("shared", ASSERT_NO_EXCEPTION);
+ RefPtrWillBePersistent<Element> element = m_document->createElement("shared", ASSERT_NO_EXCEPTION);
- RenderObjectProxy* renderer = new RenderObjectProxy(element.get());
- element->setRenderer(renderer);
+ OwnPtrWillBePersistent<RenderObjectProxy> renderer = RenderObjectProxy::create(element.get());
+ element->setRenderer(renderer.get());
AnimatableValueKeyframeVector keyFrames;
keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::CompositeReplace, 0.0).get());
@@ -1206,7 +1216,7 @@ TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations
// The first player for opacity is ok to run on compositor.
RefPtrWillBeRawPtr<Animation> animation1 = Animation::create(element.get(), animationEffect1, timing);
- RefPtrWillBeRawPtr<AnimationPlayer> player1 = m_timeline->play(animation1.get());
+ RefPtrWillBePersistent<AnimationPlayer> player1 = m_timeline->play(animation1.get());
EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompositor(timing, *element.get(), player1.get(), *animationEffect1.get(), 1));
// simulate Animation::maybeStartAnimationOnCompositor
@@ -1217,7 +1227,7 @@ TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations
// The second player for opacity is not ok to run on compositor.
RefPtrWillBeRawPtr<Animation> animation2 = Animation::create(element.get(), animationEffect2, timing);
- RefPtrWillBeRawPtr<AnimationPlayer> player2 = m_timeline->play(animation2.get());
+ RefPtrWillBePersistent<AnimationPlayer> player2 = m_timeline->play(animation2.get());
EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnCompositor(timing, *element.get(), player2.get(), *animationEffect2.get(), 1));
EXPECT_FALSE(player2->hasActiveAnimationsOnCompositor());
@@ -1232,8 +1242,7 @@ TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations
simulateFrame(1.);
element->setRenderer(nullptr);
- delete renderer;
- renderer = nullptr;
+ RenderObjectProxy::dispose(renderer.release());
player1.release();
player2.release();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698