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

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

Issue 1394543003: Added SyncToken command buffer trait to help with IPC messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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 "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/value_state.h" 9 #include "gpu/command_buffer/common/value_state.h"
9 10
10 // Generate param traits write methods. 11 // Generate param traits write methods.
11 #include "ipc/param_traits_write_macros.h" 12 #include "ipc/param_traits_write_macros.h"
12 namespace IPC { 13 namespace IPC {
13 #include "gpu/ipc/gpu_command_buffer_traits_multi.h" 14 #include "gpu/ipc/gpu_command_buffer_traits_multi.h"
14 } // namespace IPC 15 } // namespace IPC
15 16
16 // Generate param traits read methods. 17 // Generate param traits read methods.
17 #include "ipc/param_traits_read_macros.h" 18 #include "ipc/param_traits_read_macros.h"
(...skipping 30 matching lines...) Expand all
48 } else { 49 } else {
49 return false; 50 return false;
50 } 51 }
51 } 52 }
52 53
53 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p, 54 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p,
54 std::string* l) { 55 std::string* l) {
55 l->append("<CommandBuffer::State>"); 56 l->append("<CommandBuffer::State>");
56 } 57 }
57 58
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
58 void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) { 82 void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) {
59 m->WriteBytes(p.name, sizeof(p.name)); 83 m->WriteBytes(p.name, sizeof(p.name));
60 } 84 }
61 85
62 bool ParamTraits<gpu::Mailbox> ::Read(const Message* m, 86 bool ParamTraits<gpu::Mailbox> ::Read(const Message* m,
63 base::PickleIterator* iter, 87 base::PickleIterator* iter,
64 param_type* p) { 88 param_type* p) {
65 const char* bytes = NULL; 89 const char* bytes = NULL;
66 if (!iter->ReadBytes(&bytes, sizeof(p->name))) 90 if (!iter->ReadBytes(&bytes, sizeof(p->name)))
67 return false; 91 return false;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 l->append("<ValueState ("); 141 l->append("<ValueState (");
118 for (size_t i = 0; i < sizeof(p.int_value); ++i) 142 for (size_t i = 0; i < sizeof(p.int_value); ++i)
119 *l += base::StringPrintf("%i ", p.int_value[i]); 143 *l += base::StringPrintf("%i ", p.int_value[i]);
120 l->append(" int values "); 144 l->append(" int values ");
121 for (size_t i = 0; i < sizeof(p.float_value); ++i) 145 for (size_t i = 0; i < sizeof(p.float_value); ++i)
122 *l += base::StringPrintf("%f ", p.float_value[i]); 146 *l += base::StringPrintf("%f ", p.float_value[i]);
123 l->append(" float values)>"); 147 l->append(" float values)>");
124 } 148 }
125 149
126 } // namespace IPC 150 } // namespace IPC
OLDNEW
« gpu/command_buffer/common/sync_token.cc ('K') | « gpu/ipc/gpu_command_buffer_traits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698