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

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

Issue 10227009: NOTREACHED() in VarTracker::ReleaseVar() can be reached. Remove it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | « no previous file | no next file » | 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 return false; 87 return false;
88 return AddRefVar(static_cast<int32>(var.value.as_id)); 88 return AddRefVar(static_cast<int32>(var.value.as_id));
89 } 89 }
90 90
91 bool VarTracker::ReleaseVar(int32 var_id) { 91 bool VarTracker::ReleaseVar(int32 var_id) {
92 DCHECK(CalledOnValidThread()); 92 DCHECK(CalledOnValidThread());
93 93
94 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR)) 94 DLOG_IF(ERROR, !CheckIdType(var_id, PP_ID_TYPE_VAR))
95 << var_id << " is not a PP_Var ID."; 95 << var_id << " is not a PP_Var ID.";
96 VarMap::iterator found = live_vars_.find(var_id); 96 VarMap::iterator found = live_vars_.find(var_id);
97 if (found == live_vars_.end()) { 97 if (found == live_vars_.end())
98 NOTREACHED() << "Unref-ing an invalid var";
99 return false; 98 return false;
100 }
101 99
102 VarInfo& info = found->second; 100 VarInfo& info = found->second;
103 if (info.ref_count == 0) { 101 if (info.ref_count == 0) {
104 NOTREACHED() << "Releasing an object with zero ref"; 102 NOTREACHED() << "Releasing an object with zero ref";
105 return false; 103 return false;
106 } 104 }
107 info.ref_count--; 105 info.ref_count--;
108 106
109 if (info.ref_count == 0) { 107 if (info.ref_count == 0) {
110 if (info.var->GetType() == PP_VARTYPE_OBJECT) { 108 if (info.var->GetType() == PP_VARTYPE_OBJECT) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 bool VarTracker::DeleteObjectInfoIfNecessary(VarMap::iterator iter) { 220 bool VarTracker::DeleteObjectInfoIfNecessary(VarMap::iterator iter) {
223 if (iter->second.ref_count != 0 || 221 if (iter->second.ref_count != 0 ||
224 iter->second.track_with_no_reference_count != 0) 222 iter->second.track_with_no_reference_count != 0)
225 return false; // Object still alive. 223 return false; // Object still alive.
226 iter->second.var->ResetVarID(); 224 iter->second.var->ResetVarID();
227 live_vars_.erase(iter); 225 live_vars_.erase(iter);
228 return true; 226 return true;
229 } 227 }
230 228
231 } // namespace ppapi 229 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698