OLD | NEW |
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 "ppapi/proxy/ppb_graphics_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 attr[0] != PP_GRAPHICS3DATTRIB_NONE; | 163 attr[0] != PP_GRAPHICS3DATTRIB_NONE; |
164 attr += 2) { | 164 attr += 2) { |
165 attribs.push_back(attr[0]); | 165 attribs.push_back(attr[0]); |
166 attribs.push_back(attr[1]); | 166 attribs.push_back(attr[1]); |
167 } | 167 } |
168 } | 168 } |
169 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); | 169 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE); |
170 | 170 |
171 HostResource result; | 171 HostResource result; |
172 dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create( | 172 dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create( |
173 API_ID_PPB_GRAPHICS_3D, instance, attribs, &result)); | 173 API_ID_PPB_GRAPHICS_3D, |
| 174 instance, |
| 175 ppapi::HostResource(), |
| 176 attribs, |
| 177 &result)); |
174 if (result.is_null()) | 178 if (result.is_null()) |
175 return 0; | 179 return 0; |
176 | 180 |
177 scoped_refptr<Graphics3D> graphics_3d(new Graphics3D(result)); | 181 scoped_refptr<Graphics3D> graphics_3d(new Graphics3D(result)); |
178 if (!graphics_3d->Init()) | 182 if (!graphics_3d->Init()) |
179 return 0; | 183 return 0; |
180 return graphics_3d->GetReference(); | 184 return graphics_3d->GetReference(); |
181 } | 185 } |
182 | 186 |
183 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { | 187 bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) { |
(...skipping 23 matching lines...) Expand all Loading... |
207 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK, | 211 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK, |
208 OnMsgSwapBuffersACK) | 212 OnMsgSwapBuffersACK) |
209 IPC_MESSAGE_UNHANDLED(handled = false) | 213 IPC_MESSAGE_UNHANDLED(handled = false) |
210 | 214 |
211 IPC_END_MESSAGE_MAP() | 215 IPC_END_MESSAGE_MAP() |
212 // FIXME(brettw) handle bad messages! | 216 // FIXME(brettw) handle bad messages! |
213 return handled; | 217 return handled; |
214 } | 218 } |
215 | 219 |
216 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance, | 220 void PPB_Graphics3D_Proxy::OnMsgCreate(PP_Instance instance, |
| 221 HostResource shared_context, |
217 const std::vector<int32_t>& attribs, | 222 const std::vector<int32_t>& attribs, |
218 HostResource* result) { | 223 HostResource* result) { |
219 if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE) | 224 if (attribs.empty() || attribs.back() != PP_GRAPHICS3DATTRIB_NONE) |
220 return; // Bad message. | 225 return; // Bad message. |
221 | 226 |
222 thunk::EnterResourceCreation enter(instance); | 227 thunk::EnterResourceCreation enter(instance); |
223 if (enter.succeeded()) { | 228 if (enter.succeeded()) { |
224 result->SetHostResource( | 229 result->SetHostResource( |
225 instance, | 230 instance, |
226 enter.functions()->CreateGraphics3DRaw(instance, 0, &attribs.front())); | 231 enter.functions()->CreateGraphics3DRaw(instance, 0, &attribs.front())); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( | 333 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( |
329 int32_t result, | 334 int32_t result, |
330 const HostResource& context) { | 335 const HostResource& context) { |
331 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( | 336 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( |
332 API_ID_PPB_GRAPHICS_3D, context, result)); | 337 API_ID_PPB_GRAPHICS_3D, context, result)); |
333 } | 338 } |
334 | 339 |
335 } // namespace proxy | 340 } // namespace proxy |
336 } // namespace ppapi | 341 } // namespace ppapi |
337 | 342 |
OLD | NEW |