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 #ifndef CHROME_COMMON_COMMAND_BUFFER_MESSAGES_H_ | 5 #ifndef CHROME_COMMON_COMMAND_BUFFER_MESSAGES_H_ |
6 #define CHROME_COMMON_COMMAND_BUFFER_MESSAGES_H_ | 6 #define CHROME_COMMON_COMMAND_BUFFER_MESSAGES_H_ |
7 | 7 |
| 8 #include "chrome/common/common_param_traits.h" |
| 9 #include "gpu/command_buffer/common/command_buffer.h" |
| 10 |
| 11 namespace IPC { |
| 12 template <> |
| 13 struct ParamTraits<gpu::CommandBuffer::State> { |
| 14 typedef gpu::CommandBuffer::State param_type; |
| 15 static void Write(Message* m, const param_type& p) { |
| 16 m->WriteInt(p.size); |
| 17 m->WriteInt(p.get_offset); |
| 18 m->WriteInt(p.put_offset); |
| 19 m->WriteInt(p.token); |
| 20 m->WriteInt(p.error); |
| 21 } |
| 22 static bool Read(const Message* m, void** iter, param_type* p) { |
| 23 int32 temp; |
| 24 if (m->ReadInt(iter, &p->size) && |
| 25 m->ReadInt(iter, &p->get_offset) && |
| 26 m->ReadInt(iter, &p->put_offset) && |
| 27 m->ReadInt(iter, &p->token) && |
| 28 m->ReadInt(iter, &temp)) { |
| 29 p->error = static_cast<gpu::parse_error::ParseError>(temp); |
| 30 return true; |
| 31 } else { |
| 32 return false; |
| 33 } |
| 34 } |
| 35 static void Log(const param_type& p, std::wstring* l) { |
| 36 l->append(L"<CommandBuffer::State>"); |
| 37 } |
| 38 }; |
| 39 } // namespace IPC |
| 40 |
8 #define MESSAGES_INTERNAL_FILE "chrome/common/command_buffer_messages_internal.h
" | 41 #define MESSAGES_INTERNAL_FILE "chrome/common/command_buffer_messages_internal.h
" |
9 #include "ipc/ipc_message_macros.h" | 42 #include "ipc/ipc_message_macros.h" |
10 | 43 |
11 #endif // CHROME_COMMON_COMMAND_BUFFER_MESSAGES_H_ | 44 #endif // CHROME_COMMON_COMMAND_BUFFER_MESSAGES_H_ |
OLD | NEW |