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 "content/common/gpu/client/command_buffer_proxy_impl.h" | 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 *id = new_id; | 336 *id = new_id; |
337 DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end()); | 337 DCHECK(gpu_memory_buffers_.find(new_id) == gpu_memory_buffers_.end()); |
338 return gpu_memory_buffers_.add(new_id, buffer.Pass()).first->second; | 338 return gpu_memory_buffers_.add(new_id, buffer.Pass()).first->second; |
339 } | 339 } |
340 | 340 |
341 void CommandBufferProxyImpl::DestroyGpuMemoryBuffer(int32 id) { | 341 void CommandBufferProxyImpl::DestroyGpuMemoryBuffer(int32 id) { |
342 if (last_state_.error != gpu::error::kNoError) | 342 if (last_state_.error != gpu::error::kNoError) |
343 return; | 343 return; |
344 | 344 |
345 Send(new GpuCommandBufferMsg_DestroyGpuMemoryBuffer(route_id_, id)); | 345 Send(new GpuCommandBufferMsg_UnregisterGpuMemoryBuffer(route_id_, id)); |
346 | 346 |
347 // Remove the gpu memory buffer from the client side cache. | 347 // Remove the gpu memory buffer from the client side cache. |
348 gpu_memory_buffers_.erase(id); | 348 DCHECK(gpu_memory_buffers_.find(id) != gpu_memory_buffers_.end()); |
| 349 channel_->factory()->DeleteGpuMemoryBuffer(gpu_memory_buffers_.take(id)); |
349 } | 350 } |
350 | 351 |
351 int CommandBufferProxyImpl::GetRouteID() const { | 352 int CommandBufferProxyImpl::GetRouteID() const { |
352 return route_id_; | 353 return route_id_; |
353 } | 354 } |
354 | 355 |
355 void CommandBufferProxyImpl::Echo(const base::Closure& callback) { | 356 void CommandBufferProxyImpl::Echo(const base::Closure& callback) { |
356 if (last_state_.error != gpu::error::kNoError) { | 357 if (last_state_.error != gpu::error::kNoError) { |
357 return; | 358 return; |
358 } | 359 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 if (last_state_.error == gpu::error::kNoError) | 518 if (last_state_.error == gpu::error::kNoError) |
518 shared_state()->Read(&last_state_); | 519 shared_state()->Read(&last_state_); |
519 } | 520 } |
520 | 521 |
521 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { | 522 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { |
522 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 523 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
523 shared_state_shm_->memory()); | 524 shared_state_shm_->memory()); |
524 } | 525 } |
525 | 526 |
526 } // namespace content | 527 } // namespace content |
OLD | NEW |