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

Side by Side Diff: ppapi/proxy/plugin_globals.h

Issue 9139054: Revert 117399 - Make it possible to have 1 PpapiGlobals per thread. Update unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | « ppapi/proxy/host_var_serialization_rules.cc ('k') | ppapi/proxy/plugin_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) 2012 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 PPAPI_PROXY_PLUGIN_GLOBALS_H_ 5 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_
6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_ 6 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/synchronization/lock.h"
10 #include "ppapi/proxy/plugin_resource_tracker.h" 9 #include "ppapi/proxy/plugin_resource_tracker.h"
11 #include "ppapi/proxy/plugin_var_tracker.h" 10 #include "ppapi/proxy/plugin_var_tracker.h"
12 #include "ppapi/proxy/ppapi_proxy_export.h" 11 #include "ppapi/proxy/ppapi_proxy_export.h"
13 #include "ppapi/shared_impl/callback_tracker.h" 12 #include "ppapi/shared_impl/callback_tracker.h"
14 #include "ppapi/shared_impl/ppapi_globals.h" 13 #include "ppapi/shared_impl/ppapi_globals.h"
15 14
16 namespace ppapi { 15 namespace ppapi {
17 namespace proxy { 16 namespace proxy {
18 17
19 class PluginProxyDelegate; 18 class PluginProxyDelegate;
20 19
21 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals { 20 class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
22 public: 21 public:
23 PluginGlobals(); 22 PluginGlobals();
24 PluginGlobals(PpapiGlobals::ForTest);
25 virtual ~PluginGlobals(); 23 virtual ~PluginGlobals();
26 24
27 // Getter for the global singleton. Generally, you should use 25 // Getter for the global singleton. Generally, you should use
28 // PpapiGlobals::Get() when possible. Use this only when you need some 26 // PpapiGlobals::Get() when possible. Use this only when you need some
29 // plugin-specific functionality. 27 // plugin-specific functionality.
30 inline static PluginGlobals* Get() { 28 inline static PluginGlobals* Get() { return plugin_globals_; }
31 DCHECK(PpapiGlobals::Get()->IsPluginGlobals());
32 return static_cast<PluginGlobals*>(PpapiGlobals::Get());
33 }
34 29
35 // PpapiGlobals implementation. 30 // PpapiGlobals implementation.
36 virtual ResourceTracker* GetResourceTracker() OVERRIDE; 31 virtual ResourceTracker* GetResourceTracker() OVERRIDE;
37 virtual VarTracker* GetVarTracker() OVERRIDE; 32 virtual VarTracker* GetVarTracker() OVERRIDE;
38 virtual CallbackTracker* GetCallbackTrackerForInstance( 33 virtual CallbackTracker* GetCallbackTrackerForInstance(
39 PP_Instance instance) OVERRIDE; 34 PP_Instance instance) OVERRIDE;
40 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst, 35 virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst,
41 ApiID id) OVERRIDE; 36 ApiID id) OVERRIDE;
42 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; 37 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
43 virtual base::Lock* GetProxyLock() OVERRIDE;
44 38
45 // Getters for the plugin-specific versions. 39 // Getters for the plugin-specific versions.
46 PluginResourceTracker* plugin_resource_tracker() { 40 PluginResourceTracker* plugin_resource_tracker() {
47 return &plugin_resource_tracker_; 41 return &plugin_resource_tracker_;
48 } 42 }
49 PluginVarTracker* plugin_var_tracker() { 43 PluginVarTracker* plugin_var_tracker() {
50 return &plugin_var_tracker_; 44 return &plugin_var_tracker_;
51 } 45 }
52 46
53 // The embedder should call set_proxy_delegate during startup. 47 // The embedder should call set_proxy_delegate during startup.
54 PluginProxyDelegate* plugin_proxy_delegate() { 48 PluginProxyDelegate* plugin_proxy_delegate() {
55 return plugin_proxy_delegate_; 49 return plugin_proxy_delegate_;
56 } 50 }
57 void set_plugin_proxy_delegate(PluginProxyDelegate* d) { 51 void set_plugin_proxy_delegate(PluginProxyDelegate* d) {
58 plugin_proxy_delegate_ = d; 52 plugin_proxy_delegate_ = d;
59 } 53 }
60 54
61 private: 55 private:
62 // PpapiGlobals overrides.
63 virtual bool IsPluginGlobals() const OVERRIDE;
64
65 static PluginGlobals* plugin_globals_; 56 static PluginGlobals* plugin_globals_;
66 57
67 PluginProxyDelegate* plugin_proxy_delegate_; 58 PluginProxyDelegate* plugin_proxy_delegate_;
68 PluginResourceTracker plugin_resource_tracker_; 59 PluginResourceTracker plugin_resource_tracker_;
69 PluginVarTracker plugin_var_tracker_; 60 PluginVarTracker plugin_var_tracker_;
70 scoped_refptr<CallbackTracker> callback_tracker_; 61 scoped_refptr<CallbackTracker> callback_tracker_;
71 base::Lock proxy_lock_;
72 62
73 DISALLOW_COPY_AND_ASSIGN(PluginGlobals); 63 DISALLOW_COPY_AND_ASSIGN(PluginGlobals);
74 }; 64 };
75 65
76 } // namespace proxy 66 } // namespace proxy
77 } // namespace ppapi 67 } // namespace ppapi
78 68
79 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_ 69 #endif // PPAPI_PROXY_PLUGIN_GLOBALS_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/host_var_serialization_rules.cc ('k') | ppapi/proxy/plugin_globals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698