summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/plugin_globals.h
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-12 08:15:39 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-12 08:15:39 +0000
commit2916256f6eac115c39af90cdf391b52419f8cb7c (patch)
tree4c87ce1e40f26e271766502a29d37a22ce83f89f /ppapi/proxy/plugin_globals.h
parent3442a664129c54f09ec39ece7bfad7750aca1128 (diff)
downloadchromium_src-2916256f6eac115c39af90cdf391b52419f8cb7c.zip
chromium_src-2916256f6eac115c39af90cdf391b52419f8cb7c.tar.gz
chromium_src-2916256f6eac115c39af90cdf391b52419f8cb7c.tar.bz2
Make it possible to have 1 PpapiGlobals per thread. Update unit tests.
This allows us to distinguish trackers in the unit tests, instead of all vars/resources going in 1 tracker. This should also allow us to unit-test PPB proxies. BUG= TEST= Review URL: http://codereview.chromium.org/9034035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117399 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/plugin_globals.h')
-rw-r--r--ppapi/proxy/plugin_globals.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h
index ffcf01e..0b47616 100644
--- a/ppapi/proxy/plugin_globals.h
+++ b/ppapi/proxy/plugin_globals.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#define PPAPI_PROXY_PLUGIN_GLOBALS_H_
#include "base/compiler_specific.h"
+#include "base/synchronization/lock.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/plugin_var_tracker.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
@@ -20,12 +21,16 @@ class PluginProxyDelegate;
class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
public:
PluginGlobals();
+ PluginGlobals(PpapiGlobals::ForTest);
virtual ~PluginGlobals();
// Getter for the global singleton. Generally, you should use
// PpapiGlobals::Get() when possible. Use this only when you need some
// plugin-specific functionality.
- inline static PluginGlobals* Get() { return plugin_globals_; }
+ inline static PluginGlobals* Get() {
+ DCHECK(PpapiGlobals::Get()->IsPluginGlobals());
+ return static_cast<PluginGlobals*>(PpapiGlobals::Get());
+ }
// PpapiGlobals implementation.
virtual ResourceTracker* GetResourceTracker() OVERRIDE;
@@ -35,6 +40,7 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst,
ApiID id) OVERRIDE;
virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
+ virtual base::Lock* GetProxyLock() OVERRIDE;
// Getters for the plugin-specific versions.
PluginResourceTracker* plugin_resource_tracker() {
@@ -53,12 +59,16 @@ class PPAPI_PROXY_EXPORT PluginGlobals : public PpapiGlobals {
}
private:
+ // PpapiGlobals overrides.
+ virtual bool IsPluginGlobals() const OVERRIDE;
+
static PluginGlobals* plugin_globals_;
PluginProxyDelegate* plugin_proxy_delegate_;
PluginResourceTracker plugin_resource_tracker_;
PluginVarTracker plugin_var_tracker_;
scoped_refptr<CallbackTracker> callback_tracker_;
+ base::Lock proxy_lock_;
DISALLOW_COPY_AND_ASSIGN(PluginGlobals);
};