Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2933)

Unified Diff: content/renderer/pepper/renderer_ppapi_host_impl.cc

Issue 11053003: Migrate Graphics2D to new design. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/renderer_ppapi_host_impl.cc
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc
index 0dde8e2638088938589bfe15cc62f51adee725c1..ad9d56a9c84f534b9046c3f7a22c8af8cc52236b 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.cc
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc
@@ -5,12 +5,14 @@
#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
#include "base/logging.h"
+#include "content/renderer/pepper/pepper_graphics_2d_host.h"
#include "content/renderer/pepper/pepper_in_process_resource_creation.h"
#include "content/renderer/pepper/pepper_in_process_router.h"
#include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
#include "content/renderer/render_view_impl.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "webkit/plugins/ppapi/host_globals.h"
+#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
using webkit::ppapi::HostGlobals;
@@ -99,7 +101,7 @@ RendererPpapiHostImpl::CreateInProcessResourceCreationAPI(
new PepperInProcessResourceCreation(this, instance));
}
-ppapi::host::PpapiHost* RendererPpapiHostImpl::GetPpapiHost() {
+ppapi::host::PpapiHost* RendererPpapiHostImpl::GetPpapiHost() const {
return ppapi_host_.get();
}
@@ -115,6 +117,20 @@ RenderView* RendererPpapiHostImpl::GetRenderViewForInstance(
instance_object->delegate())->render_view();
}
+webkit::ppapi::PluginDelegate::PlatformGraphics2D*
+RendererPpapiHostImpl::GetPlatformGraphics2D(
+ PP_Resource resource) const {
+ ppapi::host::PpapiHost* ppapi_host = GetPpapiHost();
+ // Make sure the resource from the plugin is a known one, so that we can cast
+ // it safely.
+ if (!ppapi_host->IsGraphics2DResource(resource)) {
+ LOG(ERROR) << "Resource is not Graphics2d";
+ return NULL;
+ }
+ return static_cast<PepperGraphics2DHost*>(
+ ppapi_host->GetResourceHost(resource));
+}
+
bool RendererPpapiHostImpl::IsValidInstance(
PP_Instance instance) const {
return !!GetAndValidateInstance(instance);

Powered by Google App Engine
This is Rietveld 408576698