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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "webkit/plugins/ppapi/resource_creation_impl.h"
6
7 #include "ppapi/c/pp_size.h"
8 #include "webkit/plugins/ppapi/common.h"
9 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
10 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
11
12 namespace webkit {
13 namespace ppapi {
14
15 ResourceCreationImpl::ResourceCreationImpl() {
16 }
17
18 ResourceCreationImpl::~ResourceCreationImpl() {
19 }
20
21 ::ppapi::thunk::ResourceCreationAPI*
22 ResourceCreationImpl::AsResourceCreation() {
23 return this;
24 }
25
26 PP_Resource ResourceCreationImpl::CreateGraphics2D(
27 PP_Instance pp_instance,
28 const PP_Size& size,
29 PP_Bool is_always_opaque) {
30 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
31 if (!instance)
32 return 0;
33
34 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d(
35 new PPB_Graphics2D_Impl(instance));
36 if (!graphics_2d->Init(size.width, size.height,
37 PPBoolToBool(is_always_opaque))) {
38 return 0;
39 }
40 return graphics_2d->GetReference();
41 }
42
43 PP_Resource ResourceCreationImpl::CreateImageData(PP_Instance pp_instance,
44 PP_ImageDataFormat format,
45 const PP_Size& size,
46 PP_Bool init_to_zero) {
47 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
48 if (!instance)
49 return 0;
50
51 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance));
52 if (!data->Init(format, size.width, size.height, !!init_to_zero))
53 return 0;
54 return data->GetReference();
55 }
56
57 } // namespace ppapi
58 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698