OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/gpu_messages.h" | 5 #include "chrome/common/gpu_messages.h" |
6 | 6 |
| 7 #include "chrome/common/gpu_info.h" |
| 8 #include "gfx/rect.h" |
| 9 #include "gfx/size.h" |
| 10 #include "ipc/ipc_channel_handle.h" |
| 11 |
7 #define MESSAGES_INTERNAL_IMPL_FILE \ | 12 #define MESSAGES_INTERNAL_IMPL_FILE \ |
8 "chrome/common/gpu_messages_internal.h" | 13 "chrome/common/gpu_messages_internal.h" |
9 #include "ipc/ipc_message_impl_macros.h" | 14 #include "ipc/ipc_message_impl_macros.h" |
| 15 |
| 16 namespace IPC { |
| 17 |
| 18 void ParamTraits<GPUInfo>::Write(Message* m, const param_type& p) { |
| 19 m->WriteUInt32(p.vendor_id()); |
| 20 m->WriteUInt32(p.device_id()); |
| 21 m->WriteWString(p.driver_version()); |
| 22 m->WriteUInt32(p.pixel_shader_version()); |
| 23 m->WriteUInt32(p.vertex_shader_version()); |
| 24 m->WriteUInt32(p.gl_version()); |
| 25 } |
| 26 |
| 27 bool ParamTraits<GPUInfo>::Read(const Message* m, void** iter, param_type* p) { |
| 28 uint32 vendor_id; |
| 29 uint32 device_id; |
| 30 std::wstring driver_version; |
| 31 uint32 pixel_shader_version; |
| 32 uint32 vertex_shader_version; |
| 33 uint32 gl_version; |
| 34 bool ret = m->ReadUInt32(iter, &vendor_id); |
| 35 ret = ret && m->ReadUInt32(iter, &device_id); |
| 36 ret = ret && m->ReadWString(iter, &driver_version); |
| 37 ret = ret && m->ReadUInt32(iter, &pixel_shader_version); |
| 38 ret = ret && m->ReadUInt32(iter, &vertex_shader_version); |
| 39 ret = ret && m->ReadUInt32(iter, &gl_version); |
| 40 p->SetGraphicsInfo(vendor_id, device_id, driver_version, |
| 41 pixel_shader_version, vertex_shader_version, |
| 42 gl_version); |
| 43 return ret; |
| 44 } |
| 45 |
| 46 void ParamTraits<GPUInfo>::Log(const param_type& p, std::string* l) { |
| 47 l->append(StringPrintf("<GPUInfo> %x %x %ls", |
| 48 p.vendor_id(), |
| 49 p.device_id(), |
| 50 p.driver_version().c_str())); |
| 51 } |
| 52 |
| 53 } // namespace IPC |
OLD | NEW |