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 "webkit/plugins/ppapi/ppb_surface_3d_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_surface_3d_impl.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
9 #include "gpu/command_buffer/common/command_buffer.h" | 9 #include "gpu/command_buffer/common/command_buffer.h" |
10 #include "ppapi/c/dev/ppb_graphics_3d_dev.h" | 10 #include "ppapi/c/dev/ppb_graphics_3d_dev.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 if (swap_callback_.get() && !swap_callback_->completed()) { | 66 if (swap_callback_.get() && !swap_callback_->completed()) { |
67 // Already a pending SwapBuffers that hasn't returned yet. | 67 // Already a pending SwapBuffers that hasn't returned yet. |
68 return PP_ERROR_INPROGRESS; | 68 return PP_ERROR_INPROGRESS; |
69 } | 69 } |
70 | 70 |
71 if (!context_) | 71 if (!context_) |
72 return PP_ERROR_FAILED; | 72 return PP_ERROR_FAILED; |
73 | 73 |
74 PP_Resource resource_id = GetReferenceNoAddRef(); | |
75 CHECK(resource_id); | |
76 swap_callback_ = new TrackedCompletionCallback( | 74 swap_callback_ = new TrackedCompletionCallback( |
77 instance()->module()->GetCallbackTracker(), resource_id, callback); | 75 instance()->module()->GetCallbackTracker(), pp_resource(), callback); |
78 gpu::gles2::GLES2Implementation* impl = context_->gles2_impl(); | 76 gpu::gles2::GLES2Implementation* impl = context_->gles2_impl(); |
79 if (impl) | 77 if (impl) |
80 context_->gles2_impl()->SwapBuffers(); | 78 context_->gles2_impl()->SwapBuffers(); |
81 // |SwapBuffers()| should not call us back synchronously, but double-check. | 79 // |SwapBuffers()| should not call us back synchronously, but double-check. |
82 DCHECK(!swap_callback_->completed()); | 80 DCHECK(!swap_callback_->completed()); |
83 return PP_OK_COMPLETIONPENDING; | 81 return PP_OK_COMPLETIONPENDING; |
84 } | 82 } |
85 | 83 |
86 bool PPB_Surface3D_Impl::Init(PP_Config3D_Dev config, | 84 bool PPB_Surface3D_Impl::Init(PP_Config3D_Dev config, |
87 const int32_t* attrib_list) { | 85 const int32_t* attrib_list) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 const PPP_Graphics3D_Dev* ppp_graphics_3d = | 169 const PPP_Graphics3D_Dev* ppp_graphics_3d = |
172 static_cast<const PPP_Graphics3D_Dev*>( | 170 static_cast<const PPP_Graphics3D_Dev*>( |
173 instance()->module()->GetPluginInterface( | 171 instance()->module()->GetPluginInterface( |
174 PPP_GRAPHICS_3D_DEV_INTERFACE)); | 172 PPP_GRAPHICS_3D_DEV_INTERFACE)); |
175 if (ppp_graphics_3d) | 173 if (ppp_graphics_3d) |
176 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); | 174 ppp_graphics_3d->Graphics3DContextLost(instance()->pp_instance()); |
177 } | 175 } |
178 | 176 |
179 } // namespace ppapi | 177 } // namespace ppapi |
180 } // namespace webkit | 178 } // namespace webkit |
OLD | NEW |