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

Side by Side Diff: webkit/plugins/ppapi/host_globals.h

Issue 9015009: Use the new callback tracker and delete the old one (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add IsPending Created 8 years, 11 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/file_callbacks.cc ('k') | webkit/plugins/ppapi/host_globals.cc » ('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 #ifndef WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
6 #define WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ 6 #define WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "ppapi/shared_impl/callback_tracker.h" 9 #include "ppapi/shared_impl/callback_tracker.h"
10 #include "ppapi/shared_impl/ppapi_globals.h" 10 #include "ppapi/shared_impl/ppapi_globals.h"
11 #include "ppapi/shared_impl/resource_tracker.h"
11 #include "ppapi/shared_impl/var_tracker.h" 12 #include "ppapi/shared_impl/var_tracker.h"
12 #include "webkit/plugins/ppapi/host_resource_tracker.h"
13 #include "webkit/plugins/ppapi/host_var_tracker.h" 13 #include "webkit/plugins/ppapi/host_var_tracker.h"
14 #include "webkit/plugins/webkit_plugins_export.h" 14 #include "webkit/plugins/webkit_plugins_export.h"
15 15
16 namespace webkit { 16 namespace webkit {
17 namespace ppapi { 17 namespace ppapi {
18 18
19 class PluginInstance; 19 class PluginInstance;
20 class PluginModule; 20 class PluginModule;
21 21
22 class HostGlobals : public ::ppapi::PpapiGlobals { 22 class HostGlobals : public ::ppapi::PpapiGlobals {
23 public: 23 public:
24 HostGlobals(); 24 HostGlobals();
25 virtual ~HostGlobals(); 25 virtual ~HostGlobals();
26 26
27 // Getter for the global singleton. Generally, you should use 27 // Getter for the global singleton. Generally, you should use
28 // PpapiGlobals::Get() when possible. Use this only when you need some 28 // PpapiGlobals::Get() when possible. Use this only when you need some
29 // host-specific functionality. 29 // host-specific functionality.
30 inline static HostGlobals* Get() { return host_globals_; } 30 inline static HostGlobals* Get() { return host_globals_; }
31 31
32 // PpapiGlobals implementation. 32 // PpapiGlobals implementation.
33 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; 33 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE;
34 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE; 34 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE;
35 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance( 35 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance(
36 PP_Instance instance) OVERRIDE; 36 PP_Instance instance) OVERRIDE;
37 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI( 37 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI(
38 PP_Instance inst, 38 PP_Instance inst,
39 ::ppapi::ApiID id) OVERRIDE; 39 ::ppapi::ApiID id) OVERRIDE;
40 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; 40 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
41 41
42 HostResourceTracker* host_resource_tracker() {
43 return &host_resource_tracker_;
44 }
45 HostVarTracker* host_var_tracker() { 42 HostVarTracker* host_var_tracker() {
46 return &host_var_tracker_; 43 return &host_var_tracker_;
47 } 44 }
48 45
49 // PP_Modules ---------------------------------------------------------------- 46 // PP_Modules ----------------------------------------------------------------
50 47
51 // Adds a new plugin module to the list of tracked module, and returns a new 48 // Adds a new plugin module to the list of tracked module, and returns a new
52 // module handle to identify it. 49 // module handle to identify it.
53 PP_Module AddModule(PluginModule* module); 50 PP_Module AddModule(PluginModule* module);
54 51
(...skipping 21 matching lines...) Expand all
76 // instance handle. The return value will be NULL if the handle is invalid or 73 // instance handle. The return value will be NULL if the handle is invalid or
77 // if the instance has crashed. 74 // if the instance has crashed.
78 WEBKIT_PLUGINS_EXPORT PluginInstance* GetInstance(PP_Instance instance); 75 WEBKIT_PLUGINS_EXPORT PluginInstance* GetInstance(PP_Instance instance);
79 76
80 private: 77 private:
81 // Per-instance data we track. 78 // Per-instance data we track.
82 struct InstanceData; 79 struct InstanceData;
83 80
84 WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_; 81 WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_;
85 82
86 HostResourceTracker host_resource_tracker_; 83 ::ppapi::ResourceTracker resource_tracker_;
87 HostVarTracker host_var_tracker_; 84 HostVarTracker host_var_tracker_;
88 85
89 // Tracks all live instances and their associated data. 86 // Tracks all live instances and their associated data.
90 typedef std::map<PP_Instance, linked_ptr<InstanceData> > InstanceMap; 87 typedef std::map<PP_Instance, linked_ptr<InstanceData> > InstanceMap;
91 InstanceMap instance_map_; 88 InstanceMap instance_map_;
92 89
93 // Tracks all live modules. The pointers are non-owning, the PluginModule 90 // Tracks all live modules. The pointers are non-owning, the PluginModule
94 // destructor will notify us when the module is deleted. 91 // destructor will notify us when the module is deleted.
95 typedef std::map<PP_Module, PluginModule*> ModuleMap; 92 typedef std::map<PP_Module, PluginModule*> ModuleMap;
96 ModuleMap module_map_; 93 ModuleMap module_map_;
97 94
98 DISALLOW_COPY_AND_ASSIGN(HostGlobals); 95 DISALLOW_COPY_AND_ASSIGN(HostGlobals);
99 }; 96 };
100 97
101 } // namespace ppapi 98 } // namespace ppapi
102 } // namespace webkit 99 } // namespace webkit
103 100
104 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ 101 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/file_callbacks.cc ('k') | webkit/plugins/ppapi/host_globals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698