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

Side by Side Diff: base/debug/profiler.cc

Issue 2013723004: Fix a couple of pointer DCHECKs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« 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 "base/debug/profiler.h" 5 #include "base/debug/profiler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/debug/debugging_flags.h" 9 #include "base/debug/debugging_flags.h"
10 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 }; 147 };
148 148
149 // Callback function to PEImage::EnumImportChunks. 149 // Callback function to PEImage::EnumImportChunks.
150 bool FindResolutionFunctionInImports( 150 bool FindResolutionFunctionInImports(
151 const base::win::PEImage &image, const char* module_name, 151 const base::win::PEImage &image, const char* module_name,
152 PIMAGE_THUNK_DATA unused_name_table, PIMAGE_THUNK_DATA import_address_table, 152 PIMAGE_THUNK_DATA unused_name_table, PIMAGE_THUNK_DATA import_address_table,
153 PVOID cookie) { 153 PVOID cookie) {
154 FunctionSearchContext* context = 154 FunctionSearchContext* context =
155 reinterpret_cast<FunctionSearchContext*>(cookie); 155 reinterpret_cast<FunctionSearchContext*>(cookie);
156 156
157 DCHECK_NE(nullptr, context); 157 DCHECK(context);
158 DCHECK_EQ(nullptr, context->function); 158 DCHECK(!context->function);
159 159
160 // Our import address table contains pointers to the functions we import 160 // Our import address table contains pointers to the functions we import
161 // at this point. Let's retrieve the first such function and use it to 161 // at this point. Let's retrieve the first such function and use it to
162 // find the module this import was resolved to by the loader. 162 // find the module this import was resolved to by the loader.
163 const wchar_t* function_in_module = 163 const wchar_t* function_in_module =
164 reinterpret_cast<const wchar_t*>(import_address_table->u1.Function); 164 reinterpret_cast<const wchar_t*>(import_address_table->u1.Function);
165 165
166 // Retrieve the module by a function in the module. 166 // Retrieve the module by a function in the module.
167 const DWORD kFlags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 167 const DWORD kFlags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
168 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT; 168 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 MoveDynamicSymbol GetProfilerMoveDynamicSymbolFunc() { 217 MoveDynamicSymbol GetProfilerMoveDynamicSymbolFunc() {
218 return FindFunctionInImports<MoveDynamicSymbol>( 218 return FindFunctionInImports<MoveDynamicSymbol>(
219 "MoveDynamicSymbol"); 219 "MoveDynamicSymbol");
220 } 220 }
221 221
222 #endif // defined(OS_WIN) 222 #endif // defined(OS_WIN)
223 223
224 } // namespace debug 224 } // namespace debug
225 } // namespace base 225 } // namespace base
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