cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / gpu / ipc / gpu_command_buffer_traits.cc
blobd9fc17d166070026a45c915f5a68b5b6ff5227c2
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
3 // found in the LICENSE file.
5 #include "gpu/ipc/gpu_command_buffer_traits.h"
6 #include "gpu/command_buffer/common/mailbox.h"
8 namespace IPC {
10 void ParamTraits<gpu::CommandBuffer::State> ::Write(Message* m,
11 const param_type& p) {
12 WriteParam(m, p.num_entries);
13 WriteParam(m, p.get_offset);
14 WriteParam(m, p.put_offset);
15 WriteParam(m, p.token);
16 WriteParam(m, static_cast<int32>(p.error));
17 WriteParam(m, p.generation);
20 bool ParamTraits<gpu::CommandBuffer::State> ::Read(const Message* m,
21 PickleIterator* iter,
22 param_type* p) {
23 int32 temp;
24 if (ReadParam(m, iter, &p->num_entries) &&
25 ReadParam(m, iter, &p->get_offset) &&
26 ReadParam(m, iter, &p->put_offset) &&
27 ReadParam(m, iter, &p->token) &&
28 ReadParam(m, iter, &temp) &&
29 ReadParam(m, iter, &p->generation)) {
30 p->error = static_cast<gpu::error::Error>(temp);
31 return true;
32 } else {
33 return false;
37 void ParamTraits<gpu::CommandBuffer::State> ::Log(const param_type& p,
38 std::string* l) {
39 l->append("<CommandBuffer::State>");
42 void ParamTraits<gpu::Mailbox>::Write(Message* m, const param_type& p) {
43 m->WriteBytes(p.name, sizeof(p.name));
46 bool ParamTraits<gpu::Mailbox>::Read(const Message* m,
47 PickleIterator* iter,
48 param_type* p) {
49 const char* bytes = NULL;
50 if (!m->ReadBytes(iter, &bytes, sizeof(p->name)))
51 return false;
52 DCHECK(bytes);
53 memcpy(p->name, bytes, sizeof(p->name));
54 return true;
57 void ParamTraits<gpu::Mailbox>::Log(const param_type& p, std::string* l) {
58 for (size_t i = 0; i < sizeof(p.name); ++i)
59 *l += base::StringPrintf("%02x", p.name[i]);
63 } // namespace IPC