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

Side by Side Diff: base/scoped_variant_win.cc

Issue 47007: Fixing problem with ScopedVariant in official builds. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « base/scoped_variant_win.h ('k') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/scoped_variant_win.h" 5 #include "base/scoped_variant_win.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 7
8 // Global, const instance of an empty variant. 8 // Global, const instance of an empty variant.
9 const VARIANT ScopedVariant::kEmptyVariant = { VT_EMPTY }; 9 const VARIANT ScopedVariant::kEmptyVariant = { VT_EMPTY };
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 DCHECK(!IsLeakableVarType(var_.vt)) << "leaking variant: " << var_.vt; 180 DCHECK(!IsLeakableVarType(var_.vt)) << "leaking variant: " << var_.vt;
181 if (SUCCEEDED(::SafeArrayGetVartype(array, &var_.vt))) { 181 if (SUCCEEDED(::SafeArrayGetVartype(array, &var_.vt))) {
182 var_.vt |= VT_ARRAY; 182 var_.vt |= VT_ARRAY;
183 var_.parray = array; 183 var_.parray = array;
184 } else { 184 } else {
185 DCHECK(array == NULL) << "Unable to determine safearray vartype"; 185 DCHECK(array == NULL) << "Unable to determine safearray vartype";
186 var_.vt = VT_EMPTY; 186 var_.vt = VT_EMPTY;
187 } 187 }
188 } 188 }
189 189
190 #ifndef OFFICIAL_BUILD
191 bool ScopedVariant::IsLeakableVarType(VARTYPE vt) { 190 bool ScopedVariant::IsLeakableVarType(VARTYPE vt) {
192 bool leakable = false; 191 bool leakable = false;
193 switch (vt & VT_TYPEMASK) { 192 switch (vt & VT_TYPEMASK) {
194 case VT_BSTR: 193 case VT_BSTR:
195 case VT_DISPATCH: 194 case VT_DISPATCH:
196 // we treat VT_VARIANT as leakable to err on the safe side. 195 // we treat VT_VARIANT as leakable to err on the safe side.
197 case VT_VARIANT: 196 case VT_VARIANT:
198 case VT_UNKNOWN: 197 case VT_UNKNOWN:
199 case VT_SAFEARRAY: 198 case VT_SAFEARRAY:
200 199
(...skipping 19 matching lines...) Expand all
220 leakable = true; 219 leakable = true;
221 break; 220 break;
222 } 221 }
223 222
224 if (!leakable && (vt & VT_ARRAY) != 0) { 223 if (!leakable && (vt & VT_ARRAY) != 0) {
225 leakable = true; 224 leakable = true;
226 } 225 }
227 226
228 return leakable; 227 return leakable;
229 } 228 }
230 #endif
OLDNEW
« no previous file with comments | « base/scoped_variant_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698