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/common/gpu_command_buffer_traits.h" | 5 #include "gpu/ipc/common/gpu_command_buffer_traits.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "gpu/command_buffer/common/command_buffer_id.h" | 10 #include "gpu/command_buffer/common/command_buffer_id.h" |
11 #include "gpu/command_buffer/common/mailbox_holder.h" | 11 #include "gpu/command_buffer/common/mailbox_holder.h" |
12 #include "gpu/command_buffer/common/sync_token.h" | 12 #include "gpu/command_buffer/common/sync_token.h" |
| 13 #include "gpu/command_buffer/common/texture_in_use_response.h" |
13 | 14 |
14 // Generate param traits size methods. | 15 // Generate param traits size methods. |
15 #include "ipc/param_traits_size_macros.h" | 16 #include "ipc/param_traits_size_macros.h" |
16 namespace IPC { | 17 namespace IPC { |
17 #include "gpu/ipc/common/gpu_command_buffer_traits_multi.h" | 18 #include "gpu/ipc/common/gpu_command_buffer_traits_multi.h" |
18 } // namespace IPC | 19 } // namespace IPC |
19 | 20 |
20 // Generate param traits write methods. | 21 // Generate param traits write methods. |
21 #include "ipc/param_traits_write_macros.h" | 22 #include "ipc/param_traits_write_macros.h" |
22 namespace IPC { | 23 namespace IPC { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 115 |
115 return true; | 116 return true; |
116 } | 117 } |
117 | 118 |
118 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { | 119 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { |
119 *l += base::StringPrintf( | 120 *l += base::StringPrintf( |
120 "[%" PRId8 ":%" PRIX64 "] %" PRIu64, p.namespace_id(), | 121 "[%" PRId8 ":%" PRIX64 "] %" PRIu64, p.namespace_id(), |
121 p.command_buffer_id().GetUnsafeValue(), p.release_count()); | 122 p.command_buffer_id().GetUnsafeValue(), p.release_count()); |
122 } | 123 } |
123 | 124 |
| 125 void ParamTraits<gpu::TextureInUseResponse>::GetSize(base::PickleSizer* s, |
| 126 const param_type& p) { |
| 127 GetParamSize(s, p.texture); |
| 128 GetParamSize(s, p.in_use); |
| 129 } |
| 130 |
| 131 void ParamTraits<gpu::TextureInUseResponse>::Write(base::Pickle* m, |
| 132 const param_type& p) { |
| 133 WriteParam(m, p.texture); |
| 134 WriteParam(m, p.in_use); |
| 135 } |
| 136 |
| 137 bool ParamTraits<gpu::TextureInUseResponse>::Read(const base::Pickle* m, |
| 138 base::PickleIterator* iter, |
| 139 param_type* p) { |
| 140 uint32_t texture = 0; |
| 141 bool in_use = false; |
| 142 |
| 143 if (!ReadParam(m, iter, &texture) || !ReadParam(m, iter, &in_use)) { |
| 144 return false; |
| 145 } |
| 146 |
| 147 p->texture = texture; |
| 148 p->in_use = in_use; |
| 149 return true; |
| 150 } |
| 151 |
| 152 void ParamTraits<gpu::TextureInUseResponse>::Log(const param_type& p, |
| 153 std::string* l) { |
| 154 *l += base::StringPrintf("[%u: %d]", p.texture, static_cast<int>(p.in_use)); |
| 155 } |
| 156 |
124 void ParamTraits<gpu::Mailbox>::GetSize(base::PickleSizer* s, | 157 void ParamTraits<gpu::Mailbox>::GetSize(base::PickleSizer* s, |
125 const param_type& p) { | 158 const param_type& p) { |
126 s->AddBytes(sizeof(p.name)); | 159 s->AddBytes(sizeof(p.name)); |
127 } | 160 } |
128 | 161 |
129 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) { | 162 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) { |
130 m->WriteBytes(p.name, sizeof(p.name)); | 163 m->WriteBytes(p.name, sizeof(p.name)); |
131 } | 164 } |
132 | 165 |
133 bool ParamTraits<gpu::Mailbox>::Read(const base::Pickle* m, | 166 bool ParamTraits<gpu::Mailbox>::Read(const base::Pickle* m, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 return true; | 202 return true; |
170 } | 203 } |
171 | 204 |
172 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) { | 205 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) { |
173 LogParam(p.mailbox, l); | 206 LogParam(p.mailbox, l); |
174 LogParam(p.sync_token, l); | 207 LogParam(p.sync_token, l); |
175 *l += base::StringPrintf(":%04x@", p.texture_target); | 208 *l += base::StringPrintf(":%04x@", p.texture_target); |
176 } | 209 } |
177 | 210 |
178 } // namespace IPC | 211 } // namespace IPC |
OLD | NEW |