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

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

Issue 20165002: Move webkit/plugins/ppapi to content/renderer/pepper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: more more clang fun Created 7 years, 5 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/host_array_buffer_var.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
(Empty)
1 // Copyright (c) 2012 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 #ifndef WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
6 #define WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
7
8 #include "base/compiler_specific.h"
9 #include "ppapi/shared_impl/callback_tracker.h"
10 #include "ppapi/shared_impl/ppapi_globals.h"
11 #include "ppapi/shared_impl/resource_tracker.h"
12 #include "ppapi/shared_impl/var_tracker.h"
13 #include "webkit/plugins/ppapi/host_var_tracker.h"
14 #include "webkit/plugins/webkit_plugins_export.h"
15
16 namespace webkit {
17 namespace ppapi {
18
19 class PluginInstanceImpl;
20 class PluginModule;
21
22 class HostGlobals : public ::ppapi::PpapiGlobals {
23 public:
24 HostGlobals();
25 explicit HostGlobals(::ppapi::PpapiGlobals::PerThreadForTest);
26 virtual ~HostGlobals();
27
28 // Getter for the global singleton. Generally, you should use
29 // PpapiGlobals::Get() when possible. Use this only when you need some
30 // host-specific functionality.
31 inline static HostGlobals* Get() {
32 DCHECK(PpapiGlobals::Get()->IsHostGlobals());
33 return static_cast<HostGlobals*>(PpapiGlobals::Get());
34 }
35
36 // PpapiGlobals implementation.
37 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE;
38 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE;
39 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance(
40 PP_Instance instance) OVERRIDE;
41 virtual ::ppapi::thunk::PPB_Instance_API* GetInstanceAPI(
42 PP_Instance instance) OVERRIDE;
43 virtual ::ppapi::thunk::ResourceCreationAPI* GetResourceCreationAPI(
44 PP_Instance instance) OVERRIDE;
45 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
46 virtual std::string GetCmdLine() OVERRIDE;
47 virtual void PreCacheFontForFlash(const void* logfontw) OVERRIDE;
48 virtual base::Lock* GetProxyLock() OVERRIDE;
49 virtual void LogWithSource(PP_Instance instance,
50 PP_LogLevel level,
51 const std::string& source,
52 const std::string& value) OVERRIDE;
53 virtual void BroadcastLogWithSource(PP_Module module,
54 PP_LogLevel level,
55 const std::string& source,
56 const std::string& value) OVERRIDE;
57 virtual ::ppapi::MessageLoopShared* GetCurrentMessageLoop() OVERRIDE;
58 virtual base::TaskRunner* GetFileTaskRunner(PP_Instance instance) OVERRIDE;
59
60 HostVarTracker* host_var_tracker() {
61 return &host_var_tracker_;
62 }
63
64 // PP_Modules ----------------------------------------------------------------
65
66 // Adds a new plugin module to the list of tracked module, and returns a new
67 // module handle to identify it.
68 PP_Module AddModule(PluginModule* module);
69
70 // Called when a plugin modulde was deleted and should no longer be tracked.
71 // The given handle should be one generated by AddModule.
72 void ModuleDeleted(PP_Module module);
73
74 // Returns a pointer to the plugin modulde object associated with the given
75 // modulde handle. The return value will be NULL if the handle is invalid.
76 PluginModule* GetModule(PP_Module module);
77
78 // PP_Instances --------------------------------------------------------------
79
80 // Adds a new plugin instance to the list of tracked instances, and returns a
81 // new instance handle to identify it.
82 PP_Instance AddInstance(PluginInstanceImpl* instance);
83
84 // Called when a plugin instance was deleted and should no longer be tracked.
85 // The given handle should be one generated by AddInstance.
86 void InstanceDeleted(PP_Instance instance);
87
88 void InstanceCrashed(PP_Instance instance);
89
90 // Returns a pointer to the plugin instance object associated with the given
91 // instance handle. The return value will be NULL if the handle is invalid or
92 // if the instance has crashed.
93 WEBKIT_PLUGINS_EXPORT PluginInstanceImpl* GetInstance(PP_Instance instance);
94
95 private:
96 // PpapiGlobals overrides.
97 virtual bool IsHostGlobals() const OVERRIDE;
98
99 WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_;
100
101 ::ppapi::ResourceTracker resource_tracker_;
102 HostVarTracker host_var_tracker_;
103
104 // Tracks all live instances and their associated object.
105 typedef std::map<PP_Instance, PluginInstanceImpl*> InstanceMap;
106 InstanceMap instance_map_;
107
108 // Tracks all live modules. The pointers are non-owning, the PluginModule
109 // destructor will notify us when the module is deleted.
110 typedef std::map<PP_Module, PluginModule*> ModuleMap;
111 ModuleMap module_map_;
112
113 DISALLOW_COPY_AND_ASSIGN(HostGlobals);
114 };
115
116 } // namespace ppapi
117 } // namespace webkit
118
119 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/host_array_buffer_var.cc ('k') | webkit/plugins/ppapi/host_globals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698