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 | 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/mailbox_holder.h" | 11 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 11 #include "gpu/command_buffer/common/sync_token.h" | 12 #include "gpu/command_buffer/common/sync_token.h" |
| 12 #include "gpu/command_buffer/common/value_state.h" | 13 #include "gpu/command_buffer/common/value_state.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/gpu_command_buffer_traits_multi.h" | 18 #include "gpu/ipc/gpu_command_buffer_traits_multi.h" |
| 18 } // namespace IPC | 19 } // namespace IPC |
| 19 | 20 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 WriteParam(m, p.command_buffer_id()); | 89 WriteParam(m, p.command_buffer_id()); |
| 89 WriteParam(m, p.release_count()); | 90 WriteParam(m, p.release_count()); |
| 90 } | 91 } |
| 91 | 92 |
| 92 bool ParamTraits<gpu::SyncToken>::Read(const base::Pickle* m, | 93 bool ParamTraits<gpu::SyncToken>::Read(const base::Pickle* m, |
| 93 base::PickleIterator* iter, | 94 base::PickleIterator* iter, |
| 94 param_type* p) { | 95 param_type* p) { |
| 95 bool verified_flush = false; | 96 bool verified_flush = false; |
| 96 gpu::CommandBufferNamespace namespace_id = | 97 gpu::CommandBufferNamespace namespace_id = |
| 97 gpu::CommandBufferNamespace::INVALID; | 98 gpu::CommandBufferNamespace::INVALID; |
| 98 uint64_t command_buffer_id = 0; | 99 gpu::CommandBufferId command_buffer_id; |
| 99 uint64_t release_count = 0; | 100 uint64_t release_count = 0; |
| 100 | 101 |
| 101 if (!ReadParam(m, iter, &verified_flush) || | 102 if (!ReadParam(m, iter, &verified_flush) || |
| 102 !ReadParam(m, iter, &namespace_id) || | 103 !ReadParam(m, iter, &namespace_id) || |
| 103 !ReadParam(m, iter, &command_buffer_id) || | 104 !ReadParam(m, iter, &command_buffer_id) || |
| 104 !ReadParam(m, iter, &release_count)) { | 105 !ReadParam(m, iter, &release_count)) { |
| 105 return false; | 106 return false; |
| 106 } | 107 } |
| 107 | 108 |
| 108 p->Set(namespace_id, 0, command_buffer_id, release_count); | 109 p->Set(namespace_id, 0, command_buffer_id, release_count); |
| 109 if (p->HasData()) { | 110 if (p->HasData()) { |
| 110 if (!verified_flush) | 111 if (!verified_flush) |
| 111 return false; | 112 return false; |
| 112 p->SetVerifyFlush(); | 113 p->SetVerifyFlush(); |
| 113 } | 114 } |
| 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 += | 120 *l += base::StringPrintf( |
| 120 base::StringPrintf("[%d:%llX] %llu", static_cast<int>(p.namespace_id()), | 121 "[%d:%llX] %llu", static_cast<int>(p.namespace_id()), |
|
dcheng
2016/02/12 19:23:17
How about:
*l += base::StringPrintf("[%d:" PRIu64
Łukasz Anforowicz
2016/02/12 22:33:24
Done - thanks for catching this. Can you please d
| |
| 121 static_cast<unsigned long long>(p.command_buffer_id()), | 122 static_cast<unsigned long long>(p.command_buffer_id().GetUnsafeValue()), |
| 122 static_cast<unsigned long long>(p.release_count())); | 123 static_cast<unsigned long long>(p.release_count())); |
| 123 } | 124 } |
| 124 | 125 |
| 125 void ParamTraits<gpu::Mailbox>::GetSize(base::PickleSizer* s, | 126 void ParamTraits<gpu::Mailbox>::GetSize(base::PickleSizer* s, |
| 126 const param_type& p) { | 127 const param_type& p) { |
| 127 s->AddBytes(sizeof(p.name)); | 128 s->AddBytes(sizeof(p.name)); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) { | 131 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) { |
| 131 m->WriteBytes(p.name, sizeof(p.name)); | 132 m->WriteBytes(p.name, sizeof(p.name)); |
| 132 } | 133 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 l->append("<ValueState ("); | 203 l->append("<ValueState ("); |
| 203 for (int value : p.int_value) | 204 for (int value : p.int_value) |
| 204 *l += base::StringPrintf("%i ", value); | 205 *l += base::StringPrintf("%i ", value); |
| 205 l->append(" int values "); | 206 l->append(" int values "); |
| 206 for (float value : p.float_value) | 207 for (float value : p.float_value) |
| 207 *l += base::StringPrintf("%f ", value); | 208 *l += base::StringPrintf("%f ", value); |
| 208 l->append(" float values)>"); | 209 l->append(" float values)>"); |
| 209 } | 210 } |
| 210 | 211 |
| 211 } // namespace IPC | 212 } // namespace IPC |
| OLD | NEW |