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 "gpu/command_buffer/common/mailbox_holder.h" | 7 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 8 #include "gpu/command_buffer/common/sync_token.h" | 8 #include "gpu/command_buffer/common/sync_token.h" |
| 9 #include "gpu/command_buffer/common/value_state.h" | 9 #include "gpu/command_buffer/common/value_state.h" |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, | 52 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, |
| 53 std::string* l) { | 53 std::string* l) { |
| 54 l->append("<CommandBuffer::State>"); | 54 l->append("<CommandBuffer::State>"); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void ParamTraits<gpu::SyncToken>::Write(Message* m, const param_type& p) { | 57 void ParamTraits<gpu::SyncToken>::Write(Message* m, const param_type& p) { |
| 58 DCHECK(!p.HasData() || p.verified_flush()); | 58 DCHECK(!p.HasData() || p.verified_flush()); |
| 59 | 59 |
| 60 WriteParam(m, p.verified_flush()); | 60 WriteParam(m, p.verified_flush()); |
| 61 WriteParam(m, p.namespace_id()); | 61 WriteParam(m, p.namespace_id()); |
| 62 WriteParam(m, p.extra_data_field()); | |
| 62 WriteParam(m, p.command_buffer_id()); | 63 WriteParam(m, p.command_buffer_id()); |
| 63 WriteParam(m, p.release_count()); | 64 WriteParam(m, p.release_count()); |
| 64 } | 65 } |
| 65 | 66 |
| 66 bool ParamTraits<gpu::SyncToken>::Read(const Message* m, | 67 bool ParamTraits<gpu::SyncToken>::Read(const Message* m, |
| 67 base::PickleIterator* iter, | 68 base::PickleIterator* iter, |
| 68 param_type* p) { | 69 param_type* p) { |
| 69 bool verified_flush = false; | 70 bool verified_flush = false; |
| 70 gpu::CommandBufferNamespace namespace_id = | 71 gpu::CommandBufferNamespace namespace_id = |
| 71 gpu::CommandBufferNamespace::INVALID; | 72 gpu::CommandBufferNamespace::INVALID; |
| 73 uint32_t extra_data_field = 0; | |
| 72 uint64_t command_buffer_id = 0; | 74 uint64_t command_buffer_id = 0; |
| 73 uint64_t release_count = 0; | 75 uint64_t release_count = 0; |
| 74 | 76 |
| 75 if (!ReadParam(m, iter, &verified_flush) || | 77 if (!ReadParam(m, iter, &verified_flush) || |
| 76 !ReadParam(m, iter, &namespace_id) || | 78 !ReadParam(m, iter, &namespace_id) || |
| 79 !ReadParam(m, iter, &extra_data_field) || | |
|
piman
2015/11/30 20:59:23
Actually, I have a security concern: the rest of t
David Yen
2015/11/30 22:45:06
Since I have created this variable as a "generic s
| |
| 77 !ReadParam(m, iter, &command_buffer_id) || | 80 !ReadParam(m, iter, &command_buffer_id) || |
| 78 !ReadParam(m, iter, &release_count)) { | 81 !ReadParam(m, iter, &release_count)) { |
| 79 return false; | 82 return false; |
| 80 } | 83 } |
| 81 | 84 |
| 82 p->Set(namespace_id, command_buffer_id, release_count); | 85 p->Set(namespace_id, extra_data_field, command_buffer_id, release_count); |
| 83 if (p->HasData()) { | 86 if (p->HasData()) { |
| 84 if (!verified_flush) | 87 if (!verified_flush) |
| 85 return false; | 88 return false; |
| 86 p->SetVerifyFlush(); | 89 p->SetVerifyFlush(); |
| 87 } | 90 } |
| 88 | 91 |
| 89 return true; | 92 return true; |
| 90 } | 93 } |
| 91 | 94 |
| 92 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { | 95 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { |
| 93 *l += | 96 *l += |
| 94 base::StringPrintf("[%d:%llX] %llu", static_cast<int>(p.namespace_id()), | 97 base::StringPrintf("[%d:%llX:%u] %llu", |
| 98 static_cast<int>(p.namespace_id()), | |
| 95 static_cast<unsigned long long>(p.command_buffer_id()), | 99 static_cast<unsigned long long>(p.command_buffer_id()), |
| 100 p.extra_data_field(), | |
| 96 static_cast<unsigned long long>(p.release_count())); | 101 static_cast<unsigned long long>(p.release_count())); |
| 97 } | 102 } |
| 98 | 103 |
| 99 void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) { | 104 void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) { |
| 100 m->WriteBytes(p.name, sizeof(p.name)); | 105 m->WriteBytes(p.name, sizeof(p.name)); |
| 101 } | 106 } |
| 102 | 107 |
| 103 bool ParamTraits<gpu::Mailbox> ::Read(const Message* m, | 108 bool ParamTraits<gpu::Mailbox> ::Read(const Message* m, |
| 104 base::PickleIterator* iter, | 109 base::PickleIterator* iter, |
| 105 param_type* p) { | 110 param_type* p) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 l->append("<ValueState ("); | 163 l->append("<ValueState ("); |
| 159 for (int value : p.int_value) | 164 for (int value : p.int_value) |
| 160 *l += base::StringPrintf("%i ", value); | 165 *l += base::StringPrintf("%i ", value); |
| 161 l->append(" int values "); | 166 l->append(" int values "); |
| 162 for (float value : p.float_value) | 167 for (float value : p.float_value) |
| 163 *l += base::StringPrintf("%f ", value); | 168 *l += base::StringPrintf("%f ", value); |
| 164 l->append(" float values)>"); | 169 l->append(" float values)>"); |
| 165 } | 170 } |
| 166 | 171 |
| 167 } // namespace IPC | 172 } // namespace IPC |
| OLD | NEW |