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

Unified Diff: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 14318004: Add option to use GLContextVirtual in WGC3DIPCBI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use static enable function instead... Created 7 years, 8 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
« no previous file with comments | « webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index ae1242252f6c8d29918a3f9796b53d81ec79e323..c63e85585557856c6eb46ac035fe8ebd2aa2bb37 100644
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -31,8 +31,9 @@
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
#include "gpu/command_buffer/service/context_group.h"
-#include "gpu/command_buffer/service/transfer_buffer_manager.h"
+#include "gpu/command_buffer/service/gl_context_virtual.h"
#include "gpu/command_buffer/service/gpu_scheduler.h"
+#include "gpu/command_buffer/service/transfer_buffer_manager.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_share_group.h"
#include "ui/gl/gl_surface.h"
@@ -241,6 +242,8 @@ static base::LazyInstance<
std::set<GLInProcessContext*> >
g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER;
+static bool g_use_virtualized_gl_context = false;
+
namespace {
// Also calls DetachFromThread on all GLES2Decoders before the lock is released
@@ -478,9 +481,29 @@ bool GLInProcessContext::Initialize(
return false;
}
- context_ = gfx::GLContext::CreateGLContext(share_group.get(),
- surface_.get(),
- gpu_preference);
+ if (g_use_virtualized_gl_context) {
+ context_ = share_group->GetSharedContext();
+ if (!context_) {
+ context_ = gfx::GLContext::CreateGLContext(share_group.get(),
+ surface_.get(),
+ gpu_preference);
+ share_group->SetSharedContext(context_);
+ }
+
+ context_ = new ::gpu::GLContextVirtual(share_group.get(),
+ context_,
+ decoder_->AsWeakPtr());
+ if (context_->Initialize(surface_, gpu_preference)) {
+ VLOG(1) << "Created virtual GL context.";
+ } else {
+ context_ = NULL;
+ }
+ } else {
+ context_ = gfx::GLContext::CreateGLContext(share_group.get(),
+ surface_.get(),
+ gpu_preference);
+ }
+
if (!context_.get()) {
LOG(ERROR) << "Could not create GLContext.";
Destroy();
@@ -583,6 +606,18 @@ void GLInProcessContext::OnContextLost() {
context_lost_callback_.Run();
}
+// static
+void
+WebGraphicsContext3DInProcessCommandBufferImpl::EnableVirtualizedContext() {
+#if !defined(NDEBUG)
+ {
+ AutoLockAndDecoderDetachThread lock(g_decoder_lock.Get(),
+ g_all_shared_contexts.Get());
+ DCHECK(g_all_shared_contexts.Get().empty());
+ }
+#endif // !defined(NDEBUG)
+ g_use_virtualized_gl_context = true;
+}
// static
WebGraphicsContext3DInProcessCommandBufferImpl*
« no previous file with comments | « webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698