Chromium Code Reviews| 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 "gpu/ipc/gpu_command_buffer_traits.h" | 5 #include "gpu/ipc/gpu_command_buffer_traits.h" |
| 6 #include "gpu/command_buffer/common/mailbox.h" | |
| 6 | 7 |
| 7 namespace IPC { | 8 namespace IPC { |
| 8 | 9 |
| 9 void ParamTraits<gpu::CommandBuffer::State> ::Write(Message* m, | 10 void ParamTraits<gpu::CommandBuffer::State> ::Write(Message* m, |
| 10 const param_type& p) { | 11 const param_type& p) { |
| 11 WriteParam(m, p.num_entries); | 12 WriteParam(m, p.num_entries); |
| 12 WriteParam(m, p.get_offset); | 13 WriteParam(m, p.get_offset); |
| 13 WriteParam(m, p.put_offset); | 14 WriteParam(m, p.put_offset); |
| 14 WriteParam(m, p.token); | 15 WriteParam(m, p.token); |
| 15 WriteParam(m, static_cast<int32>(p.error)); | 16 WriteParam(m, static_cast<int32>(p.error)); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 31 } else { | 32 } else { |
| 32 return false; | 33 return false; |
| 33 } | 34 } |
| 34 } | 35 } |
| 35 | 36 |
| 36 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, | 37 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, |
| 37 std::string* l) { | 38 std::string* l) { |
| 38 l->append("<CommandBuffer::State>"); | 39 l->append("<CommandBuffer::State>"); |
| 39 } | 40 } |
| 40 | 41 |
| 42 void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) { | |
| 43 m->WriteBytes(p.name, sizeof(p.name)); | |
| 44 } | |
| 45 | |
| 46 bool ParamTraits<gpu::Mailbox>::Read(const Message* m, | |
| 47 PickleIterator* iter, | |
|
no sievers
2013/03/04 18:27:41
nit: alignment
piman
2013/03/04 18:52:05
Thanks, fixed.
| |
| 48 param_type* p) { | |
| 49 const char* bytes = NULL; | |
| 50 if (!m->ReadBytes(iter, &bytes, sizeof(p->name))) | |
| 51 return false; | |
| 52 DCHECK(bytes); | |
| 53 memcpy(p->name, bytes, sizeof(p->name)); | |
| 54 return true; | |
| 55 } | |
| 56 | |
| 57 void ParamTraits<gpu::Mailbox>::Log(const param_type& p, std::string* l) { | |
| 58 for (size_t i = 0; i < sizeof(p.name); ++i) | |
| 59 *l += base::StringPrintf("%02x", p.name[i]); | |
| 60 } | |
| 61 | |
| 62 | |
| 41 } // namespace IPC | 63 } // namespace IPC |
| OLD | NEW |