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

Unified Diff: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h

Issue 7860028: Retry 3 to split WebGraphicsContext3DCommandBufferImpl::initialize() into two stages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fold thread fixes into this patch. Created 9 years, 3 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: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
index 0749fa74e41e7a0f0e20bab7ad1acdd450b987db..48e7d9a97dc0abed40736e526766935643285350 100644
--- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
+++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h
@@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/task.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"
@@ -58,6 +59,9 @@ class WebGraphicsContext3DCommandBufferImpl
WebKit::WebView*,
bool renderDirectlyToWebView);
+ // Must be called after initialize() and before any of the following methods.
+ // Permanently binds to the first calling thread. Returns false if the
+ // graphics context fails to create. Do not call from more than one thread.
virtual bool makeContextCurrent();
virtual int width();
@@ -437,15 +441,28 @@ class WebGraphicsContext3DCommandBufferImpl
#endif
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);
+ bool initialize_failed_;
+
// The context we use for OpenGL rendering.
RendererGLContext* context_;
// The GLES2Implementation we use for OpenGL rendering.
gpu::gles2::GLES2Implementation* gl_;
+ // State needed by MaybeInitializeGL.
+ 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.
« no previous file with comments | « content/renderer/gpu/transport_texture_service.h ('k') | content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698