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 #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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 DCHECK(context->GetHandle()); | 404 DCHECK(context->GetHandle()); |
405 context = new gpu::GLContextVirtual(channel_->share_group(), | 405 context = new gpu::GLContextVirtual(channel_->share_group(), |
406 context, | 406 context, |
407 decoder_->AsWeakPtr()); | 407 decoder_->AsWeakPtr()); |
408 if (!context->Initialize(surface_, gpu_preference_)) { | 408 if (!context->Initialize(surface_, gpu_preference_)) { |
409 // TODO(sievers): The real context created above for the default | 409 // TODO(sievers): The real context created above for the default |
410 // offscreen surface might not be compatible with this surface. | 410 // offscreen surface might not be compatible with this surface. |
411 // Need to adjust at least GLX to be able to create the initial context | 411 // Need to adjust at least GLX to be able to create the initial context |
412 // with a config that is compatible with onscreen and offscreen surfaces. | 412 // with a config that is compatible with onscreen and offscreen surfaces. |
413 context = NULL; | 413 context = NULL; |
414 LOG(FATAL) << "Failed to initialize virtual GL context."; | 414 |
| 415 // Ensure the decoder is not destroyed if it is not initialized. |
| 416 decoder_.reset(); |
| 417 |
| 418 DLOG(ERROR) << "Failed to initialize virtual GL context."; |
| 419 OnInitializeFailed(reply_message); |
| 420 return; |
415 } else { | 421 } else { |
416 LOG(INFO) << "Created virtual GL context."; | 422 LOG(INFO) << "Created virtual GL context."; |
417 } | 423 } |
418 } | 424 } |
419 if (!context) { | 425 if (!context) { |
420 context = gfx::GLContext::CreateGLContext( | 426 context = gfx::GLContext::CreateGLContext( |
421 channel_->share_group(), | 427 channel_->share_group(), |
422 surface_.get(), | 428 surface_.get(), |
423 gpu_preference_); | 429 gpu_preference_); |
424 } | 430 } |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 if (surface_ && MakeCurrent()) | 872 if (surface_ && MakeCurrent()) |
867 surface_->SetFrontbufferAllocation( | 873 surface_->SetFrontbufferAllocation( |
868 allocation.browser_allocation.suggest_have_frontbuffer); | 874 allocation.browser_allocation.suggest_have_frontbuffer); |
869 } | 875 } |
870 | 876 |
871 last_memory_allocation_valid_ = true; | 877 last_memory_allocation_valid_ = true; |
872 last_memory_allocation_ = allocation; | 878 last_memory_allocation_ = allocation; |
873 } | 879 } |
874 | 880 |
875 } // namespace content | 881 } // namespace content |
OLD | NEW |