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 #ifndef CHROME_COMMON_GPU_MESSAGES_H_ | 5 #ifndef CHROME_COMMON_GPU_MESSAGES_H_ |
6 #define CHROME_COMMON_GPU_MESSAGES_H_ | 6 #define CHROME_COMMON_GPU_MESSAGES_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
11 #include "chrome/common/common_param_traits.h" | 11 #include "chrome/common/common_param_traits.h" |
12 #include "chrome/common/gpu_info.h" | |
13 #include "chrome/common/gpu_native_window_handle.h" | 12 #include "chrome/common/gpu_native_window_handle.h" |
14 #include "gfx/native_widget_types.h" | 13 #include "gfx/native_widget_types.h" |
15 #include "gfx/rect.h" | |
16 #include "gfx/size.h" | |
17 #include "gpu/command_buffer/common/command_buffer.h" | 14 #include "gpu/command_buffer/common/command_buffer.h" |
18 | 15 |
| 16 class GPUInfo; |
| 17 |
19 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
20 // Parameters for the GpuHostMsg_AcceleratedSurfaceSetIOSurface | 19 // Parameters for the GpuHostMsg_AcceleratedSurfaceSetIOSurface |
21 // message, which has too many parameters to be sent with the | 20 // message, which has too many parameters to be sent with the |
22 // predefined IPC macros. | 21 // predefined IPC macros. |
23 struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params { | 22 struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params { |
24 int32 renderer_id; | 23 int32 renderer_id; |
25 int32 render_view_id; | 24 int32 render_view_id; |
26 gfx::PluginWindowHandle window; | 25 gfx::PluginWindowHandle window; |
27 int32 width; | 26 int32 width; |
28 int32 height; | 27 int32 height; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 l->append(", "); | 73 l->append(", "); |
75 LogParam(p.identifier, l); | 74 LogParam(p.identifier, l); |
76 l->append(")"); | 75 l->append(")"); |
77 } | 76 } |
78 }; | 77 }; |
79 #endif | 78 #endif |
80 | 79 |
81 template <> | 80 template <> |
82 struct ParamTraits<GPUInfo> { | 81 struct ParamTraits<GPUInfo> { |
83 typedef GPUInfo param_type; | 82 typedef GPUInfo param_type; |
84 static void Write(Message* m, const param_type& p) { | 83 static void Write(Message* m, const param_type& p); |
85 m->WriteUInt32(p.vendor_id()); | 84 static bool Read(const Message* m, void** iter, param_type* p); |
86 m->WriteUInt32(p.device_id()); | 85 static void Log(const param_type& p, std::string* l); |
87 m->WriteWString(p.driver_version()); | |
88 m->WriteUInt32(p.pixel_shader_version()); | |
89 m->WriteUInt32(p.vertex_shader_version()); | |
90 m->WriteUInt32(p.gl_version()); | |
91 } | |
92 static bool Read(const Message* m, void** iter, param_type* p) { | |
93 uint32 vendor_id; | |
94 uint32 device_id; | |
95 std::wstring driver_version; | |
96 uint32 pixel_shader_version; | |
97 uint32 vertex_shader_version; | |
98 uint32 gl_version; | |
99 bool ret = m->ReadUInt32(iter, &vendor_id); | |
100 ret = ret && m->ReadUInt32(iter, &device_id); | |
101 ret = ret && m->ReadWString(iter, &driver_version); | |
102 ret = ret && m->ReadUInt32(iter, &pixel_shader_version); | |
103 ret = ret && m->ReadUInt32(iter, &vertex_shader_version); | |
104 ret = ret && m->ReadUInt32(iter, &gl_version); | |
105 p->SetGraphicsInfo(vendor_id, device_id, driver_version, | |
106 pixel_shader_version, vertex_shader_version, | |
107 gl_version); | |
108 return ret; | |
109 } | |
110 static void Log(const param_type& p, std::string* l) { | |
111 l->append(StringPrintf("<GPUInfo> %x %x %ls", | |
112 p.vendor_id(), p.device_id(), p.driver_version().c_str())); | |
113 } | |
114 }; | 86 }; |
115 | 87 |
116 template <> | 88 template <> |
117 struct ParamTraits<gpu::CommandBuffer::State> { | 89 struct ParamTraits<gpu::CommandBuffer::State> { |
118 typedef gpu::CommandBuffer::State param_type; | 90 typedef gpu::CommandBuffer::State param_type; |
119 static void Write(Message* m, const param_type& p) { | 91 static void Write(Message* m, const param_type& p) { |
120 m->WriteInt(p.num_entries); | 92 m->WriteInt(p.num_entries); |
121 m->WriteInt(p.get_offset); | 93 m->WriteInt(p.get_offset); |
122 m->WriteInt(p.put_offset); | 94 m->WriteInt(p.put_offset); |
123 m->WriteInt(p.token); | 95 m->WriteInt(p.token); |
(...skipping 16 matching lines...) Expand all Loading... |
140 l->append("<CommandBuffer::State>"); | 112 l->append("<CommandBuffer::State>"); |
141 } | 113 } |
142 }; | 114 }; |
143 } // namespace IPC | 115 } // namespace IPC |
144 | 116 |
145 #define MESSAGES_INTERNAL_FILE \ | 117 #define MESSAGES_INTERNAL_FILE \ |
146 "chrome/common/gpu_messages_internal.h" | 118 "chrome/common/gpu_messages_internal.h" |
147 #include "ipc/ipc_message_macros.h" | 119 #include "ipc/ipc_message_macros.h" |
148 | 120 |
149 #endif // CHROME_COMMON_GPU_MESSAGES_H_ | 121 #endif // CHROME_COMMON_GPU_MESSAGES_H_ |
OLD | NEW |