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

Unified Diff: third_party/WebKit/Source/platform/graphics/OffscreenCanvasPlaceholder.h

Issue 2493673002: Synchronize OffscreenCanvas content with the placeholder canvas (Closed)
Patch Set: fix obsolete test Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698