Index: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h |
=================================================================== |
--- content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h (revision 98055) |
+++ content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h (working copy) |
@@ -10,8 +10,10 @@ |
#include <vector> |
+#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "content/renderer/gpu/renderer_gl_context.h" |
+#include "googleurl/src/gurl.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGraphicsContext3D.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
@@ -23,6 +25,7 @@ |
class GpuChannelHost; |
class CommandBufferProxy; |
+class MessageLoop; |
namespace gpu { |
namespace gles2 { |
@@ -57,6 +60,10 @@ |
WebKit::WebView*, |
bool renderDirectlyToWebView); |
+ // Must be called after initialize() and before any of the following methods. |
+ // Binds this object to the current thread. We can't bind to multiple threads. |
+ // TODO(husky): Document threading restrictions in WebGraphicsContext3D.h, |
+ // enforce strictly in all implementations. |
virtual bool makeContextCurrent(); |
virtual int width(); |
@@ -431,6 +438,12 @@ |
WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback); |
private: |
+ // Initialize the underlying GL context. May be called multiple times; second |
+ // and subsequent calls are ignored. Must be called from the thread that is |
+ // going to use this object to issue GL commands (which might not be the main |
+ // thread). |
+ bool MaybeInitializeGL(); |
+ |
// SwapBuffers callback. |
void OnSwapBuffersComplete(); |
virtual void OnContextLost(RendererGLContext::ContextLostReason reason); |
@@ -439,7 +452,16 @@ |
RendererGLContext* context_; |
// The GLES2Implementation we use for OpenGL rendering. |
gpu::gles2::GLES2Implementation* gl_; |
+#ifndef NDEBUG |
+ // Used to assert that GL commands are issued from a single thread. |
+ MessageLoop* gl_message_loop_; |
nduca
2011/08/25 02:10:01
owning_message_loop_?
Can we get this more via a
lain Merrick
2011/08/25 19:55:16
Great idea, done.
|
+#endif |
+ // State needed by InitializeGLES2. |
+ GpuChannelHost* host_; |
+ GURL active_url_; |
+ int32 render_view_routing_id_; |
+ |
bool render_directly_to_web_view_; |
#ifndef WTF_USE_THREADED_COMPOSITING |
// If rendering directly to WebView, weak pointer to it. |