Reland 9034035: Make it possible to have 1 PpapiGlobals per thread.
Original CL: r117399, http://codereview.chromium.org/9034035/
Reverted in r117414, http://codereview.chromium.org/9139054/ due to a static initializer.
This is the same as r117399 except using a LazyInstance to eliminate the static initializer.
BUG=
TEST=
[email protected]
Review URL: http://codereview.chromium.org/9187055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117475 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/shared_impl/var_tracker.cc b/ppapi/shared_impl/var_tracker.cc
index 58c715c..0b70349 100644
--- a/ppapi/shared_impl/var_tracker.cc
+++ b/ppapi/shared_impl/var_tracker.cc
@@ -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.
@@ -129,6 +129,21 @@
return live_vars_.find(id);
}
+int VarTracker::GetRefCountForObject(const PP_Var& plugin_object) {
+ VarMap::iterator found = GetLiveVar(plugin_object);
+ if (found == live_vars_.end())
+ return -1;
+ return found->second.ref_count;
+}
+
+int VarTracker::GetTrackedWithNoReferenceCountForObject(
+ const PP_Var& plugin_object) {
+ VarMap::iterator found = GetLiveVar(plugin_object);
+ if (found == live_vars_.end())
+ return -1;
+ return found->second.track_with_no_reference_count;
+}
+
VarTracker::VarMap::iterator VarTracker::GetLiveVar(const PP_Var& var) {
return live_vars_.find(static_cast<int32>(var.value.as_id));
}