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

Side by Side Diff: Source/core/platform/graphics/GraphicsLayer.cpp

Issue 23834010: Change WebLayer::addAnimation to transfer ownership of WebAnimation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Pass ownership of WebAnimation under ANIMATION_OWNERSHIP_NOT_TRANSFER guard. Created 7 years, 2 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 void GraphicsLayer::setContentsToCanvas(WebLayer* layer) 1016 void GraphicsLayer::setContentsToCanvas(WebLayer* layer)
1017 { 1017 {
1018 setContentsTo(ContentsLayerForCanvas, layer); 1018 setContentsTo(ContentsLayerForCanvas, layer);
1019 } 1019 }
1020 1020
1021 void GraphicsLayer::setContentsToMedia(WebLayer* layer) 1021 void GraphicsLayer::setContentsToMedia(WebLayer* layer)
1022 { 1022 {
1023 setContentsTo(ContentsLayerForVideo, layer); 1023 setContentsTo(ContentsLayerForVideo, layer);
1024 } 1024 }
1025 1025
1026 bool GraphicsLayer::addAnimation(WebAnimation* animation) 1026 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation)
1027 { 1027 {
1028 OwnPtr<WebAnimation> animation(popAnimation);
1028 ASSERT(animation); 1029 ASSERT(animation);
1029 platformLayer()->setAnimationDelegate(this); 1030 platformLayer()->setAnimationDelegate(this);
1030 1031
1031 // Remove any existing animations with the same animation id and target prop erty. 1032 // Remove any existing animations with the same animation id and target prop erty.
1032 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( )); 1033 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( ));
1033 return platformLayer()->addAnimation(animation); 1034 #if defined(ANIMATION_OWNERSHIP_NOT_TRANSFER)
jamesr 2013/10/15 21:14:05 there's no need to test for this macro in the Blin
dshwang 2013/10/16 11:40:05 I don't think so. If I changes it to "animation.le
1035 return platformLayer()->addAnimation(animation.get());
1036 #else
1037 return platformLayer()->addAnimation(animation.leakPtr());
1038 #endif
1034 } 1039 }
1035 1040
1036 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) 1041 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset)
1037 { 1042 {
1038 platformLayer()->pauseAnimation(animationId, timeOffset); 1043 platformLayer()->pauseAnimation(animationId, timeOffset);
1039 } 1044 }
1040 1045
1041 void GraphicsLayer::removeAnimation(int animationId) 1046 void GraphicsLayer::removeAnimation(int animationId)
1042 { 1047 {
1043 platformLayer()->removeAnimation(animationId); 1048 platformLayer()->removeAnimation(animationId);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 #ifndef NDEBUG 1225 #ifndef NDEBUG
1221 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1226 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1222 { 1227 {
1223 if (!layer) 1228 if (!layer)
1224 return; 1229 return;
1225 1230
1226 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1231 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1227 fprintf(stderr, "%s\n", output.utf8().data()); 1232 fprintf(stderr, "%s\n", output.utf8().data());
1228 } 1233 }
1229 #endif 1234 #endif
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/GraphicsLayer.h ('k') | Source/core/rendering/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698