OLD | NEW |
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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (!surface_.get()) { | 398 if (!surface_.get()) { |
399 // Ensure the decoder is not destroyed if it is not initialized. | 399 // Ensure the decoder is not destroyed if it is not initialized. |
400 decoder_.reset(); | 400 decoder_.reset(); |
401 | 401 |
402 DLOG(ERROR) << "Failed to create surface.\n"; | 402 DLOG(ERROR) << "Failed to create surface.\n"; |
403 OnInitializeFailed(reply_message); | 403 OnInitializeFailed(reply_message); |
404 return; | 404 return; |
405 } | 405 } |
406 | 406 |
407 scoped_refptr<gfx::GLContext> context; | 407 scoped_refptr<gfx::GLContext> context; |
408 if ((context_group_->feature_info()->feature_flags().enable_virtual_context || | 408 if (CommandLine::ForCurrentProcess()->HasSwitch( |
409 CommandLine::ForCurrentProcess()->HasSwitch( | 409 switches::kEnableVirtualGLContexts) && channel_->share_group()) { |
410 switches::kEnableVirtualGLContexts)) && | |
411 channel_->share_group()) { | |
412 context = channel_->share_group()->GetSharedContext(); | 410 context = channel_->share_group()->GetSharedContext(); |
413 if (!context) { | 411 if (!context) { |
414 context = gfx::GLContext::CreateGLContext( | 412 context = gfx::GLContext::CreateGLContext( |
415 channel_->share_group(), | 413 channel_->share_group(), |
416 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), | 414 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), |
417 gpu_preference_); | 415 gpu_preference_); |
418 channel_->share_group()->SetSharedContext(context); | 416 channel_->share_group()->SetSharedContext(context); |
419 } | 417 } |
420 // This should be a non-virtual GL context. | 418 // This should be a non-virtual GL context. |
421 DCHECK(context->GetHandle()); | 419 DCHECK(context->GetHandle()); |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 // made current before calling methods on the surface. | 913 // made current before calling methods on the surface. |
916 if (!surface_ || !MakeCurrent()) | 914 if (!surface_ || !MakeCurrent()) |
917 return; | 915 return; |
918 surface_->SetFrontbufferAllocation( | 916 surface_->SetFrontbufferAllocation( |
919 allocation.browser_allocation.suggest_have_frontbuffer); | 917 allocation.browser_allocation.suggest_have_frontbuffer); |
920 } | 918 } |
921 | 919 |
922 } // namespace content | 920 } // namespace content |
923 | 921 |
924 #endif // defined(ENABLE_GPU) | 922 #endif // defined(ENABLE_GPU) |
OLD | NEW |