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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 13647014: Attach flag to use virtual context for WebGraphicsContext3D (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove printf... 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 gpu::gles2::ImageManager* image_manager, 104 gpu::gles2::ImageManager* image_manager,
105 const gfx::Size& size, 105 const gfx::Size& size,
106 const gpu::gles2::DisallowedFeatures& disallowed_features, 106 const gpu::gles2::DisallowedFeatures& disallowed_features,
107 const std::string& allowed_extensions, 107 const std::string& allowed_extensions,
108 const std::vector<int32>& attribs, 108 const std::vector<int32>& attribs,
109 gfx::GpuPreference gpu_preference, 109 gfx::GpuPreference gpu_preference,
110 int32 route_id, 110 int32 route_id,
111 int32 surface_id, 111 int32 surface_id,
112 GpuWatchdog* watchdog, 112 GpuWatchdog* watchdog,
113 bool software, 113 bool software,
114 bool use_virtual_gl_context,
114 const GURL& active_url) 115 const GURL& active_url)
115 : channel_(channel), 116 : channel_(channel),
116 handle_(handle), 117 handle_(handle),
117 initial_size_(size), 118 initial_size_(size),
118 disallowed_features_(disallowed_features), 119 disallowed_features_(disallowed_features),
119 allowed_extensions_(allowed_extensions), 120 allowed_extensions_(allowed_extensions),
120 requested_attribs_(attribs), 121 requested_attribs_(attribs),
121 gpu_preference_(gpu_preference), 122 gpu_preference_(gpu_preference),
122 route_id_(route_id), 123 route_id_(route_id),
123 surface_id_(surface_id), 124 surface_id_(surface_id),
124 software_(software), 125 software_(software),
126 use_virtual_gl_context_(use_virtual_gl_context),
125 last_flush_count_(0), 127 last_flush_count_(0),
126 last_memory_allocation_valid_(false), 128 last_memory_allocation_valid_(false),
127 parent_stub_for_initialization_(), 129 parent_stub_for_initialization_(),
128 parent_texture_for_initialization_(0), 130 parent_texture_for_initialization_(0),
129 watchdog_(watchdog), 131 watchdog_(watchdog),
130 sync_point_wait_count_(0), 132 sync_point_wait_count_(0),
131 delayed_work_scheduled_(false), 133 delayed_work_scheduled_(false),
132 previous_messages_processed_(0), 134 previous_messages_processed_(0),
133 active_url_(active_url), 135 active_url_(active_url),
134 total_gpu_memory_(0) { 136 total_gpu_memory_(0) {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 surface_ = manager->GetDefaultOffscreenSurface(); 430 surface_ = manager->GetDefaultOffscreenSurface();
429 } 431 }
430 432
431 if (!surface_.get()) { 433 if (!surface_.get()) {
432 DLOG(ERROR) << "Failed to create surface.\n"; 434 DLOG(ERROR) << "Failed to create surface.\n";
433 OnInitializeFailed(reply_message); 435 OnInitializeFailed(reply_message);
434 return; 436 return;
435 } 437 }
436 438
437 scoped_refptr<gfx::GLContext> context; 439 scoped_refptr<gfx::GLContext> context;
438 if (CommandLine::ForCurrentProcess()->HasSwitch( 440 if ((CommandLine::ForCurrentProcess()->HasSwitch(
439 switches::kEnableVirtualGLContexts) && channel_->share_group()) { 441 switches::kEnableVirtualGLContexts) || use_virtual_gl_context_) &&
442 channel_->share_group()) {
440 context = channel_->share_group()->GetSharedContext(); 443 context = channel_->share_group()->GetSharedContext();
441 if (!context) { 444 if (!context) {
442 context = gfx::GLContext::CreateGLContext( 445 context = gfx::GLContext::CreateGLContext(
443 channel_->share_group(), 446 channel_->share_group(),
444 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), 447 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(),
445 gpu_preference_); 448 gpu_preference_);
446 channel_->share_group()->SetSharedContext(context); 449 channel_->share_group()->SetSharedContext(context);
447 } 450 }
448 // This should be a non-virtual GL context. 451 // This should be a non-virtual GL context.
449 DCHECK(context->GetHandle()); 452 DCHECK(context->GetHandle());
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 if (surface_ && MakeCurrent()) 926 if (surface_ && MakeCurrent())
924 surface_->SetFrontbufferAllocation( 927 surface_->SetFrontbufferAllocation(
925 allocation.browser_allocation.suggest_have_frontbuffer); 928 allocation.browser_allocation.suggest_have_frontbuffer);
926 } 929 }
927 930
928 last_memory_allocation_valid_ = true; 931 last_memory_allocation_valid_ = true;
929 last_memory_allocation_ = allocation; 932 last_memory_allocation_ = allocation;
930 } 933 }
931 934
932 } // namespace content 935 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698