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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h

Issue 2000483003: Rework timeline/frame scheduling logic for SVGImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
index f4c123e1897a78c2f3d7f2408fc66dcb95a7e80f..32a2a3bbb3765eec3462fd7f36d36c191f404b60 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
@@ -29,6 +29,8 @@
#ifndef SVGImageChromeClient_h
#define SVGImageChromeClient_h
+#include "base/gtest_prod_util.h"
+#include "core/CoreExport.h"
#include "core/loader/EmptyClients.h"
#include "platform/Timer.h"
@@ -36,7 +38,7 @@ namespace blink {
class SVGImage;
-class SVGImageChromeClient final : public EmptyChromeClient {
+class CORE_EXPORT SVGImageChromeClient final : public EmptyChromeClient {
public:
static SVGImageChromeClient* create(SVGImage*);
@@ -44,6 +46,10 @@ public:
SVGImage* image() const { return m_image; }
+ void suspendAnimation();
+ void resumeAnimation();
+ bool isSuspended() const { return m_timelineState >= Suspended; }
+
private:
explicit SVGImageChromeClient(SVGImage*);
@@ -51,10 +57,19 @@ private:
void invalidateRect(const IntRect&) override;
void scheduleAnimation(Widget*) override;
+ void setTimer(Timer<SVGImageChromeClient>*);
void animationTimerFired(Timer<SVGImageChromeClient>*);
SVGImage* m_image;
- Timer<SVGImageChromeClient> m_animationTimer;
+ OwnPtr<Timer<SVGImageChromeClient>> m_animationTimer;
+ enum {
+ Running,
+ Suspended,
+ SuspendedWithAnimationPending,
+ } m_timelineState;
+
+ FRIEND_TEST_ALL_PREFIXES(SVGImageTest, TimelineSuspendAndResume);
+ FRIEND_TEST_ALL_PREFIXES(SVGImageTest, ResetAnimation);
};
DEFINE_TYPE_CASTS(SVGImageChromeClient, ChromeClient, client, client->isSVGImageChromeClient(), client.isSVGImageChromeClient());

Powered by Google App Engine
This is Rietveld 408576698