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

Side by Side Diff: ppapi/shared_impl/var_tracker.cc

Issue 12387073: Add PPB_VarDictionary_Dev support - part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 9 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/shared_impl/var.cc ('k') | ppapi/shared_impl/var_value_conversions.h » ('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) 2012 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 #include "ppapi/shared_impl/var_tracker.h" 5 #include "ppapi/shared_impl/var_tracker.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Basic refcount increment. 83 // Basic refcount increment.
84 info.ref_count++; 84 info.ref_count++;
85 return true; 85 return true;
86 } 86 }
87 87
88 bool VarTracker::AddRefVar(const PP_Var& var) { 88 bool VarTracker::AddRefVar(const PP_Var& var) {
89 DCHECK(CalledOnValidThread()); 89 DCHECK(CalledOnValidThread());
90 ProxyLock::AssertAcquired(); 90 ProxyLock::AssertAcquired();
91 91
92 if (!IsVarTypeRefcounted(var.type)) 92 if (!IsVarTypeRefcounted(var.type))
93 return false; 93 return true;
94 return AddRefVar(static_cast<int32>(var.value.as_id)); 94 return AddRefVar(static_cast<int32>(var.value.as_id));
95 } 95 }
96 96
97 bool VarTracker::ReleaseVar(int32 var_id) { 97 bool VarTracker::ReleaseVar(int32 var_id) {
98 DCHECK(CalledOnValidThread()); 98 DCHECK(CalledOnValidThread());
99 ProxyLock::AssertAcquired(); 99 ProxyLock::AssertAcquired();
100 100
101 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR)) 101 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
102 << var_id << " is not a PP_Var ID."; 102 << var_id << " is not a PP_Var ID.";
103 VarMap::iterator found = live_vars_.find(var_id); 103 VarMap::iterator found = live_vars_.find(var_id);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 bool VarTracker::DeleteObjectInfoIfNecessary(VarMap::iterator iter) { 242 bool VarTracker::DeleteObjectInfoIfNecessary(VarMap::iterator iter) {
243 if (iter->second.ref_count != 0 || 243 if (iter->second.ref_count != 0 ||
244 iter->second.track_with_no_reference_count != 0) 244 iter->second.track_with_no_reference_count != 0)
245 return false; // Object still alive. 245 return false; // Object still alive.
246 iter->second.var->ResetVarID(); 246 iter->second.var->ResetVarID();
247 live_vars_.erase(iter); 247 live_vars_.erase(iter);
248 return true; 248 return true;
249 } 249 }
250 250
251 } // namespace ppapi 251 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/var.cc ('k') | ppapi/shared_impl/var_value_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698