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

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

Issue 8342016: Revert 106142 - Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://svn.chromium.org/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:
Added: svn:mergeinfo
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"
11 #include "webkit/plugins/ppapi/plugin_module.h" 10 #include "webkit/plugins/ppapi/plugin_module.h"
12 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 11 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
13 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" 12 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
14 #include "webkit/plugins/ppapi/resource_tracker.h" 13 #include "webkit/plugins/ppapi/resource_tracker.h"
15 14
16 using ppapi::PpapiGlobals;
17 using ppapi::thunk::EnterResource; 15 using ppapi::thunk::EnterResource;
18 using ppapi::thunk::PPB_URLLoader_API; 16 using ppapi::thunk::PPB_URLLoader_API;
19 17
20 namespace webkit { 18 namespace webkit {
21 namespace ppapi { 19 namespace ppapi {
22 20
23 namespace { 21 namespace {
24 22
25 void PluginCrashed(PP_Module module) { 23 void PluginCrashed(PP_Module module) {
26 PluginModule* plugin_module = 24 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
27 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
28 if (plugin_module) 25 if (plugin_module)
29 plugin_module->PluginCrashed(); 26 plugin_module->PluginCrashed();
30 } 27 }
31 28
32 PP_Instance GetInstanceForResource(PP_Resource resource) { 29 PP_Instance GetInstanceForResource(PP_Resource resource) {
33 ::ppapi::Resource* obj = 30 ::ppapi::Resource* obj = ResourceTracker::Get()->GetResource(resource);
34 PpapiGlobals::Get()->GetResourceTracker()->GetResource(resource);
35 if (!obj) 31 if (!obj)
36 return 0; 32 return 0;
37 return obj->pp_instance(); 33 return obj->pp_instance();
38 } 34 }
39 35
40 void SetReserveInstanceIDCallback(PP_Module module, 36 void SetReserveInstanceIDCallback(PP_Module module,
41 PP_Bool (*reserve)(PP_Module, PP_Instance)) { 37 PP_Bool (*reserve)(PP_Module, PP_Instance)) {
42 PluginModule* plugin_module = 38 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
43 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
44 if (plugin_module) 39 if (plugin_module)
45 plugin_module->SetReserveInstanceIDCallback(reserve); 40 plugin_module->SetReserveInstanceIDCallback(reserve);
46 } 41 }
47 42
48 int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) { 43 int32_t GetURLLoaderBufferedBytes(PP_Resource url_loader) {
49 EnterResource<PPB_URLLoader_API> enter(url_loader, true); 44 EnterResource<PPB_URLLoader_API> enter(url_loader, true);
50 if (enter.succeeded()) 45 if (enter.succeeded())
51 return static_cast<PPB_URLLoader_Impl*>(enter.object())->buffer_size(); 46 return static_cast<PPB_URLLoader_Impl*>(enter.object())->buffer_size();
52 return 0; 47 return 0;
53 } 48 }
54 49
55 void AddRefModule(PP_Module module) { 50 void AddRefModule(PP_Module module) {
56 PluginModule* plugin_module = 51 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
57 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
58 if (plugin_module) 52 if (plugin_module)
59 plugin_module->AddRef(); 53 plugin_module->AddRef();
60 } 54 }
61 55
62 void ReleaseModule(PP_Module module) { 56 void ReleaseModule(PP_Module module) {
63 PluginModule* plugin_module = 57 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
64 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
65 if (plugin_module) 58 if (plugin_module)
66 plugin_module->Release(); 59 plugin_module->Release();
67 } 60 }
68 61
69 PP_Bool IsInModuleDestructor(PP_Module module) { 62 PP_Bool IsInModuleDestructor(PP_Module module) {
70 PluginModule* plugin_module = 63 PluginModule* plugin_module = ResourceTracker::Get()->GetModule(module);
71 HostGlobals::Get()->host_resource_tracker()->GetModule(module);
72 if (plugin_module) 64 if (plugin_module)
73 return PP_FromBool(plugin_module->is_in_destructor()); 65 return PP_FromBool(plugin_module->is_in_destructor());
74 return PP_FALSE; 66 return PP_FALSE;
75 } 67 }
76 68
77 const PPB_Proxy_Private ppb_proxy = { 69 const PPB_Proxy_Private ppb_proxy = {
78 &PluginCrashed, 70 &PluginCrashed,
79 &GetInstanceForResource, 71 &GetInstanceForResource,
80 &SetReserveInstanceIDCallback, 72 &SetReserveInstanceIDCallback,
81 &GetURLLoaderBufferedBytes, 73 &GetURLLoaderBufferedBytes,
82 &AddRefModule, 74 &AddRefModule,
83 &ReleaseModule, 75 &ReleaseModule,
84 &IsInModuleDestructor 76 &IsInModuleDestructor
85 }; 77 };
86 78
87 } // namespace 79 } // namespace
88 80
89 // static 81 // static
90 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() { 82 const PPB_Proxy_Private* PPB_Proxy_Impl::GetInterface() {
91 return &ppb_proxy; 83 return &ppb_proxy;
92 } 84 }
93 85
94 } // namespace ppapi 86 } // namespace ppapi
95 } // namespace webkit 87 } // 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