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

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

Issue 9034035: Make it possible to have 1 PpapiGlobals per thread. Update unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test. Cleanup. Move proxy lock to globals. 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
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/resource_tracker.h"
12 #include "ppapi/shared_impl/var_tracker.h" 12 #include "ppapi/shared_impl/var_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 HostGlobals(::ppapi::PpapiGlobals::ForTest);
25 virtual ~HostGlobals(); 26 virtual ~HostGlobals();
26 27
27 // Getter for the global singleton. Generally, you should use 28 // Getter for the global singleton. Generally, you should use
28 // PpapiGlobals::Get() when possible. Use this only when you need some 29 // PpapiGlobals::Get() when possible. Use this only when you need some
29 // host-specific functionality. 30 // host-specific functionality.
30 inline static HostGlobals* Get() { return host_globals_; } 31 inline static HostGlobals* Get() {
32 if (host_globals_)
33 return host_globals_;
34 return static_cast<HostGlobals*>(PpapiGlobals::Get());
35 }
31 36
32 // PpapiGlobals implementation. 37 // PpapiGlobals implementation.
33 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE; 38 virtual ::ppapi::ResourceTracker* GetResourceTracker() OVERRIDE;
34 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE; 39 virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE;
35 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance( 40 virtual ::ppapi::CallbackTracker* GetCallbackTrackerForInstance(
36 PP_Instance instance) OVERRIDE; 41 PP_Instance instance) OVERRIDE;
37 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI( 42 virtual ::ppapi::FunctionGroupBase* GetFunctionAPI(
38 PP_Instance inst, 43 PP_Instance inst,
39 ::ppapi::ApiID id) OVERRIDE; 44 ::ppapi::ApiID id) OVERRIDE;
40 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE; 45 virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 typedef std::map<PP_Module, PluginModule*> ModuleMap; 97 typedef std::map<PP_Module, PluginModule*> ModuleMap;
93 ModuleMap module_map_; 98 ModuleMap module_map_;
94 99
95 DISALLOW_COPY_AND_ASSIGN(HostGlobals); 100 DISALLOW_COPY_AND_ASSIGN(HostGlobals);
96 }; 101 };
97 102
98 } // namespace ppapi 103 } // namespace ppapi
99 } // namespace webkit 104 } // namespace webkit
100 105
101 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_ 106 #endif // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698