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

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: Change GraphicsLayer and LinkHighlight to clarify ownership transfer Created 7 years, 3 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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 void GraphicsLayer::setContentsToCanvas(WebLayer* layer) 962 void GraphicsLayer::setContentsToCanvas(WebLayer* layer)
963 { 963 {
964 setContentsTo(ContentsLayerForCanvas, layer); 964 setContentsTo(ContentsLayerForCanvas, layer);
965 } 965 }
966 966
967 void GraphicsLayer::setContentsToMedia(WebLayer* layer) 967 void GraphicsLayer::setContentsToMedia(WebLayer* layer)
968 { 968 {
969 setContentsTo(ContentsLayerForVideo, layer); 969 setContentsTo(ContentsLayerForVideo, layer);
970 } 970 }
971 971
972 bool GraphicsLayer::addAnimation(WebAnimation* animation) 972 bool GraphicsLayer::addAnimation(PassOwnPtr<WebAnimation> popAnimation)
973 { 973 {
974 OwnPtr<WebAnimation> animation(popAnimation);
974 ASSERT(animation); 975 ASSERT(animation);
975 platformLayer()->setAnimationDelegate(this); 976 platformLayer()->setAnimationDelegate(this);
976 977
977 // Remove any existing animations with the same animation id and target prop erty. 978 // Remove any existing animations with the same animation id and target prop erty.
978 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( )); 979 platformLayer()->removeAnimation(animation->id(), animation->targetProperty( ));
979 return platformLayer()->addAnimation(animation); 980 return platformLayer()->addAnimation(animation.get());
jamesr 2013/09/20 18:52:14 you need to leakPtr() here, right? otherwise ~OwnP
dshwang 2013/09/20 19:03:58 WebLayerImpl does not delete a WebAnimation instan
980 } 981 }
981 982
982 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) 983 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset)
983 { 984 {
984 platformLayer()->pauseAnimation(animationId, timeOffset); 985 platformLayer()->pauseAnimation(animationId, timeOffset);
985 } 986 }
986 987
987 void GraphicsLayer::removeAnimation(int animationId) 988 void GraphicsLayer::removeAnimation(int animationId)
988 { 989 {
989 platformLayer()->removeAnimation(animationId); 990 platformLayer()->removeAnimation(animationId);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 #ifndef NDEBUG 1183 #ifndef NDEBUG
1183 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) 1184 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
1184 { 1185 {
1185 if (!layer) 1186 if (!layer)
1186 return; 1187 return;
1187 1188
1188 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); 1189 String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo);
1189 fprintf(stderr, "%s\n", output.utf8().data()); 1190 fprintf(stderr, "%s\n", output.utf8().data());
1190 } 1191 }
1191 #endif 1192 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698