Chromium Code Reviews

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 6047008: Added ppapi::Surface3D. This CL completes the new Pepper3D interface. The imp... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | webkit/plugins/ppapi/ppb_context_3d_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc
===================================================================
--- webkit/plugins/ppapi/ppapi_plugin_instance.cc (revision 70037)
+++ webkit/plugins/ppapi/ppapi_plugin_instance.cc (working copy)
@@ -45,9 +45,9 @@
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
-#include "webkit/plugins/ppapi/ppb_context_3d_impl.h"
#include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
+#include "webkit/plugins/ppapi/ppb_surface_3d_impl.h"
#include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
#include "webkit/plugins/ppapi/ppp_pdf.h"
#include "webkit/plugins/ppapi/string.h"
@@ -430,8 +430,7 @@
if (bound_graphics_2d()) {
bound_graphics_2d()->BindToInstance(NULL);
} else if (bound_graphics_.get()) {
- bound_graphics_3d()->SetSwapBuffersCallback(NULL);
- bound_graphics_3d()->BindToInstance(NULL);
+ bound_graphics_3d()->BindToInstance(false);
}
InvalidateRect(gfx::Rect());
}
@@ -441,8 +440,8 @@
scoped_refptr<PPB_Graphics2D_Impl> graphics_2d =
Resource::GetAs<PPB_Graphics2D_Impl>(graphics_id);
- scoped_refptr<PPB_Context3D_Impl> graphics_3d =
- Resource::GetAs<PPB_Context3D_Impl>(graphics_id);
+ scoped_refptr<PPB_Surface3D_Impl> graphics_3d =
+ Resource::GetAs<PPB_Surface3D_Impl>(graphics_id);
if (graphics_2d) {
if (!graphics_2d->BindToInstance(this))
@@ -470,12 +469,14 @@
bound_graphics_ = graphics_2d;
// BindToInstance will have invalidated the plugin if necessary.
} else if (graphics_3d) {
- if (!graphics_3d->BindToInstance(this))
+ // Make sure graphics can only be bound to the instance it is
+ // associated with.
+ if (graphics_3d->instance() != this)
alokp 2010/12/23 22:07:54 moving this function to graphics will also elimina
return false;
+ if (!graphics_3d->BindToInstance(true))
+ return false;
bound_graphics_ = graphics_3d;
- bound_graphics_3d()->SetSwapBuffersCallback(
- NewCallback(this, &PluginInstance::CommitBackingTexture));
}
return true;
@@ -585,15 +586,6 @@
void PluginInstance::ViewChanged(const gfx::Rect& position,
const gfx::Rect& clip) {
- if (position.size() != position_.size() && bound_graphics_3d()) {
- // TODO(apatrick): This is a hack to force the back buffer to resize.
- // It is obviously wrong to call SwapBuffers when a partial frame has
- // potentially been rendered. Plan is to embed resize commands in the
- // command buffer just before ViewChanged is called.
- bound_graphics_3d()->ResizeBackingTexture(position.size());
- bound_graphics_3d()->SwapBuffers();
- }
-
position_ = position;
if (clip.IsEmpty()) {
@@ -1174,11 +1166,11 @@
return bound_graphics_->Cast<PPB_Graphics2D_Impl>();
}
-PPB_Context3D_Impl* PluginInstance::bound_graphics_3d() const {
+PPB_Surface3D_Impl* PluginInstance::bound_graphics_3d() const {
if (bound_graphics_.get() == NULL)
return NULL;
- return bound_graphics_->Cast<PPB_Context3D_Impl>();
+ return bound_graphics_->Cast<PPB_Surface3D_Impl>();
}
} // namespace ppapi
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | webkit/plugins/ppapi/ppb_context_3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine