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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 369 } |
370 | 370 |
371 if (!context_->MakeCurrent(surface_.get())) { | 371 if (!context_->MakeCurrent(surface_.get())) { |
372 // Ensure the decoder is not destroyed if it is not initialized. | 372 // Ensure the decoder is not destroyed if it is not initialized. |
373 decoder_.reset(); | 373 decoder_.reset(); |
374 LOG(ERROR) << "Failed to make context current."; | 374 LOG(ERROR) << "Failed to make context current."; |
375 OnInitializeFailed(reply_message); | 375 OnInitializeFailed(reply_message); |
376 return; | 376 return; |
377 } | 377 } |
378 | 378 |
| 379 if (!context_group_->has_program_cache()) { |
| 380 context_group_->set_program_cache( |
| 381 channel_->gpu_channel_manager()->program_cache()); |
| 382 } |
| 383 |
379 // Initialize the decoder with either the view or pbuffer GLContext. | 384 // Initialize the decoder with either the view or pbuffer GLContext. |
380 if (!decoder_->Initialize(surface_, | 385 if (!decoder_->Initialize(surface_, |
381 context_, | 386 context_, |
382 !surface_id(), | 387 !surface_id(), |
383 initial_size_, | 388 initial_size_, |
384 disallowed_features_, | 389 disallowed_features_, |
385 allowed_extensions_.c_str(), | 390 allowed_extensions_.c_str(), |
386 requested_attribs_)) { | 391 requested_attribs_)) { |
387 DLOG(ERROR) << "Failed to initialize decoder."; | 392 DLOG(ERROR) << "Failed to initialize decoder."; |
388 OnInitializeFailed(reply_message); | 393 OnInitializeFailed(reply_message); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 const GpuMemoryAllocation& allocation) { | 802 const GpuMemoryAllocation& allocation) { |
798 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 803 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
799 // This can be called outside of OnMessageReceived, so the context needs to be | 804 // This can be called outside of OnMessageReceived, so the context needs to be |
800 // made current before calling methods on the surface. | 805 // made current before calling methods on the surface. |
801 if (!surface_ || !MakeCurrent()) | 806 if (!surface_ || !MakeCurrent()) |
802 return; | 807 return; |
803 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 808 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
804 } | 809 } |
805 | 810 |
806 #endif // defined(ENABLE_GPU) | 811 #endif // defined(ENABLE_GPU) |
OLD | NEW |