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

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

Issue 2594843002: Implementing promise-based commit for driving OffscreenCanvas animations (Closed)
Patch Set: test fix Created 4 years 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef OffscreenCanvasFrameDispatcher_h 5 #ifndef OffscreenCanvasFrameDispatcher_h
6 #define OffscreenCanvasFrameDispatcher_h 6 #define OffscreenCanvasFrameDispatcher_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/WebTaskRunner.h"
9 #include "wtf/RefPtr.h" 10 #include "wtf/RefPtr.h"
10 #include "wtf/WeakPtr.h" 11 #include "wtf/WeakPtr.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 class StaticBitmapImage; 15 class StaticBitmapImage;
15 16
17 class OffscreenCanvasFrameDispatcherClient {
xlai (Olivia) 2016/12/21 19:54:25 Just a suggestion: I see that the relationship of
Justin Novosad 2016/12/21 21:15:40 We use both in blink. It is really just a matter o
18 public:
19 virtual void beginFrame() = 0;
20 };
21
16 class PLATFORM_EXPORT OffscreenCanvasFrameDispatcher { 22 class PLATFORM_EXPORT OffscreenCanvasFrameDispatcher {
17 public: 23 public:
18 OffscreenCanvasFrameDispatcher() : m_weakPtrFactory(this) {}
19 virtual ~OffscreenCanvasFrameDispatcher() {} 24 virtual ~OffscreenCanvasFrameDispatcher() {}
20 virtual void dispatchFrame(RefPtr<StaticBitmapImage>, 25 virtual void dispatchFrame(RefPtr<StaticBitmapImage>,
21 double commitStartTime, 26 double commitStartTime,
22 bool isWebGLSoftwareRendering = false) = 0; 27 bool isWebGLSoftwareRendering) = 0;
23 virtual void reclaimResource(unsigned resourceId) = 0; 28 virtual void reclaimResource(unsigned resourceId) = 0;
24 29
25 virtual void reshape(int width, int height) = 0; 30 virtual void reshape(int width, int height) = 0;
26 31
27 WeakPtr<OffscreenCanvasFrameDispatcher> createWeakPtr() { 32 WeakPtr<OffscreenCanvasFrameDispatcher> createWeakPtr() {
28 return m_weakPtrFactory.createWeakPtr(); 33 return m_weakPtrFactory.createWeakPtr();
29 } 34 }
30 35
36 OffscreenCanvasFrameDispatcherClient* client() { return m_client; }
37
38 protected:
39 OffscreenCanvasFrameDispatcher(OffscreenCanvasFrameDispatcherClient* client)
40 : m_weakPtrFactory(this), m_client(client) {}
41
31 private: 42 private:
32 WeakPtrFactory<OffscreenCanvasFrameDispatcher> m_weakPtrFactory; 43 WeakPtrFactory<OffscreenCanvasFrameDispatcher> m_weakPtrFactory;
44 OffscreenCanvasFrameDispatcherClient* m_client;
33 }; 45 };
34 46
35 } // namespace blink 47 } // namespace blink
36 48
37 #endif // OffscreenCanvasFrameDispatcher_h 49 #endif // OffscreenCanvasFrameDispatcher_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698