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