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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
10 #include "gpu/command_buffer/common/command_buffer.h" | 10 #include "gpu/command_buffer/common/command_buffer.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 void PPB_Surface3D_Impl::OnContextLost() { | 166 void PPB_Surface3D_Impl::OnContextLost() { |
167 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | 167 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
168 if (bound_to_instance_ && plugin_instance) | 168 if (bound_to_instance_ && plugin_instance) |
169 plugin_instance->BindGraphics(pp_instance(), 0); | 169 plugin_instance->BindGraphics(pp_instance(), 0); |
170 | 170 |
171 // Send context lost to plugin. This may have been caused by a PPAPI call, so | 171 // Send context lost to plugin. This may have been caused by a PPAPI call, so |
172 // avoid re-entering. | 172 // avoid re-entering. |
173 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 173 MessageLoop::current()->PostTask( |
174 this, &PPB_Surface3D_Impl::SendContextLost)); | 174 FROM_HERE, base::Bind(&PPB_Surface3D_Impl::SendContextLost, this)); |
175 } | 175 } |
176 | 176 |
177 void PPB_Surface3D_Impl::SendContextLost() { | 177 void PPB_Surface3D_Impl::SendContextLost() { |
178 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | 178 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
179 | 179 |
180 // By the time we run this, the instance may have been deleted, or in the | 180 // By the time we run this, the instance may have been deleted, or in the |
181 // process of being deleted. Even in the latter case, we don't want to send a | 181 // process of being deleted. Even in the latter case, we don't want to send a |
182 // callback after DidDestroy. | 182 // callback after DidDestroy. |
183 if (!plugin_instance || !plugin_instance->container()) | 183 if (!plugin_instance || !plugin_instance->container()) |
184 return; | 184 return; |
185 const PPP_Graphics3D* ppp_graphics_3d = | 185 const PPP_Graphics3D* ppp_graphics_3d = |
186 static_cast<const PPP_Graphics3D*>( | 186 static_cast<const PPP_Graphics3D*>( |
187 plugin_instance->module()->GetPluginInterface( | 187 plugin_instance->module()->GetPluginInterface( |
188 PPP_GRAPHICS_3D_INTERFACE)); | 188 PPP_GRAPHICS_3D_INTERFACE)); |
189 if (ppp_graphics_3d) | 189 if (ppp_graphics_3d) |
190 ppp_graphics_3d->Graphics3DContextLost(pp_instance()); | 190 ppp_graphics_3d->Graphics3DContextLost(pp_instance()); |
191 } | 191 } |
192 | 192 |
193 } // namespace ppapi | 193 } // namespace ppapi |
194 } // namespace webkit | 194 } // namespace webkit |
OLD | NEW |