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 write methods. | 15 // Generate param traits write methods. |
15 #include "ipc/param_traits_write_macros.h" | 16 #include "ipc/param_traits_write_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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 WriteParam(m, p.command_buffer_id()); | 66 WriteParam(m, p.command_buffer_id()); |
66 WriteParam(m, p.release_count()); | 67 WriteParam(m, p.release_count()); |
67 } | 68 } |
68 | 69 |
69 bool ParamTraits<gpu::SyncToken>::Read(const base::Pickle* m, | 70 bool ParamTraits<gpu::SyncToken>::Read(const base::Pickle* m, |
70 base::PickleIterator* iter, | 71 base::PickleIterator* iter, |
71 param_type* p) { | 72 param_type* p) { |
72 bool verified_flush = false; | 73 bool verified_flush = false; |
73 gpu::CommandBufferNamespace namespace_id = | 74 gpu::CommandBufferNamespace namespace_id = |
74 gpu::CommandBufferNamespace::INVALID; | 75 gpu::CommandBufferNamespace::INVALID; |
75 uint64_t command_buffer_id = 0; | 76 gpu::CommandBufferId command_buffer_id; |
76 uint64_t release_count = 0; | 77 uint64_t release_count = 0; |
77 | 78 |
78 if (!ReadParam(m, iter, &verified_flush) || | 79 if (!ReadParam(m, iter, &verified_flush) || |
79 !ReadParam(m, iter, &namespace_id) || | 80 !ReadParam(m, iter, &namespace_id) || |
80 !ReadParam(m, iter, &command_buffer_id) || | 81 !ReadParam(m, iter, &command_buffer_id) || |
81 !ReadParam(m, iter, &release_count)) { | 82 !ReadParam(m, iter, &release_count)) { |
82 return false; | 83 return false; |
83 } | 84 } |
84 | 85 |
85 p->Set(namespace_id, 0, command_buffer_id, release_count); | 86 p->Set(namespace_id, 0, command_buffer_id, release_count); |
86 if (p->HasData()) { | 87 if (p->HasData()) { |
87 if (!verified_flush) | 88 if (!verified_flush) |
88 return false; | 89 return false; |
89 p->SetVerifyFlush(); | 90 p->SetVerifyFlush(); |
90 } | 91 } |
91 | 92 |
92 return true; | 93 return true; |
93 } | 94 } |
94 | 95 |
95 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { | 96 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { |
96 *l += | 97 *l += base::StringPrintf( |
97 base::StringPrintf("[%d:%llX] %llu", static_cast<int>(p.namespace_id()), | 98 "[%d:%llX] %llu", static_cast<int>(p.namespace_id()), |
98 static_cast<unsigned long long>(p.command_buffer_id()), | 99 static_cast<unsigned long long>(p.command_buffer_id().GetUnsafeValue()), |
99 static_cast<unsigned long long>(p.release_count())); | 100 static_cast<unsigned long long>(p.release_count())); |
100 } | 101 } |
101 | 102 |
102 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) { | 103 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) { |
103 m->WriteBytes(p.name, sizeof(p.name)); | 104 m->WriteBytes(p.name, sizeof(p.name)); |
104 } | 105 } |
105 | 106 |
106 bool ParamTraits<gpu::Mailbox>::Read(const base::Pickle* m, | 107 bool ParamTraits<gpu::Mailbox>::Read(const base::Pickle* m, |
107 base::PickleIterator* iter, | 108 base::PickleIterator* iter, |
108 param_type* p) { | 109 param_type* p) { |
109 const char* bytes = NULL; | 110 const char* bytes = NULL; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 l->append("<ValueState ("); | 163 l->append("<ValueState ("); |
163 for (int value : p.int_value) | 164 for (int value : p.int_value) |
164 *l += base::StringPrintf("%i ", value); | 165 *l += base::StringPrintf("%i ", value); |
165 l->append(" int values "); | 166 l->append(" int values "); |
166 for (float value : p.float_value) | 167 for (float value : p.float_value) |
167 *l += base::StringPrintf("%f ", value); | 168 *l += base::StringPrintf("%f ", value); |
168 l->append(" float values)>"); | 169 l->append(" float values)>"); |
169 } | 170 } |
170 | 171 |
171 } // namespace IPC | 172 } // namespace IPC |
OLD | NEW |