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 | 6 |
7 #include "gpu/command_buffer/common/mailbox_holder.h" | 7 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 8 #include "gpu/command_buffer/common/value_state.h" |
8 | 9 |
9 // Generate param traits write methods. | 10 // Generate param traits write methods. |
10 #include "ipc/param_traits_write_macros.h" | 11 #include "ipc/param_traits_write_macros.h" |
11 namespace IPC { | 12 namespace IPC { |
12 #include "gpu/ipc/gpu_command_buffer_traits_multi.h" | 13 #include "gpu/ipc/gpu_command_buffer_traits_multi.h" |
13 } // namespace IPC | 14 } // namespace IPC |
14 | 15 |
15 // Generate param traits read methods. | 16 // Generate param traits read methods. |
16 #include "ipc/param_traits_read_macros.h" | 17 #include "ipc/param_traits_read_macros.h" |
17 namespace IPC { | 18 namespace IPC { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 !ReadParam(m, iter, &p->sync_point)) | 89 !ReadParam(m, iter, &p->sync_point)) |
89 return false; | 90 return false; |
90 return true; | 91 return true; |
91 } | 92 } |
92 | 93 |
93 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) { | 94 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) { |
94 ParamTraits<gpu::Mailbox>::Log(p.mailbox, l); | 95 ParamTraits<gpu::Mailbox>::Log(p.mailbox, l); |
95 *l += base::StringPrintf(":%04x@%d", p.texture_target, p.sync_point); | 96 *l += base::StringPrintf(":%04x@%d", p.texture_target, p.sync_point); |
96 } | 97 } |
97 | 98 |
| 99 void ParamTraits<gpu::ValueState>::Write(Message* m, const param_type& p) { |
| 100 m->WriteData(reinterpret_cast<const char*>(&p), |
| 101 sizeof(gpu::ValueState)); |
| 102 } |
| 103 |
| 104 bool ParamTraits<gpu::ValueState>::Read(const Message* m, |
| 105 PickleIterator* iter, |
| 106 param_type* p) { |
| 107 int length; |
| 108 const char* data = NULL; |
| 109 if (!m->ReadData(iter, &data, &length) || length != sizeof(gpu::ValueState)) |
| 110 return false; |
| 111 DCHECK(data); |
| 112 memcpy(p, data, sizeof(gpu::ValueState)); |
| 113 return true; |
| 114 } |
| 115 |
| 116 void ParamTraits<gpu::ValueState>::Log(const param_type& p, std::string* l) { |
| 117 l->append("<ValueState ("); |
| 118 for (size_t i = 0; i < sizeof(p.int_value); ++i) |
| 119 *l += base::StringPrintf("%i ", p.int_value[i]); |
| 120 l->append(" int values "); |
| 121 for (size_t i = 0; i < sizeof(p.float_value); ++i) |
| 122 *l += base::StringPrintf("%f ", p.float_value[i]); |
| 123 l->append(" float values)>"); |
| 124 } |
| 125 |
98 } // namespace IPC | 126 } // namespace IPC |
OLD | NEW |