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/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 // Check local cache to see if there is already a client side shared memory | 332 // Check local cache to see if there is already a client side shared memory |
333 // object for this id. | 333 // object for this id. |
334 TransferBufferMap::iterator it = transfer_buffers_.find(id); | 334 TransferBufferMap::iterator it = transfer_buffers_.find(id); |
335 if (it != transfer_buffers_.end()) { | 335 if (it != transfer_buffers_.end()) { |
336 return it->second; | 336 return it->second; |
337 } | 337 } |
338 | 338 |
339 // Assuming we are in the renderer process, the service is responsible for | 339 // Assuming we are in the renderer process, the service is responsible for |
340 // duplicating the handle. This might not be true for NaCl. | 340 // duplicating the handle. This might not be true for NaCl. |
341 base::SharedMemoryHandle handle; | 341 base::SharedMemoryHandle handle = base::SharedMemoryHandle(); |
342 uint32 size; | 342 uint32 size; |
343 if (!Send(new GpuCommandBufferMsg_GetTransferBuffer(route_id_, | 343 if (!Send(new GpuCommandBufferMsg_GetTransferBuffer(route_id_, |
344 id, | 344 id, |
345 &handle, | 345 &handle, |
346 &size))) { | 346 &size))) { |
347 return Buffer(); | 347 return Buffer(); |
348 } | 348 } |
349 | 349 |
350 // Cache the transfer buffer shared memory object client side. | 350 // Cache the transfer buffer shared memory object client side. |
351 base::SharedMemory* shared_memory = new base::SharedMemory(handle, false); | 351 base::SharedMemory* shared_memory = new base::SharedMemory(handle, false); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 554 |
555 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( | 555 void CommandBufferProxyImpl::SetOnConsoleMessageCallback( |
556 const GpuConsoleMessageCallback& callback) { | 556 const GpuConsoleMessageCallback& callback) { |
557 console_message_callback_ = callback; | 557 console_message_callback_ = callback; |
558 } | 558 } |
559 | 559 |
560 void CommandBufferProxyImpl::TryUpdateState() { | 560 void CommandBufferProxyImpl::TryUpdateState() { |
561 if (last_state_.error == gpu::error::kNoError) | 561 if (last_state_.error == gpu::error::kNoError) |
562 shared_state_->Read(&last_state_); | 562 shared_state_->Read(&last_state_); |
563 } | 563 } |
OLD | NEW |