Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: gpu/ipc/gpu_command_buffer_traits.cc

Issue 1548443002: Introducing gpu::CommandBufferId as a distinct, IdType<...>-based type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-save-package-id-self-contained
Patch Set: Rebasing... Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/ipc/gpu_command_buffer_traits.h ('k') | gpu/ipc/id_type_traits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 "[%" PRId8 ":%" PRIX64 "] %" PRIu64, p.namespace_id(),
121 static_cast<unsigned long long>(p.command_buffer_id()), 122 p.command_buffer_id().GetUnsafeValue(), p.release_count());
122 static_cast<unsigned long long>(p.release_count()));
123 } 123 }
124 124
125 void ParamTraits<gpu::Mailbox>::GetSize(base::PickleSizer* s, 125 void ParamTraits<gpu::Mailbox>::GetSize(base::PickleSizer* s,
126 const param_type& p) { 126 const param_type& p) {
127 s->AddBytes(sizeof(p.name)); 127 s->AddBytes(sizeof(p.name));
128 } 128 }
129 129
130 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) { 130 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) {
131 m->WriteBytes(p.name, sizeof(p.name)); 131 m->WriteBytes(p.name, sizeof(p.name));
132 } 132 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 l->append("<ValueState ("); 202 l->append("<ValueState (");
203 for (int value : p.int_value) 203 for (int value : p.int_value)
204 *l += base::StringPrintf("%i ", value); 204 *l += base::StringPrintf("%i ", value);
205 l->append(" int values "); 205 l->append(" int values ");
206 for (float value : p.float_value) 206 for (float value : p.float_value)
207 *l += base::StringPrintf("%f ", value); 207 *l += base::StringPrintf("%f ", value);
208 l->append(" float values)>"); 208 l->append(" float values)>");
209 } 209 }
210 210
211 } // namespace IPC 211 } // namespace IPC
OLDNEW
« no previous file with comments | « gpu/ipc/gpu_command_buffer_traits.h ('k') | gpu/ipc/id_type_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698