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