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

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

Issue 2473973002: NOT for review (for discussion): Query IOSurfaceIsInUse in the browser process
Patch Set: Created 4 years, 1 month 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/common/gpu_command_buffer_traits.h" 5 #include "gpu/ipc/common/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/command_buffer_id.h"
11 #include "gpu/command_buffer/common/mailbox_holder.h" 11 #include "gpu/command_buffer/common/mailbox_holder.h"
12 #include "gpu/command_buffer/common/sync_token.h" 12 #include "gpu/command_buffer/common/sync_token.h"
13 #include "gpu/command_buffer/common/texture_in_use_response.h" 13 #include "gpu/command_buffer/common/texture_in_use_response.h"
14 #include "ui/gfx/ipc/gfx_param_traits.h"
14 15
15 // Generate param traits size methods. 16 // Generate param traits size methods.
16 #include "ipc/param_traits_size_macros.h" 17 #include "ipc/param_traits_size_macros.h"
17 namespace IPC { 18 namespace IPC {
18 #include "gpu/ipc/common/gpu_command_buffer_traits_multi.h" 19 #include "gpu/ipc/common/gpu_command_buffer_traits_multi.h"
19 } // namespace IPC 20 } // namespace IPC
20 21
21 // Generate param traits write methods. 22 // Generate param traits write methods.
22 #include "ipc/param_traits_write_macros.h" 23 #include "ipc/param_traits_write_macros.h"
23 namespace IPC { 24 namespace IPC {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) { 120 void ParamTraits<gpu::SyncToken>::Log(const param_type& p, std::string* l) {
120 *l += base::StringPrintf( 121 *l += base::StringPrintf(
121 "[%" PRId8 ":%" PRIX64 "] %" PRIu64, p.namespace_id(), 122 "[%" PRId8 ":%" PRIX64 "] %" PRIu64, p.namespace_id(),
122 p.command_buffer_id().GetUnsafeValue(), p.release_count()); 123 p.command_buffer_id().GetUnsafeValue(), p.release_count());
123 } 124 }
124 125
125 void ParamTraits<gpu::TextureInUseResponse>::GetSize(base::PickleSizer* s, 126 void ParamTraits<gpu::TextureInUseResponse>::GetSize(base::PickleSizer* s,
126 const param_type& p) { 127 const param_type& p) {
127 GetParamSize(s, p.texture); 128 GetParamSize(s, p.texture);
128 GetParamSize(s, p.in_use); 129 GetParamSize(s, p.gpu_memory_buffer_handle);
130 GetParamSize(s, p.in_use_valid);
129 } 131 }
130 132
131 void ParamTraits<gpu::TextureInUseResponse>::Write(base::Pickle* m, 133 void ParamTraits<gpu::TextureInUseResponse>::Write(base::Pickle* m,
132 const param_type& p) { 134 const param_type& p) {
133 WriteParam(m, p.texture); 135 WriteParam(m, p.texture);
134 WriteParam(m, p.in_use); 136 WriteParam(m, p.gpu_memory_buffer_handle);
137 WriteParam(m, p.in_use_valid);
135 } 138 }
136 139
137 bool ParamTraits<gpu::TextureInUseResponse>::Read(const base::Pickle* m, 140 bool ParamTraits<gpu::TextureInUseResponse>::Read(const base::Pickle* m,
138 base::PickleIterator* iter, 141 base::PickleIterator* iter,
139 param_type* p) { 142 param_type* p) {
140 uint32_t texture = 0; 143 uint32_t texture = 0;
141 bool in_use = false; 144 gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle;
145 bool in_use_valid = false;
142 146
143 if (!ReadParam(m, iter, &texture) || !ReadParam(m, iter, &in_use)) { 147 if (!ReadParam(m, iter, &texture) ||
148 !ReadParam(m, iter, &gpu_memory_buffer_handle) ||
149 !ReadParam(m, iter, &in_use_valid)) {
144 return false; 150 return false;
145 } 151 }
146 152
147 p->texture = texture; 153 p->texture = texture;
148 p->in_use = in_use; 154 p->gpu_memory_buffer_handle = gpu_memory_buffer_handle;
155 p->in_use_valid = in_use_valid;
149 return true; 156 return true;
150 } 157 }
151 158
152 void ParamTraits<gpu::TextureInUseResponse>::Log(const param_type& p, 159 void ParamTraits<gpu::TextureInUseResponse>::Log(const param_type& p,
153 std::string* l) { 160 std::string* l) {
154 *l += base::StringPrintf("[%u: %d]", p.texture, static_cast<int>(p.in_use)); 161 *l += base::StringPrintf("[%u: %d]", p.texture,
162 static_cast<int>(p.in_use_valid));
155 } 163 }
156 164
157 void ParamTraits<gpu::Mailbox>::GetSize(base::PickleSizer* s, 165 void ParamTraits<gpu::Mailbox>::GetSize(base::PickleSizer* s,
158 const param_type& p) { 166 const param_type& p) {
159 s->AddBytes(sizeof(p.name)); 167 s->AddBytes(sizeof(p.name));
160 } 168 }
161 169
162 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) { 170 void ParamTraits<gpu::Mailbox>::Write(base::Pickle* m, const param_type& p) {
163 m->WriteBytes(p.name, sizeof(p.name)); 171 m->WriteBytes(p.name, sizeof(p.name));
164 } 172 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return true; 210 return true;
203 } 211 }
204 212
205 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) { 213 void ParamTraits<gpu::MailboxHolder>::Log(const param_type& p, std::string* l) {
206 LogParam(p.mailbox, l); 214 LogParam(p.mailbox, l);
207 LogParam(p.sync_token, l); 215 LogParam(p.sync_token, l);
208 *l += base::StringPrintf(":%04x@", p.texture_target); 216 *l += base::StringPrintf(":%04x@", p.texture_target);
209 } 217 }
210 218
211 } // namespace IPC 219 } // namespace IPC
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_io_surface.cc ('k') | gpu/ipc/service/image_transport_surface_overlay_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698