| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "chrome/common/gpu_messages.h" | 9 #include "chrome/common/gpu_messages.h" |
| 10 #include "chrome/common/plugin_messages.h" | 10 #include "chrome/common/plugin_messages.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Delete all the locally cached shared memory objects, closing the handle | 27 // Delete all the locally cached shared memory objects, closing the handle |
| 28 // in this process. | 28 // in this process. |
| 29 for (TransferBufferMap::iterator it = transfer_buffers_.begin(); | 29 for (TransferBufferMap::iterator it = transfer_buffers_.begin(); |
| 30 it != transfer_buffers_.end(); | 30 it != transfer_buffers_.end(); |
| 31 ++it) { | 31 ++it) { |
| 32 delete it->second.shared_memory; | 32 delete it->second.shared_memory; |
| 33 it->second.shared_memory = NULL; | 33 it->second.shared_memory = NULL; |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 void CommandBufferProxy::OnMessageReceived(const IPC::Message& message) { | 37 bool CommandBufferProxy::OnMessageReceived(const IPC::Message& message) { |
| 38 bool handled = true; |
| 38 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxy, message) | 39 IPC_BEGIN_MESSAGE_MAP(CommandBufferProxy, message) |
| 39 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_UpdateState, OnUpdateState); | 40 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_UpdateState, OnUpdateState); |
| 40 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffers, OnSwapBuffers); | 41 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffers, OnSwapBuffers); |
| 41 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, | 42 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, |
| 42 OnNotifyRepaint); | 43 OnNotifyRepaint); |
| 43 IPC_MESSAGE_UNHANDLED_ERROR() | 44 IPC_MESSAGE_UNHANDLED(handled = false) |
| 44 IPC_END_MESSAGE_MAP() | 45 IPC_END_MESSAGE_MAP() |
| 46 DCHECK(handled); |
| 47 return handled; |
| 45 } | 48 } |
| 46 | 49 |
| 47 void CommandBufferProxy::OnChannelError() { | 50 void CommandBufferProxy::OnChannelError() { |
| 48 // Prevent any further messages from being sent. | 51 // Prevent any further messages from being sent. |
| 49 channel_ = NULL; | 52 channel_ = NULL; |
| 50 | 53 |
| 51 // When the client sees that the context is lost, they should delete this | 54 // When the client sees that the context is lost, they should delete this |
| 52 // CommandBufferProxy and create a new one. | 55 // CommandBufferProxy and create a new one. |
| 53 last_state_.error = gpu::error::kLostContext; | 56 last_state_.error = gpu::error::kLostContext; |
| 54 } | 57 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 pending_async_flush_tasks_.pop(); | 302 pending_async_flush_tasks_.pop(); |
| 300 | 303 |
| 301 if (task.get()) { | 304 if (task.get()) { |
| 302 // Although we need need to update last_state_ while potentially waiting | 305 // Although we need need to update last_state_ while potentially waiting |
| 303 // for a synchronous flush to complete, we do not need to invoke the | 306 // for a synchronous flush to complete, we do not need to invoke the |
| 304 // callback synchonously. Also, post it as a non nestable task so it is | 307 // callback synchonously. Also, post it as a non nestable task so it is |
| 305 // always invoked by the outermost message loop. | 308 // always invoked by the outermost message loop. |
| 306 MessageLoop::current()->PostNonNestableTask(FROM_HERE, task.release()); | 309 MessageLoop::current()->PostNonNestableTask(FROM_HERE, task.release()); |
| 307 } | 310 } |
| 308 } | 311 } |
| OLD | NEW |