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

Side by Side Diff: Source/core/animation/CompositorAnimationsTest.cpp

Issue 869323003: Oilpan: move RenderObjects off heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review-induced improvements Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/FirstLetterPseudoElement.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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 void simulateFrame(double time) 249 void simulateFrame(double time)
250 { 250 {
251 m_document->animationClock().updateTime(time); 251 m_document->animationClock().updateTime(time);
252 m_document->compositorPendingAnimations().update(false); 252 m_document->compositorPendingAnimations().update(false);
253 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); 253 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame);
254 } 254 }
255 }; 255 };
256 256
257 class RenderObjectProxy : public RenderObject { 257 class RenderObjectProxy : public RenderObject {
258 public: 258 public:
259 static PassOwnPtrWillBeRawPtr<RenderObjectProxy> create(Node* node) 259 static RenderObjectProxy* create(Node* node)
260 { 260 {
261 return adoptPtrWillBeNoop(new RenderObjectProxy(node)); 261 return new RenderObjectProxy(node);
262 } 262 }
263 263
264 static void dispose(PassOwnPtrWillBeRawPtr<RenderObjectProxy> object) 264 static void dispose(RenderObjectProxy* proxy)
265 { 265 {
266 object.leakPtr()->destroy(); 266 proxy->destroy();
267 } 267 }
268 268
269 const char* renderName() const override { return nullptr; } 269 const char* renderName() const override { return nullptr; }
270 void layout() override { } 270 void layout() override { }
271
271 private: 272 private:
272 explicit RenderObjectProxy(Node* node) 273 explicit RenderObjectProxy(Node* node)
273 : RenderObject(node) 274 : RenderObject(node)
274 { 275 {
275 } 276 }
276 }; 277 };
277 278
278 // ----------------------------------------------------------------------- 279 // -----------------------------------------------------------------------
279 // ----------------------------------------------------------------------- 280 // -----------------------------------------------------------------------
280 281
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 result[0].clear(); 1196 result[0].clear();
1196 } 1197 }
1197 1198
1198 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations ) 1199 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations )
1199 { 1200 {
1200 WebCompositorSupportMock mockCompositor; 1201 WebCompositorSupportMock mockCompositor;
1201 setCompositorForTesting(mockCompositor); 1202 setCompositorForTesting(mockCompositor);
1202 1203
1203 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); 1204 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION);
1204 1205
1205 OwnPtrWillBePersistent<RenderObjectProxy> renderer = RenderObjectProxy::crea te(element.get()); 1206 RenderObjectProxy* renderer = RenderObjectProxy::create(element.get());
1206 element->setRenderer(renderer.get()); 1207 element->setRenderer(renderer);
1207 1208
1208 AnimatableValueKeyframeVector keyFrames; 1209 AnimatableValueKeyframeVector keyFrames;
1209 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:: CompositeReplace, 0.0).get()); 1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:: CompositeReplace, 0.0).get());
1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:: CompositeReplace, 1.0).get()); 1211 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:: CompositeReplace, 1.0).get());
1211 RefPtrWillBeRawPtr<AnimationEffect> animationEffect1 = AnimatableValueKeyfra meEffectModel::create(keyFrames); 1212 RefPtrWillBeRawPtr<AnimationEffect> animationEffect1 = AnimatableValueKeyfra meEffectModel::create(keyFrames);
1212 RefPtrWillBeRawPtr<AnimationEffect> animationEffect2 = AnimatableValueKeyfra meEffectModel::create(keyFrames); 1213 RefPtrWillBeRawPtr<AnimationEffect> animationEffect2 = AnimatableValueKeyfra meEffectModel::create(keyFrames);
1213 1214
1214 Timing timing; 1215 Timing timing;
1215 timing.iterationDuration = 1.f; 1216 timing.iterationDuration = 1.f;
1216 1217
(...skipping 18 matching lines...) Expand all
1235 player2->cancelIncompatibleAnimationsOnCompositor(); 1236 player2->cancelIncompatibleAnimationsOnCompositor();
1236 1237
1237 EXPECT_FALSE(player1->hasActiveAnimationsOnCompositor()); 1238 EXPECT_FALSE(player1->hasActiveAnimationsOnCompositor());
1238 EXPECT_FALSE(player2->hasActiveAnimationsOnCompositor()); 1239 EXPECT_FALSE(player2->hasActiveAnimationsOnCompositor());
1239 1240
1240 simulateFrame(0); 1241 simulateFrame(0);
1241 EXPECT_EQ(2U, element->activeAnimations()->players().size()); 1242 EXPECT_EQ(2U, element->activeAnimations()->players().size());
1242 simulateFrame(1.); 1243 simulateFrame(1.);
1243 1244
1244 element->setRenderer(nullptr); 1245 element->setRenderer(nullptr);
1245 RenderObjectProxy::dispose(renderer.release()); 1246 RenderObjectProxy::dispose(renderer);
1246 1247
1247 player1.release(); 1248 player1.release();
1248 player2.release(); 1249 player2.release();
1249 Heap::collectAllGarbage(); 1250 Heap::collectAllGarbage();
1250 EXPECT_TRUE(element->activeAnimations()->players().isEmpty()); 1251 EXPECT_TRUE(element->activeAnimations()->players().isEmpty());
1251 } 1252 }
1252 1253
1253 } // namespace blink 1254 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/FirstLetterPseudoElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698