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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 7 *
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 15 matching lines...) Expand all
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef SVGImageChromeClient_h 29 #ifndef SVGImageChromeClient_h
30 #define SVGImageChromeClient_h 30 #define SVGImageChromeClient_h
31 31
32 #include "base/gtest_prod_util.h" 32 #include "base/gtest_prod_util.h"
33 #include "core/CoreExport.h" 33 #include "core/CoreExport.h"
34 #include "core/loader/EmptyClients.h" 34 #include "core/loader/EmptyClients.h"
35 #include "platform/Timer.h" 35 #include "platform/Timer.h"
36 #include <memory>
37 36
38 namespace blink { 37 namespace blink {
39 38
40 class SVGImage; 39 class SVGImage;
41 40
42 class CORE_EXPORT SVGImageChromeClient final : public EmptyChromeClient { 41 class CORE_EXPORT SVGImageChromeClient final : public EmptyChromeClient {
43 public: 42 public:
44 static SVGImageChromeClient* create(SVGImage*); 43 static SVGImageChromeClient* create(SVGImage*);
45 44
46 bool isSVGImageChromeClient() const override; 45 bool isSVGImageChromeClient() const override;
47 46
48 SVGImage* image() const { return m_image; } 47 SVGImage* image() const { return m_image; }
49 48
50 void suspendAnimation(); 49 void suspendAnimation();
51 void resumeAnimation(); 50 void resumeAnimation();
52 bool isSuspended() const { return m_timelineState >= Suspended; } 51 bool isSuspended() const { return m_timelineState >= Suspended; }
53 52
54 private: 53 private:
55 explicit SVGImageChromeClient(SVGImage*); 54 explicit SVGImageChromeClient(SVGImage*);
56 55
57 void chromeDestroyed() override; 56 void chromeDestroyed() override;
58 void invalidateRect(const IntRect&) override; 57 void invalidateRect(const IntRect&) override;
59 void scheduleAnimation(Widget*) override; 58 void scheduleAnimation(Widget*) override;
60 59
61 void setTimer(Timer<SVGImageChromeClient>*); 60 void setTimer(Timer<SVGImageChromeClient>*);
62 void animationTimerFired(Timer<SVGImageChromeClient>*); 61 void animationTimerFired(Timer<SVGImageChromeClient>*);
63 62
64 SVGImage* m_image; 63 SVGImage* m_image;
65 std::unique_ptr<Timer<SVGImageChromeClient>> m_animationTimer; 64 OwnPtr<Timer<SVGImageChromeClient>> m_animationTimer;
66 enum { 65 enum {
67 Running, 66 Running,
68 Suspended, 67 Suspended,
69 SuspendedWithAnimationPending, 68 SuspendedWithAnimationPending,
70 } m_timelineState; 69 } m_timelineState;
71 70
72 FRIEND_TEST_ALL_PREFIXES(SVGImageTest, TimelineSuspendAndResume); 71 FRIEND_TEST_ALL_PREFIXES(SVGImageTest, TimelineSuspendAndResume);
73 FRIEND_TEST_ALL_PREFIXES(SVGImageTest, ResetAnimation); 72 FRIEND_TEST_ALL_PREFIXES(SVGImageTest, ResetAnimation);
74 }; 73 };
75 74
76 DEFINE_TYPE_CASTS(SVGImageChromeClient, ChromeClient, client, client->isSVGImage ChromeClient(), client.isSVGImageChromeClient()); 75 DEFINE_TYPE_CASTS(SVGImageChromeClient, ChromeClient, client, client->isSVGImage ChromeClient(), client.isSVGImageChromeClient());
77 76
78 } // namespace blink 77 } // namespace blink
79 78
80 #endif // SVGImageChromeClient_h 79 #endif // SVGImageChromeClient_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698