blob: b2cd6e5fa83c46972901c050a479cf86e18e67c3 [file] [log] [blame]
[email protected]aaa11b32012-03-08 12:30:131// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]eeb4e4a2011-07-19 16:22:062// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ppapi/proxy/ppb_graphics_3d_proxy.h"
6
brettw669d47b12015-02-13 21:17:387#include "base/numerics/safe_conversions.h"
avie029c4132015-12-23 06:45:228#include "build/build_config.h"
[email protected]eeb4e4a2011-07-19 16:22:069#include "gpu/command_buffer/client/gles2_implementation.h"
[email protected]84b44c552012-10-15 20:58:1710#include "gpu/command_buffer/common/command_buffer.h"
dyenddfdbbb2016-01-14 22:21:3811#include "gpu/command_buffer/common/sync_token.h"
[email protected]eeb4e4a2011-07-19 16:22:0612#include "ppapi/c/pp_errors.h"
13#include "ppapi/proxy/enter_proxy.h"
14#include "ppapi/proxy/plugin_dispatcher.h"
[email protected]aaa11b32012-03-08 12:30:1315#include "ppapi/proxy/ppapi_command_buffer_proxy.h"
[email protected]eeb4e4a2011-07-19 16:22:0616#include "ppapi/proxy/ppapi_messages.h"
[email protected]84b44c552012-10-15 20:58:1717#include "ppapi/shared_impl/ppapi_globals.h"
[email protected]eeb4e4a2011-07-19 16:22:0618#include "ppapi/thunk/enter.h"
19#include "ppapi/thunk/resource_creation_api.h"
20#include "ppapi/thunk/thunk.h"
21
[email protected]eeb4e4a2011-07-19 16:22:0622using ppapi::thunk::EnterResourceNoLock;
23using ppapi::thunk::PPB_Graphics3D_API;
24using ppapi::thunk::ResourceCreationAPI;
25
[email protected]4d2efd22011-08-18 21:58:0226namespace ppapi {
[email protected]eeb4e4a2011-07-19 16:22:0627namespace proxy {
28
29namespace {
[email protected]84b44c552012-10-15 20:58:1730
mazda9cfbcfb2014-11-12 17:07:1131#if !defined(OS_NACL)
penghuanga206fb492014-09-09 21:27:3232base::SharedMemoryHandle TransportSHMHandle(
33 Dispatcher* dispatcher,
34 const base::SharedMemoryHandle& handle) {
[email protected]eeb4e4a2011-07-19 16:22:0635 // Don't close the handle, it doesn't belong to us.
erikchen4fc32d52015-06-02 02:16:3836 return dispatcher->ShareSharedMemoryHandleWithRemote(handle);
[email protected]eeb4e4a2011-07-19 16:22:0637}
mazda9cfbcfb2014-11-12 17:07:1138#endif // !defined(OS_NACL)
[email protected]eeb4e4a2011-07-19 16:22:0639
[email protected]914f5262013-06-01 00:17:2240gpu::CommandBuffer::State GetErrorState() {
41 gpu::CommandBuffer::State error_state;
42 error_state.error = gpu::error::kGenericError;
[email protected]eeb4e4a2011-07-19 16:22:0643 return error_state;
44}
45
[email protected]eeb4e4a2011-07-19 16:22:0646} // namespace
47
pimanb36392c22016-07-13 02:11:3648Graphics3D::Graphics3D(const HostResource& resource, const gfx::Size& size)
49 : PPB_Graphics3D_Shared(resource, size) {
[email protected]eeb4e4a2011-07-19 16:22:0650}
51
52Graphics3D::~Graphics3D() {
[email protected]edccb562013-10-02 00:01:2053 DestroyGLES2Impl();
[email protected]eeb4e4a2011-07-19 16:22:0654}
55
penghuanga206fb492014-09-09 21:27:3256bool Graphics3D::Init(gpu::gles2::GLES2Implementation* share_gles2,
piman360175c2014-11-07 02:30:0157 const gpu::Capabilities& capabilities,
dyen12e45962015-09-18 00:13:5158 const SerializedHandle& shared_state,
lukasza2573ce7d2016-02-16 19:17:2259 gpu::CommandBufferId command_buffer_id) {
[email protected]7f8b26b2011-08-18 15:41:0160 PluginDispatcher* dispatcher = PluginDispatcher::GetForResource(this);
[email protected]eeb4e4a2011-07-19 16:22:0661 if (!dispatcher)
62 return false;
63
piman360175c2014-11-07 02:30:0164 command_buffer_.reset(new PpapiCommandBufferProxy(
dyen12e45962015-09-18 00:13:5165 host_resource(), dispatcher, capabilities, shared_state,
66 command_buffer_id));
[email protected]84b44c552012-10-15 20:58:1767
Eric Karl2fc4409b92017-08-18 18:48:3968 return CreateGLES2Impl(share_gles2);
[email protected]eeb4e4a2011-07-19 16:22:0669}
70
[email protected]503b3a22011-12-12 23:29:4071PP_Bool Graphics3D::SetGetBuffer(int32_t /* transfer_buffer_id */) {
[email protected]eeb4e4a2011-07-19 16:22:0672 return PP_FALSE;
73}
74
[email protected]eeb4e4a2011-07-19 16:22:0675PP_Bool Graphics3D::Flush(int32_t put_offset) {
76 return PP_FALSE;
77}
78
[email protected]046fa1ac2014-04-01 09:06:4379scoped_refptr<gpu::Buffer> Graphics3D::CreateTransferBuffer(
80 uint32_t size,
81 int32_t* id) {
82 *id = -1;
83 return NULL;
[email protected]eeb4e4a2011-07-19 16:22:0684}
85
86PP_Bool Graphics3D::DestroyTransferBuffer(int32_t id) {
87 return PP_FALSE;
88}
89
[email protected]7fe4198b2014-03-18 21:52:3690gpu::CommandBuffer::State Graphics3D::WaitForTokenInRange(int32_t start,
91 int32_t end) {
92 return GetErrorState();
93}
94
Antoine Labourd3469942017-05-16 21:23:4295gpu::CommandBuffer::State Graphics3D::WaitForGetOffsetInRange(
96 uint32_t set_get_buffer_count,
97 int32_t start,
98 int32_t end) {
[email protected]eeb4e4a2011-07-19 16:22:0699 return GetErrorState();
100}
101
dyen4de3d345f2016-01-12 18:30:42102void Graphics3D::EnsureWorkVisible() {
103 NOTREACHED();
104}
105
erikchen438b0442016-05-11 18:33:30106void Graphics3D::TakeFrontBuffer() {
107 NOTREACHED();
108}
109
[email protected]eeb4e4a2011-07-19 16:22:06110gpu::CommandBuffer* Graphics3D::GetCommandBuffer() {
[email protected]4e46a732013-09-30 18:35:59111 return command_buffer_.get();
[email protected]eeb4e4a2011-07-19 16:22:06112}
113
[email protected]744e0792013-09-27 01:18:35114gpu::GpuControl* Graphics3D::GetGpuControl() {
115 return command_buffer_.get();
116}
117
erikchenb13637b2016-07-08 09:38:56118int32_t Graphics3D::DoSwapBuffers(const gpu::SyncToken& sync_token,
pimanb36392c22016-07-13 02:11:36119 const gfx::Size& size) {
dyenddfdbbb2016-01-14 22:21:38120 // A valid sync token would indicate a swap buffer already happened somehow.
121 DCHECK(!sync_token.HasData());
122
123 gpu::gles2::GLES2Implementation* gl = gles2_impl();
124 gl->SwapBuffers();
erikchen438b0442016-05-11 18:33:30125
126 PluginDispatcher::GetForResource(this)->Send(
127 new PpapiHostMsg_PPBGraphics3D_TakeFrontBuffer(API_ID_PPB_GRAPHICS_3D,
128 host_resource()));
129
dyenddfdbbb2016-01-14 22:21:38130 gpu::SyncToken new_sync_token;
Sunny Sachanandanic94b8de2017-12-16 03:30:30131 gl->GenSyncTokenCHROMIUM(new_sync_token.GetData());
dyenddfdbbb2016-01-14 22:21:38132
[email protected]eeb4e4a2011-07-19 16:22:06133 IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers(
pimanb36392c22016-07-13 02:11:36134 API_ID_PPB_GRAPHICS_3D, host_resource(), new_sync_token, size);
[email protected]eeb4e4a2011-07-19 16:22:06135 msg->set_unblock(true);
[email protected]7f8b26b2011-08-18 15:41:01136 PluginDispatcher::GetForResource(this)->Send(msg);
[email protected]eeb4e4a2011-07-19 16:22:06137
[email protected]eeb4e4a2011-07-19 16:22:06138 return PP_OK_COMPLETIONPENDING;
139}
140
[email protected]5c966022011-09-13 18:09:37141PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher)
142 : InterfaceProxy(dispatcher),
[email protected]a2f53dc2013-04-30 01:06:35143 callback_factory_(this) {
[email protected]eeb4e4a2011-07-19 16:22:06144}
145
146PPB_Graphics3D_Proxy::~PPB_Graphics3D_Proxy() {
147}
148
149// static
[email protected]eeb4e4a2011-07-19 16:22:06150PP_Resource PPB_Graphics3D_Proxy::CreateProxyResource(
151 PP_Instance instance,
[email protected]eeb4e4a2011-07-19 16:22:06152 PP_Resource share_context,
153 const int32_t* attrib_list) {
154 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
155 if (!dispatcher)
156 return PP_ERROR_BADARGUMENT;
157
[email protected]9ed07f82012-05-29 21:54:55158 HostResource share_host;
159 gpu::gles2::GLES2Implementation* share_gles2 = NULL;
160 if (share_context != 0) {
161 EnterResourceNoLock<PPB_Graphics3D_API> enter(share_context, true);
162 if (enter.failed())
163 return PP_ERROR_BADARGUMENT;
164
165 PPB_Graphics3D_Shared* share_graphics =
166 static_cast<PPB_Graphics3D_Shared*>(enter.object());
167 share_host = share_graphics->host_resource();
168 share_gles2 = share_graphics->gles2_impl();
169 }
[email protected]eeb4e4a2011-07-19 16:22:06170
pimanfe4e4882016-07-09 01:18:21171 gpu::gles2::ContextCreationAttribHelper attrib_helper;
[email protected]eeb4e4a2011-07-19 16:22:06172 std::vector<int32_t> attribs;
173 if (attrib_list) {
pimanfe4e4882016-07-09 01:18:21174 for (const int32_t* attr = attrib_list; attr[0] != PP_GRAPHICS3DATTRIB_NONE;
[email protected]0e50fc4d2011-08-01 15:33:51175 attr += 2) {
pimanfe4e4882016-07-09 01:18:21176 switch (attr[0]) {
177 case PP_GRAPHICS3DATTRIB_WIDTH:
178 attrib_helper.offscreen_framebuffer_size.set_width(attr[1]);
179 break;
180 case PP_GRAPHICS3DATTRIB_HEIGHT:
181 attrib_helper.offscreen_framebuffer_size.set_height(attr[1]);
182 break;
183 case PP_GRAPHICS3DATTRIB_GPU_PREFERENCE:
184 attrib_helper.gpu_preference =
185 (attr[1] == PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER)
186 ? gl::PreferIntegratedGpu
187 : gl::PreferDiscreteGpu;
188 break;
David Revemanca46de732017-06-09 19:48:19189 case PP_GRAPHICS3DATTRIB_SINGLE_BUFFER:
190 attrib_helper.single_buffer = !!attr[1];
191 break;
pimanfe4e4882016-07-09 01:18:21192 default:
193 attribs.push_back(attr[0]);
194 attribs.push_back(attr[1]);
195 break;
196 }
[email protected]eeb4e4a2011-07-19 16:22:06197 }
pimanfe4e4882016-07-09 01:18:21198 attribs.push_back(PP_GRAPHICS3DATTRIB_NONE);
[email protected]eeb4e4a2011-07-19 16:22:06199 }
pimanfe4e4882016-07-09 01:18:21200 if (!attrib_helper.Parse(attribs))
201 return 0;
[email protected]eeb4e4a2011-07-19 16:22:06202
203 HostResource result;
piman360175c2014-11-07 02:30:01204 gpu::Capabilities capabilities;
penghuanga206fb492014-09-09 21:27:32205 ppapi::proxy::SerializedHandle shared_state;
lukasza2573ce7d2016-02-16 19:17:22206 gpu::CommandBufferId command_buffer_id;
pimanfe4e4882016-07-09 01:18:21207 dispatcher->Send(new PpapiHostMsg_PPBGraphics3D_Create(
208 API_ID_PPB_GRAPHICS_3D, instance, share_host, attrib_helper, &result,
209 &capabilities, &shared_state, &command_buffer_id));
penghuanga206fb492014-09-09 21:27:32210
[email protected]eeb4e4a2011-07-19 16:22:06211 if (result.is_null())
212 return 0;
213
pimanb36392c22016-07-13 02:11:36214 scoped_refptr<Graphics3D> graphics_3d(
215 new Graphics3D(result, attrib_helper.offscreen_framebuffer_size));
dyen12e45962015-09-18 00:13:51216 if (!graphics_3d->Init(share_gles2, capabilities, shared_state,
217 command_buffer_id)) {
[email protected]eeb4e4a2011-07-19 16:22:06218 return 0;
dyen12e45962015-09-18 00:13:51219 }
[email protected]7f8b26b2011-08-18 15:41:01220 return graphics_3d->GetReference();
[email protected]eeb4e4a2011-07-19 16:22:06221}
222
223bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
224 bool handled = true;
225 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics3D_Proxy, msg)
[email protected]11494c5c2012-11-13 02:50:57226#if !defined(OS_NACL)
[email protected]eeb4e4a2011-07-19 16:22:06227 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Create,
228 OnMsgCreate)
[email protected]503b3a22011-12-12 23:29:40229 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SetGetBuffer,
230 OnMsgSetGetBuffer)
[email protected]7fe4198b2014-03-18 21:52:36231 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForTokenInRange,
232 OnMsgWaitForTokenInRange)
233 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange,
234 OnMsgWaitForGetOffsetInRange)
235 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush, OnMsgAsyncFlush)
[email protected]eeb4e4a2011-07-19 16:22:06236 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer,
237 OnMsgCreateTransferBuffer)
238 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer,
239 OnMsgDestroyTransferBuffer)
[email protected]eeb4e4a2011-07-19 16:22:06240 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
241 OnMsgSwapBuffers)
erikchen438b0442016-05-11 18:33:30242 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_TakeFrontBuffer,
243 OnMsgTakeFrontBuffer)
dyen4de3d345f2016-01-12 18:30:42244 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_EnsureWorkVisible,
245 OnMsgEnsureWorkVisible)
[email protected]11494c5c2012-11-13 02:50:57246#endif // !defined(OS_NACL)
[email protected]eeb4e4a2011-07-19 16:22:06247
248 IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK,
249 OnMsgSwapBuffersACK)
250 IPC_MESSAGE_UNHANDLED(handled = false)
251
252 IPC_END_MESSAGE_MAP()
253 // FIXME(brettw) handle bad messages!
254 return handled;
255}
256
[email protected]11494c5c2012-11-13 02:50:57257#if !defined(OS_NACL)
lukasza2573ce7d2016-02-16 19:17:22258void PPB_Graphics3D_Proxy::OnMsgCreate(
259 PP_Instance instance,
260 HostResource share_context,
pimanfe4e4882016-07-09 01:18:21261 const gpu::gles2::ContextCreationAttribHelper& attrib_helper,
lukasza2573ce7d2016-02-16 19:17:22262 HostResource* result,
263 gpu::Capabilities* capabilities,
264 SerializedHandle* shared_state,
265 gpu::CommandBufferId* command_buffer_id) {
penghuanga206fb492014-09-09 21:27:32266 shared_state->set_null_shmem();
[email protected]eeb4e4a2011-07-19 16:22:06267
[email protected]5c966022011-09-13 18:09:37268 thunk::EnterResourceCreation enter(instance);
[email protected]9ed07f82012-05-29 21:54:55269
penghuanga206fb492014-09-09 21:27:32270 if (!enter.succeeded())
271 return;
272
erikchena40775d02017-04-29 07:15:49273 base::SharedMemoryHandle handle;
penghuanga206fb492014-09-09 21:27:32274 result->SetHostResource(
pimanfe4e4882016-07-09 01:18:21275 instance, enter.functions()->CreateGraphics3DRaw(
276 instance, share_context.host_resource(), attrib_helper,
277 capabilities, &handle, command_buffer_id));
penghuanga206fb492014-09-09 21:27:32278 if (!result->is_null()) {
279 shared_state->set_shmem(TransportSHMHandle(dispatcher(), handle),
280 sizeof(gpu::CommandBuffer::State));
[email protected]eeb4e4a2011-07-19 16:22:06281 }
282}
283
avie029c4132015-12-23 06:45:22284void PPB_Graphics3D_Proxy::OnMsgSetGetBuffer(const HostResource& context,
285 int32_t transfer_buffer_id) {
[email protected]503b3a22011-12-12 23:29:40286 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
287 if (enter.succeeded())
288 enter.object()->SetGetBuffer(transfer_buffer_id);
[email protected]eeb4e4a2011-07-19 16:22:06289}
290
[email protected]7fe4198b2014-03-18 21:52:36291void PPB_Graphics3D_Proxy::OnMsgWaitForTokenInRange(
292 const HostResource& context,
avie029c4132015-12-23 06:45:22293 int32_t start,
294 int32_t end,
[email protected]7fe4198b2014-03-18 21:52:36295 gpu::CommandBuffer::State* state,
296 bool* success) {
[email protected]eeb4e4a2011-07-19 16:22:06297 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
[email protected]571b35e82012-05-19 00:04:35298 if (enter.failed()) {
299 *success = false;
[email protected]eeb4e4a2011-07-19 16:22:06300 return;
[email protected]571b35e82012-05-19 00:04:35301 }
[email protected]7fe4198b2014-03-18 21:52:36302 *state = enter.object()->WaitForTokenInRange(start, end);
303 *success = true;
304}
305
306void PPB_Graphics3D_Proxy::OnMsgWaitForGetOffsetInRange(
307 const HostResource& context,
Antoine Labourd3469942017-05-16 21:23:42308 uint32_t set_get_buffer_count,
avie029c4132015-12-23 06:45:22309 int32_t start,
310 int32_t end,
[email protected]7fe4198b2014-03-18 21:52:36311 gpu::CommandBuffer::State* state,
312 bool* success) {
313 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
314 if (enter.failed()) {
315 *success = false;
316 return;
317 }
Antoine Labourd3469942017-05-16 21:23:42318 *state =
319 enter.object()->WaitForGetOffsetInRange(set_get_buffer_count, start, end);
[email protected]571b35e82012-05-19 00:04:35320 *success = true;
[email protected]eeb4e4a2011-07-19 16:22:06321}
322
323void PPB_Graphics3D_Proxy::OnMsgAsyncFlush(const HostResource& context,
avie029c4132015-12-23 06:45:22324 int32_t put_offset) {
[email protected]eeb4e4a2011-07-19 16:22:06325 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
326 if (enter.succeeded())
327 enter.object()->Flush(put_offset);
328}
329
330void PPB_Graphics3D_Proxy::OnMsgCreateTransferBuffer(
331 const HostResource& context,
avie029c4132015-12-23 06:45:22332 uint32_t size,
333 int32_t* id,
penghuanga206fb492014-09-09 21:27:32334 SerializedHandle* transfer_buffer) {
[email protected]046fa1ac2014-04-01 09:06:43335 transfer_buffer->set_null_shmem();
[email protected]eeb4e4a2011-07-19 16:22:06336 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
[email protected]046fa1ac2014-04-01 09:06:43337 if (enter.succeeded()) {
338 scoped_refptr<gpu::Buffer> buffer =
339 enter.object()->CreateTransferBuffer(size, id);
Daniel Cheng6d3ae972014-08-26 00:27:38340 if (!buffer.get())
[email protected]046fa1ac2014-04-01 09:06:43341 return;
[email protected]8a978df2014-04-02 23:54:09342 gpu::SharedMemoryBufferBacking* backing =
343 static_cast<gpu::SharedMemoryBufferBacking*>(buffer->backing());
344 DCHECK(backing && backing->shared_memory());
[email protected]046fa1ac2014-04-01 09:06:43345 transfer_buffer->set_shmem(
penghuanga206fb492014-09-09 21:27:32346 TransportSHMHandle(dispatcher(), backing->shared_memory()->handle()),
brettw669d47b12015-02-13 21:17:38347 base::checked_cast<uint32_t>(buffer->size()));
[email protected]046fa1ac2014-04-01 09:06:43348 } else {
[email protected]67c80782012-12-21 01:16:52349 *id = -1;
[email protected]046fa1ac2014-04-01 09:06:43350 }
[email protected]eeb4e4a2011-07-19 16:22:06351}
352
353void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer(
354 const HostResource& context,
avie029c4132015-12-23 06:45:22355 int32_t id) {
[email protected]eeb4e4a2011-07-19 16:22:06356 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
357 if (enter.succeeded())
358 enter.object()->DestroyTransferBuffer(id);
359}
360
dyenddfdbbb2016-01-14 22:21:38361void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context,
erikchenb13637b2016-07-08 09:38:56362 const gpu::SyncToken& sync_token,
pimanb36392c22016-07-13 02:11:36363 const gfx::Size& size) {
[email protected]79d23c72011-08-08 19:40:40364 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter(
365 context, callback_factory_,
[email protected]eeb4e4a2011-07-19 16:22:06366 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context);
[email protected]eeb4e4a2011-07-19 16:22:06367 if (enter.succeeded())
erikchenb13637b2016-07-08 09:38:56368 enter.SetResult(enter.object()->SwapBuffersWithSyncToken(
pimanb36392c22016-07-13 02:11:36369 enter.callback(), sync_token, size));
[email protected]eeb4e4a2011-07-19 16:22:06370}
[email protected]b096d032013-03-08 03:08:01371
erikchen438b0442016-05-11 18:33:30372void PPB_Graphics3D_Proxy::OnMsgTakeFrontBuffer(const HostResource& context) {
373 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
374 if (enter.succeeded())
375 enter.object()->TakeFrontBuffer();
376}
377
dyen4de3d345f2016-01-12 18:30:42378void PPB_Graphics3D_Proxy::OnMsgEnsureWorkVisible(const HostResource& context) {
379 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
380 if (enter.succeeded())
381 enter.object()->EnsureWorkVisible();
382}
[email protected]11494c5c2012-11-13 02:50:57383#endif // !defined(OS_NACL)
[email protected]eeb4e4a2011-07-19 16:22:06384
385void PPB_Graphics3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource,
386 int32_t pp_error) {
387 EnterPluginFromHostResource<PPB_Graphics3D_API> enter(resource);
388 if (enter.succeeded())
389 static_cast<Graphics3D*>(enter.object())->SwapBuffersACK(pp_error);
390}
391
[email protected]11494c5c2012-11-13 02:50:57392#if !defined(OS_NACL)
[email protected]eeb4e4a2011-07-19 16:22:06393void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin(
394 int32_t result,
395 const HostResource& context) {
396 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK(
[email protected]ac4b54d2011-10-20 23:09:28397 API_ID_PPB_GRAPHICS_3D, context, result));
[email protected]eeb4e4a2011-07-19 16:22:06398}
[email protected]11494c5c2012-11-13 02:50:57399#endif // !defined(OS_NACL)
[email protected]eeb4e4a2011-07-19 16:22:06400
401} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02402} // namespace ppapi