Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 PassOwnPtr<RenderObjectProxy> create(Node* node) |
| 260 { | 260 { |
| 261 return adoptPtrWillBeNoop(new RenderObjectProxy(node)); | 261 return adoptPtr(new RenderObjectProxy(node)); |
| 262 } | |
| 263 | |
| 264 static void dispose(PassOwnPtrWillBeRawPtr<RenderObjectProxy> object) | |
|
tkent
2015/02/04 00:50:44
Don't remove this function. This is not specific
sof
2015/02/04 08:44:31
Added back again (the use of destroy() was added a
| |
| 265 { | |
| 266 object.leakPtr()->destroy(); | |
| 267 } | 262 } |
| 268 | 263 |
| 269 const char* renderName() const override { return nullptr; } | 264 const char* renderName() const override { return nullptr; } |
| 270 void layout() override { } | 265 void layout() override { } |
| 266 | |
| 271 private: | 267 private: |
| 272 explicit RenderObjectProxy(Node* node) | 268 explicit RenderObjectProxy(Node* node) |
| 273 : RenderObject(node) | 269 : RenderObject(node) |
| 274 { | 270 { |
| 275 } | 271 } |
| 276 }; | 272 }; |
| 277 | 273 |
| 278 // ----------------------------------------------------------------------- | 274 // ----------------------------------------------------------------------- |
| 279 // ----------------------------------------------------------------------- | 275 // ----------------------------------------------------------------------- |
| 280 | 276 |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1195 result[0].clear(); | 1191 result[0].clear(); |
| 1196 } | 1192 } |
| 1197 | 1193 |
| 1198 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations ) | 1194 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations ) |
| 1199 { | 1195 { |
| 1200 WebCompositorSupportMock mockCompositor; | 1196 WebCompositorSupportMock mockCompositor; |
| 1201 setCompositorForTesting(mockCompositor); | 1197 setCompositorForTesting(mockCompositor); |
| 1202 | 1198 |
| 1203 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); | 1199 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); |
| 1204 | 1200 |
| 1205 OwnPtrWillBePersistent<RenderObjectProxy> renderer = RenderObjectProxy::crea te(element.get()); | 1201 OwnPtr<RenderObjectProxy> renderer = RenderObjectProxy::create(element.get() ); |
| 1206 element->setRenderer(renderer.get()); | 1202 element->setRenderer(renderer.get()); |
| 1207 | 1203 |
| 1208 AnimatableValueKeyframeVector keyFrames; | 1204 AnimatableValueKeyframeVector keyFrames; |
| 1209 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:: CompositeReplace, 0.0).get()); | 1205 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:: CompositeReplace, 0.0).get()); |
| 1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:: CompositeReplace, 1.0).get()); | 1206 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect:: CompositeReplace, 1.0).get()); |
| 1211 RefPtrWillBeRawPtr<AnimationEffect> animationEffect1 = AnimatableValueKeyfra meEffectModel::create(keyFrames); | 1207 RefPtrWillBeRawPtr<AnimationEffect> animationEffect1 = AnimatableValueKeyfra meEffectModel::create(keyFrames); |
| 1212 RefPtrWillBeRawPtr<AnimationEffect> animationEffect2 = AnimatableValueKeyfra meEffectModel::create(keyFrames); | 1208 RefPtrWillBeRawPtr<AnimationEffect> animationEffect2 = AnimatableValueKeyfra meEffectModel::create(keyFrames); |
| 1213 | 1209 |
| 1214 Timing timing; | 1210 Timing timing; |
| 1215 timing.iterationDuration = 1.f; | 1211 timing.iterationDuration = 1.f; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1235 player2->cancelIncompatibleAnimationsOnCompositor(); | 1231 player2->cancelIncompatibleAnimationsOnCompositor(); |
| 1236 | 1232 |
| 1237 EXPECT_FALSE(player1->hasActiveAnimationsOnCompositor()); | 1233 EXPECT_FALSE(player1->hasActiveAnimationsOnCompositor()); |
| 1238 EXPECT_FALSE(player2->hasActiveAnimationsOnCompositor()); | 1234 EXPECT_FALSE(player2->hasActiveAnimationsOnCompositor()); |
| 1239 | 1235 |
| 1240 simulateFrame(0); | 1236 simulateFrame(0); |
| 1241 EXPECT_EQ(2U, element->activeAnimations()->players().size()); | 1237 EXPECT_EQ(2U, element->activeAnimations()->players().size()); |
| 1242 simulateFrame(1.); | 1238 simulateFrame(1.); |
| 1243 | 1239 |
| 1244 element->setRenderer(nullptr); | 1240 element->setRenderer(nullptr); |
| 1245 RenderObjectProxy::dispose(renderer.release()); | 1241 renderer = nullptr; |
| 1246 | 1242 |
| 1247 player1.release(); | 1243 player1.release(); |
| 1248 player2.release(); | 1244 player2.release(); |
| 1249 Heap::collectAllGarbage(); | 1245 Heap::collectAllGarbage(); |
| 1250 EXPECT_TRUE(element->activeAnimations()->players().isEmpty()); | 1246 EXPECT_TRUE(element->activeAnimations()->players().isEmpty()); |
| 1251 } | 1247 } |
| 1252 | 1248 |
| 1253 } // namespace blink | 1249 } // namespace blink |
| OLD | NEW |