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

Unified Diff: Source/core/html/canvas/WebGLObject.cpp

Issue 365653002: Oilpan: move 2D Canvas and WebGL objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make WebGLObjects keep a blink::WebGraphicsContext3D for finalization. Created 6 years, 5 months 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: Source/core/html/canvas/WebGLObject.cpp
diff --git a/Source/core/html/canvas/WebGLObject.cpp b/Source/core/html/canvas/WebGLObject.cpp
index 14dd8ba5ee8d78eeea2c29b7f2dfc08ece0c7a8f..2be33db2d12e501310419c594d1ebb6c7d8007bf 100644
--- a/Source/core/html/canvas/WebGLObject.cpp
+++ b/Source/core/html/canvas/WebGLObject.cpp
@@ -27,10 +27,15 @@
#include "core/html/canvas/WebGLObject.h"
+#include "core/html/canvas/WebGLRenderingContextBase.h"
+
namespace WebCore {
-WebGLObject::WebGLObject(WebGLRenderingContextBase*)
+WebGLObject::WebGLObject(WebGLRenderingContextBase* base)
: m_object(0)
+#if ENABLE(OILPAN)
+ , m_context3d(base->webContext())
haraken 2014/07/11 01:55:02 I basically like the idea of caching the webContex
sof 2014/07/11 06:51:35 It's a very good question. All remaining WebGLSha
haraken 2014/07/11 07:01:33 Or probably can we create Context3DObserver or som
Mads Ager (chromium) 2014/07/11 09:15:01 We should attempt to avoid that. We are attempting
sof 2014/07/11 09:42:02 That would be a tidy way to handle registration an
Mads Ager (chromium) 2014/07/11 10:18:52 I guess we could use PersistentHeapHashSet<Member<
+#endif
, m_attachmentCount(0)
, m_deleted(false)
{
@@ -38,6 +43,10 @@ WebGLObject::WebGLObject(WebGLRenderingContextBase*)
WebGLObject::~WebGLObject()
{
+#if ENABLE(OILPAN)
+ // Verify that derived classes have released their platform objects.
+ ASSERT(m_deleted);
+#endif
}
void WebGLObject::setObject(Platform3DObject object)
@@ -57,8 +66,13 @@ void WebGLObject::deleteObject(blink::WebGraphicsContext3D* context3d)
return;
if (!m_attachmentCount) {
- if (!context3d)
+ if (!context3d) {
+#if ENABLE(OILPAN)
+ context3d = m_context3d;
+#else
context3d = getAWebGraphicsContext3D();
+#endif
+ }
if (context3d)
deleteObjectImpl(context3d, m_object);
@@ -70,8 +84,7 @@ void WebGLObject::deleteObject(blink::WebGraphicsContext3D* context3d)
void WebGLObject::detach()
{
m_attachmentCount = 0; // Make sure OpenGL resource is deleted.
- }
-
+}
void WebGLObject::onDetached(blink::WebGraphicsContext3D* context3d)
{

Powered by Google App Engine
This is Rietveld 408576698