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

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

Issue 8344025: Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_impl.cc ('k') | webkit/plugins/ppapi/ppb_var_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:mergeinfo
Reverse-merged /branches/chrome_webkit_merge_branch/src/webkit/plugins/ppapi/ppb_proxy_impl.cc:r3734-4217,4606-5108,5177-5263
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" 8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_image_data_api.h" 9 #include "ppapi/thunk/ppb_image_data_api.h"
10 #include "webkit/plugins/ppapi/host_globals.h"
10 #include "webkit/plugins/ppapi/plugin_module.h" 11 #include "webkit/plugins/ppapi/plugin_module.h"
11 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
12 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" 13 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
13 #include "webkit/plugins/ppapi/resource_tracker.h" 14 #include "webkit/plugins/ppapi/resource_tracker.h"
14 15
16 using ppapi::PpapiGlobals;
15 using ppapi::thunk::EnterResource; 17 using ppapi::thunk::EnterResource;
16 using ppapi::thunk::PPB_URLLoader_API; 18 using ppapi::thunk::PPB_URLLoader_API;
17 19
18 namespace webkit { 20 namespace webkit {
19 namespace ppapi { 21 namespace ppapi {
20 22
21 namespace { 23 namespace {
22 24
23 void PluginCrashed(PP_Module module) { 25 void PluginCrashed(PP_Module module) {
24 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 26 PluginModule* plugin_module =
27 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
25 if (plugin_module) 28 if (plugin_module)
26 plugin_module->PluginCrashed(); 29 plugin_module->PluginCrashed();
27 } 30 }
28 31
29 PP_Instance GetInstanceForResource(PP_Resource resource) { 32 PP_Instance GetInstanceForResource(PP_Resource resource) {
30 ::ppapi::Resource* obj = ResourceTracker::Get()->GetResource(resource); 33 ::ppapi::Resource* obj =
34 PpapiGlobals::Get()->GetResourceTracker()->GetResource(resource);
31 if (!obj) 35 if (!obj)
32 return 0; 36 return 0;
33 return obj->pp_instance(); 37 return obj->pp_instance();
34 } 38 }
35 39
36 void SetReserveInstanceIDCallback(PP_Module module, 40 void SetReserveInstanceIDCallback(PP_Module module,
37 PP_Bool (*reserve)(PP_Module, PP_Instance)) { 41 PP_Bool (*reserve)(PP_Module, PP_Instance)) {
38 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 42 PluginModule* plugin_module =
43 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
39 if (plugin_module) 44 if (plugin_module)
40 plugin_module->SetReserveInstanceIDCallback(reserve); 45 plugin_module->SetReserveInstanceIDCallback(reserve);
41 } 46 }
42 47
43 int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) { 48 int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) {
44 EnterResource<PPB_URLLoader_API> enter(url_loader, true); 49 EnterResource<PPB_URLLoader_API> enter(url_loader, true);
45 if (enter.succeeded()) 50 if (enter.succeeded())
46 return static_cast<PPB_URLLoader_Impl*>(enter.object())->buffer_size(); 51 return static_cast<PPB_URLLoader_Impl*>(enter.object())->buffer_size();
47 return 0; 52 return 0;
48 } 53 }
49 54
50 void AddRefModule(PP_Module module) { 55 void AddRefModule(PP_Module module) {
51 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 56 PluginModule* plugin_module =
57 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
52 if (plugin_module) 58 if (plugin_module)
53 plugin_module->AddRef(); 59 plugin_module->AddRef();
54 } 60 }
55 61
56 void ReleaseModule(PP_Module module) { 62 void ReleaseModule(PP_Module module) {
57 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 63 PluginModule* plugin_module =
64 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
58 if (plugin_module) 65 if (plugin_module)
59 plugin_module->Release(); 66 plugin_module->Release();
60 } 67 }
61 68
62 PP_Bool IsInModuleDestructor(PP_Module module) { 69 PP_Bool IsInModuleDestructor(PP_Module module) {
63 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module); 70 PluginModule* plugin_module =
71 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
64 if (plugin_module) 72 if (plugin_module)
65 return PP_FromBool(plugin_module->is_in_destructor()); 73 return PP_FromBool(plugin_module->is_in_destructor());
66 return PP_FALSE; 74 return PP_FALSE;
67 } 75 }
68 76
69 const PPB_Proxy_Private ppb_proxy = { 77 const PPB_Proxy_Private ppb_proxy = {
70 &PluginCrashed, 78 &PluginCrashed,
71 &GetInstanceForResource, 79 &GetInstanceForResource,
72 &SetReserveInstanceIDCallback, 80 &SetReserveInstanceIDCallback,
73 &GetURLLoaderBufferedBytes, 81 &GetURLLoaderBufferedBytes,
74 &AddRefModule, 82 &AddRefModule,
75 &ReleaseModule, 83 &ReleaseModule,
76 &IsInModuleDestructor 84 &IsInModuleDestructor
77 }; 85 };
78 86
79 } // namespace 87 } // namespace
80 88
81 // static 89 // static
82 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() { 90 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() {
83 return &ppb_proxy; 91 return &ppb_proxy;
84 } 92 }
85 93
86 } // namespace ppapi 94 } // namespace ppapi
87 } // namespace webkit 95 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_impl.cc ('k') | webkit/plugins/ppapi/ppb_var_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698