| 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 OffscreenCanvasPlaceholder_h | 5 #ifndef OffscreenCanvasPlaceholder_h |
| 6 #define OffscreenCanvasPlaceholder_h | 6 #define OffscreenCanvasPlaceholder_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "wtf/RefPtr.h" | 9 #include "wtf/RefPtr.h" |
| 10 #include "wtf/WeakPtr.h" | 10 #include "wtf/WeakPtr.h" |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class OffscreenCanvasFrameDispatcher; | 15 class OffscreenCanvasFrameDispatcher; |
| 16 class StaticBitmapImage; | 16 class StaticBitmapImage; |
| 17 class WebTaskRunner; | 17 class WebTaskRunner; |
| 18 | 18 |
| 19 class PLATFORM_EXPORT OffscreenCanvasPlaceholder { | 19 class PLATFORM_EXPORT OffscreenCanvasPlaceholder { |
| 20 public: | 20 public: |
| 21 ~OffscreenCanvasPlaceholder(); | 21 ~OffscreenCanvasPlaceholder(); |
| 22 | 22 |
| 23 void setPlaceholderFrame(RefPtr<StaticBitmapImage>, | 23 virtual void setPlaceholderFrame(RefPtr<StaticBitmapImage>, |
| 24 WeakPtr<OffscreenCanvasFrameDispatcher>, | 24 WeakPtr<OffscreenCanvasFrameDispatcher>, |
| 25 RefPtr<WebTaskRunner>, | 25 RefPtr<WebTaskRunner>, |
| 26 unsigned resourceId); | 26 unsigned resourceId); |
| 27 void releasePlaceholderFrame(); | 27 void releasePlaceholderFrame(); |
| 28 | 28 |
| 29 static OffscreenCanvasPlaceholder* getPlaceholderById(unsigned placeholderId); | 29 static OffscreenCanvasPlaceholder* getPlaceholderById(unsigned placeholderId); |
| 30 | 30 |
| 31 void registerPlaceholder(unsigned placeholderId); | 31 void registerPlaceholder(unsigned placeholderId); |
| 32 void unregisterPlaceholder(); | 32 void unregisterPlaceholder(); |
| 33 const RefPtr<StaticBitmapImage>& placeholderFrame() const { | 33 const RefPtr<StaticBitmapImage>& placeholderFrame() const { |
| 34 return m_placeholderFrame; | 34 return m_placeholderFrame; |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 bool isPlaceholderRegistered() const { | 38 bool isPlaceholderRegistered() const { |
| 39 return m_placeholderId != kNoPlaceholderId; | 39 return m_placeholderId != kNoPlaceholderId; |
| 40 } | 40 } |
| 41 | 41 |
| 42 RefPtr<StaticBitmapImage> m_placeholderFrame; | 42 RefPtr<StaticBitmapImage> m_placeholderFrame; |
| 43 WeakPtr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; | 43 WeakPtr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; |
| 44 RefPtr<WebTaskRunner> m_frameDispatcherTaskRunner; | 44 RefPtr<WebTaskRunner> m_frameDispatcherTaskRunner; |
| 45 unsigned m_placeholderFrameResourceId = 0; | 45 unsigned m_placeholderFrameResourceId = 0; |
| 46 | 46 |
| 47 enum { | 47 enum { |
| 48 kNoPlaceholderId = -1, | 48 kNoPlaceholderId = -1, |
| 49 }; | 49 }; |
| 50 int m_placeholderId = kNoPlaceholderId; | 50 int m_placeholderId = kNoPlaceholderId; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // blink | 53 } // blink |
| 54 | 54 |
| 55 #endif | 55 #endif |
| OLD | NEW |