OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_surface_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_surface_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/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/c/dev/ppb_surface_3d_dev.h" | 10 #include "ppapi/c/dev/ppb_surface_3d_dev.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 IPC::Message* msg = new PpapiHostMsg_PPBSurface3D_SwapBuffers( | 91 IPC::Message* msg = new PpapiHostMsg_PPBSurface3D_SwapBuffers( |
92 INTERFACE_ID_PPB_SURFACE_3D, object->host_resource()); | 92 INTERFACE_ID_PPB_SURFACE_3D, object->host_resource()); |
93 msg->set_unblock(true); | 93 msg->set_unblock(true); |
94 dispatcher->Send(msg); | 94 dispatcher->Send(msg); |
95 | 95 |
96 object->context()->gles2_impl()->SwapBuffers(); | 96 object->context()->gles2_impl()->SwapBuffers(); |
97 | 97 |
98 return PP_ERROR_WOULDBLOCK; | 98 return PP_ERROR_WOULDBLOCK; |
99 } | 99 } |
100 | 100 |
101 const PPB_Surface3D_Dev ppb_surface_3d = { | 101 const PPB_Surface3D_Dev surface_3d_interface = { |
102 &Create, | 102 &Create, |
103 &IsSurface3D, | 103 &IsSurface3D, |
104 &SetAttrib, | 104 &SetAttrib, |
105 &GetAttrib, | 105 &GetAttrib, |
106 &SwapBuffers | 106 &SwapBuffers |
107 }; | 107 }; |
108 | 108 |
| 109 InterfaceProxy* CreateSurface3DProxy(Dispatcher* dispatcher, |
| 110 const void* target_interface) { |
| 111 return new PPB_Surface3D_Proxy(dispatcher, target_interface); |
| 112 } |
| 113 |
109 } // namespace | 114 } // namespace |
110 | 115 |
111 PPB_Surface3D_Proxy::PPB_Surface3D_Proxy(Dispatcher* dispatcher, | 116 PPB_Surface3D_Proxy::PPB_Surface3D_Proxy(Dispatcher* dispatcher, |
112 const void* target_interface) | 117 const void* target_interface) |
113 : InterfaceProxy(dispatcher, target_interface), | 118 : InterfaceProxy(dispatcher, target_interface), |
114 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 119 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
115 } | 120 } |
116 | 121 |
117 PPB_Surface3D_Proxy::~PPB_Surface3D_Proxy() { | 122 PPB_Surface3D_Proxy::~PPB_Surface3D_Proxy() { |
118 } | 123 } |
119 | 124 |
120 const void* PPB_Surface3D_Proxy::GetSourceInterface() const { | 125 // static |
121 return &ppb_surface_3d; | 126 const InterfaceProxy::Info* PPB_Surface3D_Proxy::GetInfo() { |
122 } | 127 static const Info info = { |
123 | 128 &surface_3d_interface, |
124 InterfaceID PPB_Surface3D_Proxy::GetInterfaceId() const { | 129 PPB_SURFACE_3D_DEV_INTERFACE, |
125 return INTERFACE_ID_PPB_SURFACE_3D; | 130 INTERFACE_ID_PPB_SURFACE_3D, |
| 131 false, |
| 132 &CreateSurface3DProxy, |
| 133 }; |
| 134 return &info; |
126 } | 135 } |
127 | 136 |
128 bool PPB_Surface3D_Proxy::OnMessageReceived(const IPC::Message& msg) { | 137 bool PPB_Surface3D_Proxy::OnMessageReceived(const IPC::Message& msg) { |
129 bool handled = true; | 138 bool handled = true; |
130 IPC_BEGIN_MESSAGE_MAP(PPB_Surface3D_Proxy, msg) | 139 IPC_BEGIN_MESSAGE_MAP(PPB_Surface3D_Proxy, msg) |
131 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBSurface3D_Create, | 140 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBSurface3D_Create, |
132 OnMsgCreate) | 141 OnMsgCreate) |
133 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBSurface3D_SwapBuffers, | 142 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBSurface3D_SwapBuffers, |
134 OnMsgSwapBuffers) | 143 OnMsgSwapBuffers) |
135 | 144 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 196 |
188 void PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin( | 197 void PPB_Surface3D_Proxy::SendSwapBuffersACKToPlugin( |
189 int32_t result, | 198 int32_t result, |
190 const HostResource& surface_3d) { | 199 const HostResource& surface_3d) { |
191 dispatcher()->Send(new PpapiMsg_PPBSurface3D_SwapBuffersACK( | 200 dispatcher()->Send(new PpapiMsg_PPBSurface3D_SwapBuffersACK( |
192 INTERFACE_ID_PPB_SURFACE_3D, surface_3d, result)); | 201 INTERFACE_ID_PPB_SURFACE_3D, surface_3d, result)); |
193 } | 202 } |
194 | 203 |
195 } // namespace proxy | 204 } // namespace proxy |
196 } // namespace pp | 205 } // namespace pp |
OLD | NEW |