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

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

Issue 6905088: New thunk system for Pepper proxy and implementation (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
« no previous file with comments | « webkit/plugins/ppapi/resource_creation_impl.h ('k') | webkit/plugins/ppapi/resource_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/resource_creation_impl.cc
===================================================================
--- webkit/plugins/ppapi/resource_creation_impl.cc (revision 0)
+++ webkit/plugins/ppapi/resource_creation_impl.cc (revision 0)
@@ -0,0 +1,58 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/ppapi/resource_creation_impl.h"
+
+#include "ppapi/c/pp_size.h"
+#include "webkit/plugins/ppapi/common.h"
+#include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
+#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
+
+namespace webkit {
+namespace ppapi {
+
+ResourceCreationImpl::ResourceCreationImpl() {
+}
+
+ResourceCreationImpl::~ResourceCreationImpl() {
+}
+
+::ppapi::thunk::ResourceCreationAPI*
+ResourceCreationImpl::AsResourceCreation() {
+ return this;
+}
+
+PP_Resource ResourceCreationImpl::CreateGraphics2D(
+ PP_Instance pp_instance,
+ const PP_Size& size,
+ PP_Bool is_always_opaque) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
+ if (!instance)
+ return 0;
+
+ scoped_refptr<PPB_Graphics2D_Impl> graphics_2d(
+ new PPB_Graphics2D_Impl(instance));
+ if (!graphics_2d->Init(size.width, size.height,
+ PPBoolToBool(is_always_opaque))) {
+ return 0;
+ }
+ return graphics_2d->GetReference();
+}
+
+PP_Resource ResourceCreationImpl::CreateImageData(PP_Instance pp_instance,
+ PP_ImageDataFormat format,
+ const PP_Size& size,
+ PP_Bool init_to_zero) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
+ if (!instance)
+ return 0;
+
+ scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance));
+ if (!data->Init(format, size.width, size.height, !!init_to_zero))
+ return 0;
+ return data->GetReference();
+}
+
+} // namespace ppapi
+} // namespace webkit
Property changes on: webkit/plugins/ppapi/resource_creation_impl.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « webkit/plugins/ppapi/resource_creation_impl.h ('k') | webkit/plugins/ppapi/resource_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698