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

Side by Side Diff: webkit/plugins/ppapi/ppb_proxy_impl.cc

Issue 7206016: Convert most remaining resources to use the API/thunk system. The significant (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
« no previous file with comments | « webkit/plugins/ppapi/ppb_opengles_impl.cc ('k') | webkit/plugins/ppapi/ppb_scrollbar_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_proxy_impl.h" 5 #include "webkit/plugins/ppapi/ppb_proxy_impl.h"
6 6
7 #include "ppapi/c/private/ppb_proxy_private.h" 7 #include "ppapi/c/private/ppb_proxy_private.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_image_data_api.h"
8 #include "webkit/plugins/ppapi/plugin_module.h" 10 #include "webkit/plugins/ppapi/plugin_module.h"
9 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 11 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
10 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" 12 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
11 #include "webkit/plugins/ppapi/resource.h" 13 #include "webkit/plugins/ppapi/resource.h"
12 #include "webkit/plugins/ppapi/resource_tracker.h" 14 #include "webkit/plugins/ppapi/resource_tracker.h"
13 15
16 using ppapi::thunk::EnterResource;
17 using ppapi::thunk::PPB_URLLoader_API;
18
14 namespace webkit { 19 namespace webkit {
15 namespace ppapi { 20 namespace ppapi {
16 21
17 namespace { 22 namespace {
18 23
19 void PluginCrashed(PP_Module module) { 24 void PluginCrashed(PP_Module module) {
20 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 25 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
21 if (plugin_module) 26 if (plugin_module)
22 plugin_module->PluginCrashed(); 27 plugin_module->PluginCrashed();
23 } 28 }
24 29
25 PP_Instance GetInstanceForResource(PP_Resource resource) { 30 PP_Instance GetInstanceForResource(PP_Resource resource) {
26 scoped_refptr<Resource> obj(ResourceTracker::Get()->GetResource(resource)); 31 scoped_refptr<Resource> obj(ResourceTracker::Get()->GetResource(resource));
27 if (!obj) 32 if (!obj)
28 return 0; 33 return 0;
29 return obj->instance()->pp_instance(); 34 return obj->instance()->pp_instance();
30 } 35 }
31 36
32 void SetReserveInstanceIDCallback(PP_Module module, 37 void SetReserveInstanceIDCallback(PP_Module module,
33 PP_Bool (*reserve)(PP_Module, PP_Instance)) { 38 PP_Bool (*reserve)(PP_Module, PP_Instance)) {
34 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 39 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
35 if (plugin_module) 40 if (plugin_module)
36 plugin_module->SetReserveInstanceIDCallback(reserve); 41 plugin_module->SetReserveInstanceIDCallback(reserve);
37 } 42 }
38 43
39 int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) { 44 int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) {
40 scoped_refptr<PPB_URLLoader_Impl> loader( 45 EnterResource<PPB_URLLoader_API> enter(url_loader, true);
41 Resource::GetAs<PPB_URLLoader_Impl>(url_loader)); 46 if (enter.succeeded())
42 if (!loader) 47 return static_cast<PPB_URLLoader_Impl*>(enter.object())->buffer_size();
43 return 0; 48 return 0;
44 return loader->buffer_size();
45 } 49 }
46 50
47 void AddRefModule(PP_Module module) { 51 void AddRefModule(PP_Module module) {
48 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 52 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
49 if (plugin_module) 53 if (plugin_module)
50 plugin_module->AddRef(); 54 plugin_module->AddRef();
51 } 55 }
52 56
53 void ReleaseModule(PP_Module module) { 57 void ReleaseModule(PP_Module module) {
54 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 58 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
(...skipping 12 matching lines...) Expand all
67 71
68 } // namespace 72 } // namespace
69 73
70 // static 74 // static
71 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() { 75 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() {
72 return &ppb_proxy; 76 return &ppb_proxy;
73 } 77 }
74 78
75 } // namespace ppapi 79 } // namespace ppapi
76 } // namespace webkit 80 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_opengles_impl.cc ('k') | webkit/plugins/ppapi/ppb_scrollbar_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698