Index: Source/core/html/canvas/WebGLSharedWebGraphicsContext3D.h |
diff --git a/Source/core/html/canvas/WebGLSharedWebGraphicsContext3D.h b/Source/core/html/canvas/WebGLSharedWebGraphicsContext3D.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..724dd184587fe6c593ab09baeb17fe6f70f9100d |
--- /dev/null |
+++ b/Source/core/html/canvas/WebGLSharedWebGraphicsContext3D.h |
@@ -0,0 +1,51 @@ |
+// Copyright 2014 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 WebGLSharedWebGraphicsContext3D_h |
+#define WebGLSharedWebGraphicsContext3D_h |
+ |
+#include "wtf/Forward.h" |
+#include "wtf/RefCounted.h" |
+#include "wtf/RefPtr.h" |
+ |
+namespace blink { |
+class WebGraphicsContext3D; |
+} |
+ |
+namespace WebCore { |
+ |
+class DrawingBuffer; |
+ |
+#if ENABLE(OILPAN) |
+// The attached WebGLContextObjects are finalized using the |
+// blink::WebGraphicsContext3D object of this object's DrawingBuffer. |
+// Naturally the DrawingBuffer must then be kept alive until those |
+// finalizers have run. With Oilpan, accomplish that by having the |
+// WebGLContextObjects keep a RefPtr<> to an off-heap object that |
+// safely handles the eventual release of the underlying |
+// DrawingBuffer. |
+class WebGLSharedWebGraphicsContext3D FINAL : public RefCounted<WebGLSharedWebGraphicsContext3D> { |
+public: |
+ static PassRefPtr<WebGLSharedWebGraphicsContext3D> create(PassRefPtr<DrawingBuffer>); |
+ |
+ ~WebGLSharedWebGraphicsContext3D(); |
+ |
+ // Clearing and updating the underlying DrawingBuffer |
+ // is used when losing and restoring graphics contexts. |
+ void reset(); |
+ void update(PassRefPtr<DrawingBuffer>); |
+ |
+ blink::WebGraphicsContext3D* webContext(); |
+private: |
+ explicit WebGLSharedWebGraphicsContext3D(PassRefPtr<DrawingBuffer>); |
+ |
+ RefPtr<DrawingBuffer> m_buffer; |
+}; |
+#endif |
+ |
+ |
+ |
+} |
+ |
+#endif // WebGLSharedWebGraphicsContext3D_h |