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

Side by Side Diff: tools/memory_watcher/call_stack.cc

Issue 6265018: Fix base:: namespace for Lock. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | tools/memory_watcher/memory_hook.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "tools/memory_watcher/call_stack.h" 5 #include "tools/memory_watcher/call_stack.h"
6 6
7 #include <shlwapi.h> 7 #include <shlwapi.h>
8 #include <tlhelp32.h> 8 #include <tlhelp32.h>
9 9
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 17 matching lines...) Expand all
28 typedef BOOL (__stdcall *t_SymInitialize)(HANDLE, PCTSTR, BOOL); 28 typedef BOOL (__stdcall *t_SymInitialize)(HANDLE, PCTSTR, BOOL);
29 typedef DWORD (__stdcall *t_SymGetOptions)(void); 29 typedef DWORD (__stdcall *t_SymGetOptions)(void);
30 typedef DWORD (__stdcall *t_SymSetOptions)(DWORD); 30 typedef DWORD (__stdcall *t_SymSetOptions)(DWORD);
31 typedef BOOL (__stdcall *t_SymGetSearchPath)(HANDLE, PTSTR, DWORD); 31 typedef BOOL (__stdcall *t_SymGetSearchPath)(HANDLE, PTSTR, DWORD);
32 typedef DWORD64 (__stdcall *t_SymLoadModule64)(HANDLE, HANDLE, PCSTR, 32 typedef DWORD64 (__stdcall *t_SymLoadModule64)(HANDLE, HANDLE, PCSTR,
33 PCSTR, DWORD64, DWORD); 33 PCSTR, DWORD64, DWORD);
34 typedef BOOL (__stdcall *t_SymGetModuleInfo64)(HANDLE, DWORD64, 34 typedef BOOL (__stdcall *t_SymGetModuleInfo64)(HANDLE, DWORD64,
35 PIMAGEHLP_MODULE64); 35 PIMAGEHLP_MODULE64);
36 36
37 // static 37 // static
38 Lock CallStack::dbghelp_lock_; 38 base:Lock CallStack::dbghelp_lock_;
39 // static 39 // static
40 bool CallStack::dbghelp_loaded_ = false; 40 bool CallStack::dbghelp_loaded_ = false;
41 // static 41 // static
42 DWORD CallStack::active_thread_id_ = 0; 42 DWORD CallStack::active_thread_id_ = 0;
43 43
44 44
45 static t_StackWalk64 pStackWalk64 = NULL; 45 static t_StackWalk64 pStackWalk64 = NULL;
46 static t_SymCleanup pSymCleanup = NULL; 46 static t_SymCleanup pSymCleanup = NULL;
47 static t_SymGetSymFromAddr64 pSymGetSymFromAddr64 = NULL; 47 static t_SymGetSymFromAddr64 pSymGetSymFromAddr64 = NULL;
48 static t_SymFunctionTableAccess64 pSymFunctionTableAccess64 = NULL; 48 static t_SymFunctionTableAccess64 pSymFunctionTableAccess64 = NULL;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 } 367 }
368 368
369 (*symbol_cache_)[intruction_pointer] = line; 369 (*symbol_cache_)[intruction_pointer] = line;
370 *output += line; 370 *output += line;
371 } 371 }
372 *output += "==================\n"; 372 *output += "==================\n";
373 } 373 }
374 374
375 375
376 Lock AllocationStack::freelist_lock_; 376 base::Lock AllocationStack::freelist_lock_;
377 AllocationStack* AllocationStack::freelist_ = NULL; 377 AllocationStack* AllocationStack::freelist_ = NULL;
378 378
379 void* AllocationStack::operator new(size_t size) { 379 void* AllocationStack::operator new(size_t size) {
380 DCHECK(size == sizeof(AllocationStack)); 380 DCHECK(size == sizeof(AllocationStack));
381 { 381 {
382 base::AutoLock lock(freelist_lock_); 382 base::AutoLock lock(freelist_lock_);
383 if (freelist_ != NULL) { 383 if (freelist_ != NULL) {
384 AllocationStack* stack = freelist_; 384 AllocationStack* stack = freelist_;
385 freelist_ = freelist_->next_; 385 freelist_ = freelist_->next_;
386 stack->next_ = NULL; 386 stack->next_ = NULL;
387 return stack; 387 return stack;
388 } 388 }
389 } 389 }
390 return MemoryHook::Alloc(size); 390 return MemoryHook::Alloc(size);
391 } 391 }
392 392
393 void AllocationStack::operator delete(void* ptr) { 393 void AllocationStack::operator delete(void* ptr) {
394 AllocationStack *stack = reinterpret_cast<AllocationStack*>(ptr); 394 AllocationStack *stack = reinterpret_cast<AllocationStack*>(ptr);
395 base::AutoLock lock(freelist_lock_); 395 base::AutoLock lock(freelist_lock_);
396 DCHECK(stack->next_ == NULL); 396 DCHECK(stack->next_ == NULL);
397 stack->next_ = freelist_; 397 stack->next_ = freelist_;
398 freelist_ = stack; 398 freelist_ = stack;
399 } 399 }
OLDNEW
« no previous file with comments | « no previous file | tools/memory_watcher/memory_hook.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698