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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 // The scheduler has raw references to the decoder and the command buffer so | 273 // The scheduler has raw references to the decoder and the command buffer so |
274 // destroy it before those. | 274 // destroy it before those. |
275 scheduler_.reset(); | 275 scheduler_.reset(); |
276 | 276 |
277 while (!delayed_echos_.empty()) { | 277 while (!delayed_echos_.empty()) { |
278 delete delayed_echos_.front(); | 278 delete delayed_echos_.front(); |
279 delayed_echos_.pop_front(); | 279 delayed_echos_.pop_front(); |
280 } | 280 } |
281 | 281 |
| 282 bool have_context = false; |
282 if (decoder_.get()) | 283 if (decoder_.get()) |
283 decoder_->MakeCurrent(); | 284 have_context = decoder_->MakeCurrent(); |
284 FOR_EACH_OBSERVER(DestructionObserver, | 285 FOR_EACH_OBSERVER(DestructionObserver, |
285 destruction_observers_, | 286 destruction_observers_, |
286 OnWillDestroyStub(this)); | 287 OnWillDestroyStub(this)); |
287 | 288 |
288 if (decoder_.get()) { | 289 if (decoder_.get()) { |
289 decoder_->Destroy(true); | 290 decoder_->Destroy(have_context); |
290 decoder_.reset(); | 291 decoder_.reset(); |
291 } | 292 } |
292 | 293 |
293 command_buffer_.reset(); | 294 command_buffer_.reset(); |
294 | 295 |
295 context_ = NULL; | 296 context_ = NULL; |
296 surface_ = NULL; | 297 surface_ = NULL; |
297 | 298 |
298 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(false); | 299 channel_->gpu_channel_manager()->gpu_memory_manager()->ScheduleManage(false); |
299 } | 300 } |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 const GpuMemoryAllocation& allocation) { | 803 const GpuMemoryAllocation& allocation) { |
803 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 804 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
804 // This can be called outside of OnMessageReceived, so the context needs to be | 805 // This can be called outside of OnMessageReceived, so the context needs to be |
805 // made current before calling methods on the surface. | 806 // made current before calling methods on the surface. |
806 if (!surface_ || !MakeCurrent()) | 807 if (!surface_ || !MakeCurrent()) |
807 return; | 808 return; |
808 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 809 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
809 } | 810 } |
810 | 811 |
811 #endif // defined(ENABLE_GPU) | 812 #endif // defined(ENABLE_GPU) |
OLD | NEW |