Oilpan: move 2D Canvas and WebGL objects to the heap.
This adds Oilpan transition types to the WebGL object hierarchy, along
with some remaining Canvas 2D objects.
Notes:
- Oilpan does not allow destructors to access other garbage collected
objects and we want all WebGL script accessible objects to be under
the control of Oilpan and be garbage collected. To follow and
fulfill both, we cannot make the objects that the destructors depend
on for fetching out the graphics context (which they use to finalize
their platform resources) be garbage collected. For
WebGLSharedObjects (and WebGLRenderingContextBase) that means that
WebGLContextGroup cannot be on the heap/garbage-collected, and for
WebGLContextObjects, the WebGLRenderingContextBase's DrawingBuffer
cannot be on the heap either.
See details below for how this is done for WebGLContextObject's; the
changes to WebGLContextGroup and WebGLSharedObject is along similar
lines.
- In terms of file footprint of the changes here, the WebGLExtension-derived
objects make up a significant portion. Their switch in transition
types for their create() constructor method is all standard and
repetitive.
- The release of platform resources when finalizing WebGL objects
requires some extra care with Oilpan. That release is done using a
platform graphics context object (blink::WebGraphicsContext3D), which
is owned by a DrawingBuffer. As finalization order isn't deterministic
with Oilpan, we have to arrange for that DrawingBuffer's context
object to remain alive until all objects that need it for platform
resource release have been finalized. And we cannot rely on fetching
the context object from another WebGL object on the Oilpan heap, as it
may or may not have been finalized.
To address, the (off heap) DrawingBuffer is shared among all objects
that need it for finalization, using an off-heap RefCounted abstraction
(WebGLSharedWebGraphicsContext3D). When all objects have been finalized,
that shared object will be destructed and its underlying DrawingBuffer
(and, indirectly, its blink::WebGraphicsContext3D object) is let go of.
As a result, each WebGLContextObject adds a RefPtr<> to this shared
DrawingBuffer/WebGraphicsContext3D with Oilpan enabled.
R=haraken@chromium.org,ager@chromium.org,junov@chromium.org,bajones@chromium.org,kbr@chromium.org
BUG=340522
Review URL: https://codereview.chromium.org/365653002
git-svn-id: svn://svn.chromium.org/blink/trunk@178647 bbb929c8-8fbe-4397-9dbb-9b2b20218538
138 files changed