summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 22:51:01 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 22:51:01 +0000
commit2f59e3827f5bf5dc1cad0a0a393feef965abc6bc (patch)
tree156a9acb7570a78e31256f03726bd0b8984c8f3e /ppapi/shared_impl
parent7969c78bba2a31c8b50f4e19e497bf81694f6388 (diff)
downloadchromium_src-2f59e3827f5bf5dc1cad0a0a393feef965abc6bc.zip
chromium_src-2f59e3827f5bf5dc1cad0a0a393feef965abc6bc.tar.gz
chromium_src-2f59e3827f5bf5dc1cad0a0a393feef965abc6bc.tar.bz2
Remove TrackerBase.
Fold the methods it provided into the PpapiGlobals base class. Move the instance and module tracking in the webkit/plugins/ppapi dir out of the HostResourceTracker (since it has nothing to do with resources) and into the HostGlobals object (which provides general global object tracking). TEST=none BUG=none Review URL: http://codereview.chromium.org/8335001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106612 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r--ppapi/shared_impl/file_ref_impl.cc6
-rw-r--r--ppapi/shared_impl/input_event_impl.cc4
-rw-r--r--ppapi/shared_impl/ppapi_globals.h14
-rw-r--r--ppapi/shared_impl/resource_tracker_unittest.cc24
-rw-r--r--ppapi/shared_impl/test_globals.cc9
-rw-r--r--ppapi/shared_impl/test_globals.h3
-rw-r--r--ppapi/shared_impl/tracker_base.cc23
-rw-r--r--ppapi/shared_impl/tracker_base.h54
-rw-r--r--ppapi/shared_impl/url_util_impl.cc1
9 files changed, 32 insertions, 106 deletions
diff --git a/ppapi/shared_impl/file_ref_impl.cc b/ppapi/shared_impl/file_ref_impl.cc
index 1eae27b..274d944 100644
--- a/ppapi/shared_impl/file_ref_impl.cc
+++ b/ppapi/shared_impl/file_ref_impl.cc
@@ -5,7 +5,7 @@
#include "ppapi/shared_impl/file_ref_impl.h"
#include "base/logging.h"
-#include "ppapi/shared_impl/tracker_base.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/var.h"
namespace ppapi {
@@ -41,7 +41,7 @@ PP_FileSystemType FileRefImpl::GetFileSystemType() const {
PP_Var FileRefImpl::GetName() const {
if (!name_var_.get()) {
name_var_ = new StringVar(
- TrackerBase::Get()->GetModuleForInstance(pp_instance()),
+ PpapiGlobals::Get()->GetModuleForInstance(pp_instance()),
create_info_.name);
}
return name_var_->GetPPVar();
@@ -52,7 +52,7 @@ PP_Var FileRefImpl::GetPath() const {
return PP_MakeUndefined();
if (!path_var_.get()) {
path_var_ = new StringVar(
- TrackerBase::Get()->GetModuleForInstance(pp_instance()),
+ PpapiGlobals::Get()->GetModuleForInstance(pp_instance()),
create_info_.path);
}
return path_var_->GetPPVar();
diff --git a/ppapi/shared_impl/input_event_impl.cc b/ppapi/shared_impl/input_event_impl.cc
index d0ca57c..d502a62 100644
--- a/ppapi/shared_impl/input_event_impl.cc
+++ b/ppapi/shared_impl/input_event_impl.cc
@@ -4,7 +4,7 @@
#include "ppapi/shared_impl/input_event_impl.h"
-#include "ppapi/shared_impl/tracker_base.h"
+#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/var.h"
using ppapi::thunk::PPB_InputEvent_API;
@@ -101,7 +101,7 @@ uint32_t InputEventImpl::GetKeyCode() {
PP_Var InputEventImpl::GetCharacterText() {
return StringVar::StringToPPVar(
- TrackerBase::Get()->GetModuleForInstance(pp_instance()),
+ PpapiGlobals::Get()->GetModuleForInstance(pp_instance()),
data_.character_text);
}
diff --git a/ppapi/shared_impl/ppapi_globals.h b/ppapi/shared_impl/ppapi_globals.h
index d0936ee..db91f72 100644
--- a/ppapi/shared_impl/ppapi_globals.h
+++ b/ppapi/shared_impl/ppapi_globals.h
@@ -6,10 +6,14 @@
#define PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_
#include "base/basictypes.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/proxy/interface_id.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
namespace ppapi {
+class FunctionGroupBase;
class ResourceTracker;
class VarTracker;
@@ -22,9 +26,19 @@ class PPAPI_SHARED_EXPORT PpapiGlobals {
// Getter for the global singleton.
inline static PpapiGlobals* Get() { return ppapi_globals_; }
+ // Retrieves the corresponding tracker.
virtual ResourceTracker* GetResourceTracker() = 0;
virtual VarTracker* GetVarTracker() = 0;
+ // Returns the function object corresponding to the given ID, or NULL if
+ // there isn't one.
+ virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst,
+ proxy::InterfaceID id) = 0;
+
+ // Returns the PP_Module associated with the given PP_Instance, or 0 on
+ // failure.
+ virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0;
+
private:
static PpapiGlobals* ppapi_globals_;
diff --git a/ppapi/shared_impl/resource_tracker_unittest.cc b/ppapi/shared_impl/resource_tracker_unittest.cc
index 2e22d6a..a77dc78 100644
--- a/ppapi/shared_impl/resource_tracker_unittest.cc
+++ b/ppapi/shared_impl/resource_tracker_unittest.cc
@@ -8,7 +8,6 @@
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/resource_tracker.h"
#include "ppapi/shared_impl/test_globals.h"
-#include "ppapi/shared_impl/tracker_base.h"
namespace ppapi {
@@ -37,40 +36,19 @@ class MyMockResource : public Resource {
}
};
-// Global singleton used by the TrackerBase.
-TrackerBase* my_tracker_base = NULL;
-TrackerBase* GetMyTrackerBase() {
- return my_tracker_base;
-}
-
} // namespace
-class ResourceTrackerTest : public testing::Test, public TrackerBase {
+class ResourceTrackerTest : public testing::Test {
public:
ResourceTrackerTest() {}
// Test implementation.
virtual void SetUp() OVERRIDE {
- my_tracker_base = this;
- TrackerBase::Init(&GetMyTrackerBase);
-
ASSERT_EQ(0, mock_resource_alive_count);
last_plugin_ref_was_deleted_count = 0;
instance_was_deleted_count = 0;
}
virtual void TearDown() OVERRIDE {
- my_tracker_base = NULL;
- TrackerBase::Init(NULL);
- }
-
- // TrackerBase implementation.
- virtual FunctionGroupBase* GetFunctionAPI(
- PP_Instance inst,
- ppapi::proxy::InterfaceID id) OVERRIDE {
- return NULL;
- }
- virtual PP_Module GetModuleForInstance(PP_Instance /* instance */) OVERRIDE {
- return 0;
}
ResourceTracker& resource_tracker() { return *globals_.GetResourceTracker(); }
diff --git a/ppapi/shared_impl/test_globals.cc b/ppapi/shared_impl/test_globals.cc
index 17ac224..8813748 100644
--- a/ppapi/shared_impl/test_globals.cc
+++ b/ppapi/shared_impl/test_globals.cc
@@ -20,4 +20,13 @@ VarTracker* TestGlobals::GetVarTracker() {
return &var_tracker_;
}
+FunctionGroupBase* TestGlobals::GetFunctionAPI(PP_Instance inst,
+ proxy::InterfaceID id) {
+ return NULL;
+}
+
+PP_Module TestGlobals::GetModuleForInstance(PP_Instance instance) {
+ return 0;
+}
+
} // namespace ppapi
diff --git a/ppapi/shared_impl/test_globals.h b/ppapi/shared_impl/test_globals.h
index c2062b7..d475363 100644
--- a/ppapi/shared_impl/test_globals.h
+++ b/ppapi/shared_impl/test_globals.h
@@ -22,6 +22,9 @@ class TestGlobals : public PpapiGlobals {
// PpapiGlobals implementation.
virtual ResourceTracker* GetResourceTracker() OVERRIDE;
virtual VarTracker* GetVarTracker() OVERRIDE;
+ virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst,
+ proxy::InterfaceID id) OVERRIDE;
+ virtual PP_Module GetModuleForInstance(PP_Instance instance) OVERRIDE;
private:
ResourceTracker resource_tracker_;
diff --git a/ppapi/shared_impl/tracker_base.cc b/ppapi/shared_impl/tracker_base.cc
deleted file mode 100644
index 291bc18..0000000
--- a/ppapi/shared_impl/tracker_base.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "ppapi/shared_impl/tracker_base.h"
-
-#include "base/logging.h"
-
-namespace ppapi {
-
-static TrackerBase* (*g_global_getter)() = NULL;
-
-// static
-void TrackerBase::Init(TrackerBase* (*getter)()) {
- g_global_getter = getter;
-}
-
-// static
-TrackerBase* TrackerBase::Get() {
- return g_global_getter();
-}
-
-} // namespace ppapi
diff --git a/ppapi/shared_impl/tracker_base.h b/ppapi/shared_impl/tracker_base.h
deleted file mode 100644
index 940cef4..0000000
--- a/ppapi/shared_impl/tracker_base.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2011 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.
-
-#ifndef PPAPI_SHARED_IMPL_TRACKER_BASE_H_
-#define PPAPI_SHARED_IMPL_TRACKER_BASE_H_
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/pp_resource.h"
-#include "ppapi/proxy/interface_id.h"
-#include "ppapi/shared_impl/ppapi_shared_export.h"
-
-namespace ppapi {
-
-class FunctionGroupBase;
-class ResourceTracker;
-class VarTracker;
-
-// Tracks resource and function APIs, providing a mapping between ID and
-// object.
-// TODO(brettw) Eventually this should be one object with global tracking and
-// called "Tracker", and this would be used in both the plugin side of the
-// proxy as well as the implementation in the renderer. Currently, all this
-// does is forward to the process-type-specific tracker to get the information.
-// TODO(fischman/vrk): When brettw fixes the TODO above, fix the ugliness in
-// VideoDecoderImpl accordingly.
-class PPAPI_SHARED_EXPORT TrackerBase {
- public:
- // Must be called before any other function that uses the TrackerBase.
- // This sets the getter that returns the global implmenetation of
- // TrackerBase. It will be different for in the renderer and in the plugin
- // process.
- static void Init(TrackerBase*(*getter)());
-
- // Retrieves the global tracker. This will be NULL if you haven't called
- // Init() first (it should be unnecessary to NULL-check this).
- static TrackerBase* Get();
-
- // Returns the function object corresponding to the given ID, or NULL if
- // there isn't one.
- virtual FunctionGroupBase* GetFunctionAPI(PP_Instance inst,
- proxy::InterfaceID id) = 0;
-
- // Returns the PP_Module associated with the given PP_Instance, or 0 on
- // failure.
- virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0;
-};
-
-} // namespace ppapi
-
-#endif // PPAPI_SHARED_IMPL_TRACKER_BASE_H_
diff --git a/ppapi/shared_impl/url_util_impl.cc b/ppapi/shared_impl/url_util_impl.cc
index d295fd7..fdccdb6 100644
--- a/ppapi/shared_impl/url_util_impl.cc
+++ b/ppapi/shared_impl/url_util_impl.cc
@@ -6,7 +6,6 @@
#include "googleurl/src/gurl.h"
#include "ppapi/shared_impl/ppapi_globals.h"
-#include "ppapi/shared_impl/tracker_base.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/shared_impl/var_tracker.h"