Index: third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h |
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f03040eca7c2c774a977d73e6ea1ec0f3c9f1657 |
--- /dev/null |
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h |
@@ -0,0 +1,53 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef OffscreenCanvasPlaceholder_h |
+#define OffscreenCanvasPlaceholder_h |
+ |
+#include "platform/PlatformExport.h" |
+#include "wtf/RefPtr.h" |
+#include "wtf/WeakPtr.h" |
+#include <memory> |
+ |
+namespace blink { |
+ |
+class Image; |
+class OffscreenCanvasFrameDispatcher; |
+class WebTaskRunner; |
+ |
+class PLATFORM_EXPORT OffscreenCanvasPlaceholder { |
+ public: |
+ ~OffscreenCanvasPlaceholder(); |
+ |
+ void setPlaceholderFrame(RefPtr<Image>, |
+ WeakPtr<OffscreenCanvasFrameDispatcher>, |
+ std::unique_ptr<WebTaskRunner>, |
+ unsigned resourceId); |
+ void releasePlaceholderFrame(); |
+ |
+ static OffscreenCanvasPlaceholder* getPlaceholderById(unsigned placeholderId); |
+ |
+ void registerPlaceholder(unsigned placeholderId); |
+ void unregisterPlaceholder(); |
+ const RefPtr<Image>& placeholderFrame() const { return m_placeholderFrame; } |
+ |
+ private: |
+ bool isPlaceholderRegistered() const { |
+ return m_placeholderId != kNoPlaceholderId; |
+ } |
+ |
+ RefPtr<Image> m_placeholderFrame; |
+ WeakPtr<OffscreenCanvasFrameDispatcher> m_frameDispatcher; |
+ std::unique_ptr<WebTaskRunner> m_frameDispatcherTaskRunner; |
+ unsigned m_placeholderFrameResourceId = 0; |
+ |
+ enum { |
+ kNoPlaceholderId = -1, |
+ }; |
+ int m_placeholderId = kNoPlaceholderId; |
+}; |
+ |
+} // blink |
+ |
+#endif |