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" | |
9 #include "gpu/command_buffer/common/value_state.h" | 8 #include "gpu/command_buffer/common/value_state.h" |
10 | 9 |
11 // Generate param traits write methods. | 10 // Generate param traits write methods. |
12 #include "ipc/param_traits_write_macros.h" | 11 #include "ipc/param_traits_write_macros.h" |
13 namespace IPC { | 12 namespace IPC { |
14 #include "gpu/ipc/gpu_command_buffer_traits_multi.h" | 13 #include "gpu/ipc/gpu_command_buffer_traits_multi.h" |
15 } // namespace IPC | 14 } // namespace IPC |
16 | 15 |
17 // Generate param traits read methods. | 16 // Generate param traits read methods. |
18 #include "ipc/param_traits_read_macros.h" | 17 #include "ipc/param_traits_read_macros.h" |
(...skipping 30 matching lines...) Expand all Loading... |
49 } else { | 48 } else { |
50 return false; | 49 return false; |
51 } | 50 } |
52 } | 51 } |
53 | 52 |
54 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, | 53 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, |
55 std::string* l) { | 54 std::string* l) { |
56 l->append("<CommandBuffer::State>"); | 55 l->append("<CommandBuffer::State>"); |
57 } | 56 } |
58 | 57 |
59 void ParamTraits<gpu::SyncToken>::Write(Message* m, const param_type& p) { | |
60 m->WriteBytes(p.data, sizeof(p.data)); | |
61 } | |
62 | |
63 bool ParamTraits<gpu::SyncToken> ::Read(const Message* m, | |
64 base::PickleIterator* iter, | |
65 param_type* p) { | |
66 const char* bytes = NULL; | |
67 if (!iter->ReadBytes(&bytes, sizeof(p->data))) | |
68 return false; | |
69 DCHECK(bytes); | |
70 memcpy(p->data, bytes, sizeof(p->data)); | |
71 return true; | |
72 } | |
73 | |
74 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { | |
75 *l += base::StringPrintf( | |
76 "[%d:%llX] %llu", | |
77 static_cast<int>(p.GetNamespaceId()), | |
78 static_cast<unsigned long long>(p.GetCommandBufferId()), | |
79 static_cast<unsigned long long>(p.GetReleaseCount())); | |
80 } | |
81 | |
82 void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) { | 58 void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) { |
83 m->WriteBytes(p.name, sizeof(p.name)); | 59 m->WriteBytes(p.name, sizeof(p.name)); |
84 } | 60 } |
85 | 61 |
86 bool ParamTraits<gpu::Mailbox> ::Read(const Message* m, | 62 bool ParamTraits<gpu::Mailbox> ::Read(const Message* m, |
87 base::PickleIterator* iter, | 63 base::PickleIterator* iter, |
88 param_type* p) { | 64 param_type* p) { |
89 const char* bytes = NULL; | 65 const char* bytes = NULL; |
90 if (!iter->ReadBytes(&bytes, sizeof(p->name))) | 66 if (!iter->ReadBytes(&bytes, sizeof(p->name))) |
91 return false; | 67 return false; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 l->append("<ValueState ("); | 117 l->append("<ValueState ("); |
142 for (size_t i = 0; i < sizeof(p.int_value); ++i) | 118 for (size_t i = 0; i < sizeof(p.int_value); ++i) |
143 *l += base::StringPrintf("%i ", p.int_value[i]); | 119 *l += base::StringPrintf("%i ", p.int_value[i]); |
144 l->append(" int values "); | 120 l->append(" int values "); |
145 for (size_t i = 0; i < sizeof(p.float_value); ++i) | 121 for (size_t i = 0; i < sizeof(p.float_value); ++i) |
146 *l += base::StringPrintf("%f ", p.float_value[i]); | 122 *l += base::StringPrintf("%f ", p.float_value[i]); |
147 l->append(" float values)>"); | 123 l->append(" float values)>"); |
148 } | 124 } |
149 | 125 |
150 } // namespace IPC | 126 } // namespace IPC |
OLD | NEW |