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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Image.h

Issue 1925533003: High CPU and increased memory usage fix for high-res (GIF, WEBP...) animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: @scroggo, thanks a lot - this makes page [3] to use 250MB (was 750MB) Created 4 years, 7 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 IntRect rect() const { return IntRect(IntPoint(), size()); } 97 IntRect rect() const { return IntRect(IntPoint(), size()); }
98 int width() const { return size().width(); } 98 int width() const { return size().width(); }
99 int height() const { return size().height(); } 99 int height() const { return size().height(); }
100 virtual bool getHotSpot(IntPoint&) const { return false; } 100 virtual bool getHotSpot(IntPoint&) const { return false; }
101 101
102 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived); 102 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived);
103 virtual bool dataChanged(bool /*allDataReceived*/) { return false; } 103 virtual bool dataChanged(bool /*allDataReceived*/) { return false; }
104 104
105 virtual String filenameExtension() const { return String(); } // null string if unknown 105 virtual String filenameExtension() const { return String(); } // null string if unknown
106 106
107 virtual void destroyDecodedData(bool destroyAll) = 0; 107 virtual void destroyDecodedData() = 0;
108 108
109 SharedBuffer* data() { return m_encodedImageData.get(); } 109 SharedBuffer* data() { return m_encodedImageData.get(); }
110 110
111 // Animation begins whenever someone draws the image, so startAnimation() is not normally called. 111 // Animation begins whenever someone draws the image, so startAnimation() is not normally called.
112 // It will automatically pause once all observers no longer want to render t he image anywhere. 112 // It will automatically pause once all observers no longer want to render t he image anywhere.
113 enum CatchUpAnimation { DoNotCatchUp, CatchUp }; 113 enum CatchUpAnimation { DoNotCatchUp, CatchUp };
114 virtual void startAnimation(CatchUpAnimation = CatchUp) { } 114 virtual void startAnimation(CatchUpAnimation = CatchUp) { }
115 virtual void stopAnimation() {}
116 virtual void resetAnimation() {} 115 virtual void resetAnimation() {}
117 116
118 // True if this image can potentially animate. 117 // True if this image can potentially animate.
119 virtual bool maybeAnimated() { return false; } 118 virtual bool maybeAnimated() { return false; }
120 119
121 // Set animationPolicy 120 // Set animationPolicy
122 virtual void setAnimationPolicy(ImageAnimationPolicy) { } 121 virtual void setAnimationPolicy(ImageAnimationPolicy) { }
123 virtual ImageAnimationPolicy animationPolicy() { return ImageAnimationPolicy Allowed; } 122 virtual ImageAnimationPolicy animationPolicy() { return ImageAnimationPolicy Allowed; }
124 virtual void advanceTime(double deltaTimeInSeconds) { } 123 virtual void advanceTime(double deltaTimeInSeconds) { }
125 124
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 UntracedMember<ImageObserver> m_imageObserver; 166 UntracedMember<ImageObserver> m_imageObserver;
168 bool m_imageObserverDisabled; 167 bool m_imageObserverDisabled;
169 }; 168 };
170 169
171 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ 170 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \
172 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) 171 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName())
173 172
174 } // namespace blink 173 } // namespace blink
175 174
176 #endif 175 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698