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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 delayed_echos_.pop_front(); | 207 delayed_echos_.pop_front(); |
208 } | 208 } |
209 | 209 |
210 if (decoder_.get()) | 210 if (decoder_.get()) |
211 decoder_->MakeCurrent(); | 211 decoder_->MakeCurrent(); |
212 FOR_EACH_OBSERVER(DestructionObserver, | 212 FOR_EACH_OBSERVER(DestructionObserver, |
213 destruction_observers_, | 213 destruction_observers_, |
214 OnWillDestroyStub(this)); | 214 OnWillDestroyStub(this)); |
215 | 215 |
216 if (decoder_.get()) { | 216 if (decoder_.get()) { |
217 decoder_->Destroy(); | 217 decoder_->Destroy(true); |
218 decoder_.reset(); | 218 decoder_.reset(); |
219 } | 219 } |
220 | 220 |
221 command_buffer_.reset(); | 221 command_buffer_.reset(); |
222 | 222 |
223 context_ = NULL; | 223 context_ = NULL; |
224 surface_ = NULL; | 224 surface_ = NULL; |
225 | 225 |
226 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(); | 226 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(); |
227 } | 227 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 gpu_preference); | 289 gpu_preference); |
290 if (!context_.get()) { | 290 if (!context_.get()) { |
291 // Ensure the decoder is not destroyed if it is not initialized. | 291 // Ensure the decoder is not destroyed if it is not initialized. |
292 decoder_.reset(); | 292 decoder_.reset(); |
293 | 293 |
294 DLOG(ERROR) << "Failed to create context.\n"; | 294 DLOG(ERROR) << "Failed to create context.\n"; |
295 OnInitializeFailed(reply_message); | 295 OnInitializeFailed(reply_message); |
296 return; | 296 return; |
297 } | 297 } |
298 | 298 |
| 299 if (!context_->MakeCurrent(surface_.get())) { |
| 300 LOG(ERROR) << "Failed to make context current."; |
| 301 OnInitializeFailed(reply_message); |
| 302 return; |
| 303 } |
| 304 |
299 // Initialize the decoder with either the view or pbuffer GLContext. | 305 // Initialize the decoder with either the view or pbuffer GLContext. |
300 if (!decoder_->Initialize(surface_.get(), | 306 if (!decoder_->Initialize(surface_, |
301 context_.get(), | 307 context_, |
302 !surface_id(), | 308 !surface_id(), |
303 initial_size_, | 309 initial_size_, |
304 disallowed_features_, | 310 disallowed_features_, |
305 allowed_extensions_.c_str(), | 311 allowed_extensions_.c_str(), |
306 requested_attribs_)) { | 312 requested_attribs_)) { |
307 DLOG(ERROR) << "Failed to initialize decoder."; | 313 DLOG(ERROR) << "Failed to initialize decoder."; |
308 OnInitializeFailed(reply_message); | 314 OnInitializeFailed(reply_message); |
309 return; | 315 return; |
310 } | 316 } |
311 | 317 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 | 648 |
643 void GpuCommandBufferStub::SetMemoryAllocation( | 649 void GpuCommandBufferStub::SetMemoryAllocation( |
644 const GpuMemoryAllocation& allocation) { | 650 const GpuMemoryAllocation& allocation) { |
645 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 651 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
646 if (!surface_) | 652 if (!surface_) |
647 return; | 653 return; |
648 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 654 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
649 } | 655 } |
650 | 656 |
651 #endif // defined(ENABLE_GPU) | 657 #endif // defined(ENABLE_GPU) |
OLD | NEW |