OLD | NEW |
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 "platform/WebTaskRunner.h" |
10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
11 #include "wtf/WeakPtr.h" | 11 #include "wtf/WeakPtr.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class StaticBitmapImage; | 15 class StaticBitmapImage; |
16 | 16 |
17 class OffscreenCanvasFrameDispatcherClient { | 17 class OffscreenCanvasFrameDispatcherClient { |
18 public: | 18 public: |
19 virtual void beginFrame() = 0; | 19 virtual void beginFrame() = 0; |
20 }; | 20 }; |
21 | 21 |
22 class PLATFORM_EXPORT OffscreenCanvasFrameDispatcher { | 22 class PLATFORM_EXPORT OffscreenCanvasFrameDispatcher { |
23 public: | 23 public: |
24 virtual ~OffscreenCanvasFrameDispatcher() {} | 24 virtual ~OffscreenCanvasFrameDispatcher() {} |
25 virtual void dispatchFrame(RefPtr<StaticBitmapImage>, | 25 virtual void dispatchFrame(RefPtr<StaticBitmapImage>, |
26 double commitStartTime, | 26 double commitStartTime, |
27 bool isWebGLSoftwareRendering) = 0; | 27 bool isWebGLSoftwareRendering) = 0; |
| 28 virtual void setNeedsBeginFrame(bool) = 0; |
28 virtual void reclaimResource(unsigned resourceId) = 0; | 29 virtual void reclaimResource(unsigned resourceId) = 0; |
29 | 30 |
30 virtual void reshape(int width, int height) = 0; | 31 virtual void reshape(int width, int height) = 0; |
31 | 32 |
32 WeakPtr<OffscreenCanvasFrameDispatcher> createWeakPtr() { | 33 WeakPtr<OffscreenCanvasFrameDispatcher> createWeakPtr() { |
33 return m_weakPtrFactory.createWeakPtr(); | 34 return m_weakPtrFactory.createWeakPtr(); |
34 } | 35 } |
35 | 36 |
36 OffscreenCanvasFrameDispatcherClient* client() { return m_client; } | 37 OffscreenCanvasFrameDispatcherClient* client() { return m_client; } |
37 | 38 |
38 protected: | 39 protected: |
39 OffscreenCanvasFrameDispatcher(OffscreenCanvasFrameDispatcherClient* client) | 40 OffscreenCanvasFrameDispatcher(OffscreenCanvasFrameDispatcherClient* client) |
40 : m_weakPtrFactory(this), m_client(client) {} | 41 : m_weakPtrFactory(this), m_client(client) {} |
41 | 42 |
42 private: | 43 private: |
43 WeakPtrFactory<OffscreenCanvasFrameDispatcher> m_weakPtrFactory; | 44 WeakPtrFactory<OffscreenCanvasFrameDispatcher> m_weakPtrFactory; |
44 OffscreenCanvasFrameDispatcherClient* m_client; | 45 OffscreenCanvasFrameDispatcherClient* m_client; |
45 }; | 46 }; |
46 | 47 |
47 } // namespace blink | 48 } // namespace blink |
48 | 49 |
49 #endif // OffscreenCanvasFrameDispatcher_h | 50 #endif // OffscreenCanvasFrameDispatcher_h |
OLD | NEW |