| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 OnInitializeFailed(reply_message); | 364 OnInitializeFailed(reply_message); |
| 365 return; | 365 return; |
| 366 } | 366 } |
| 367 #endif | 367 #endif |
| 368 | 368 |
| 369 surface_ = ImageTransportSurface::CreateSurface( | 369 surface_ = ImageTransportSurface::CreateSurface( |
| 370 channel_->gpu_channel_manager(), | 370 channel_->gpu_channel_manager(), |
| 371 this, | 371 this, |
| 372 handle_); | 372 handle_); |
| 373 } else { | 373 } else { |
| 374 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(software_, | 374 GpuChannelManager* manager = channel_->gpu_channel_manager(); |
| 375 gfx::Size(1, 1)); | 375 surface_ = manager->GetDefaultOffscreenSurface(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 if (!surface_.get()) { | 378 if (!surface_.get()) { |
| 379 // Ensure the decoder is not destroyed if it is not initialized. | 379 // Ensure the decoder is not destroyed if it is not initialized. |
| 380 decoder_.reset(); | 380 decoder_.reset(); |
| 381 | 381 |
| 382 DLOG(ERROR) << "Failed to create surface.\n"; | 382 DLOG(ERROR) << "Failed to create surface.\n"; |
| 383 OnInitializeFailed(reply_message); | 383 OnInitializeFailed(reply_message); |
| 384 return; | 384 return; |
| 385 } | 385 } |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 const GpuMemoryAllocation& allocation) { | 831 const GpuMemoryAllocation& allocation) { |
| 832 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 832 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
| 833 // This can be called outside of OnMessageReceived, so the context needs to be | 833 // This can be called outside of OnMessageReceived, so the context needs to be |
| 834 // made current before calling methods on the surface. | 834 // made current before calling methods on the surface. |
| 835 if (!surface_ || !MakeCurrent()) | 835 if (!surface_ || !MakeCurrent()) |
| 836 return; | 836 return; |
| 837 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 837 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
| 838 } | 838 } |
| 839 | 839 |
| 840 #endif // defined(ENABLE_GPU) | 840 #endif // defined(ENABLE_GPU) |
| OLD | NEW |