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

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

Issue 2455983005: Refactor AcceleratedStaticBitmapImage (Closed)
Patch Set: Keep a unique_ptr<WebGraphicsContext3DProvider>, otherwise crashes 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/WebGraphicsContext3DProviderWrapper.h
diff --git a/third_party/WebKit/Source/platform/graphics/WebGraphicsContext3DProviderWrapper.h b/third_party/WebKit/Source/platform/graphics/WebGraphicsContext3DProviderWrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..4fb97d725109f1ea0b8a9f48be4eb2b7b8053193
--- /dev/null
+++ b/third_party/WebKit/Source/platform/graphics/WebGraphicsContext3DProviderWrapper.h
@@ -0,0 +1,32 @@
+// 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 WebGraphicsContext3DProviderWrapper_h
+#define WebGraphicsContext3DProviderWrapper_h
+
+#include "public/platform/WebGraphicsContext3DProvider.h"
+#include "wtf/WeakPtr.h"
+
+namespace blink {
+
+class PLATFORM_EXPORT WebGraphicsContext3DProviderWrapper {
+ public:
+ WebGraphicsContext3DProviderWrapper(
+ std::unique_ptr<WebGraphicsContext3DProvider> provider)
+ : m_contextProvider(std::move(provider)), m_weakPtrFactory(this) {}
+ WeakPtr<WebGraphicsContext3DProviderWrapper> createWeakPtr() {
+ return m_weakPtrFactory.createWeakPtr();
+ }
+ WebGraphicsContext3DProvider* contextProvider() {
+ return m_contextProvider.get();
+ }
+
+ private:
+ std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider;
+ WeakPtrFactory<WebGraphicsContext3DProviderWrapper> m_weakPtrFactory;
+};
+
+} // namespace blink
+
+#endif // WebGraphicsContext3DProviderWrapper_h

Powered by Google App Engine
This is Rietveld 408576698