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

Side by Side Diff: third_party/tcmalloc/chromium/src/malloc_hook-inl.h

Issue 7430007: Merge tcmalloc r111 (perftools v. 1.8) with the chromium/ branch. Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2005, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 extern AtomicPtr<MallocHook::PreSbrkHook> presbrk_hook_; 97 extern AtomicPtr<MallocHook::PreSbrkHook> presbrk_hook_;
98 extern AtomicPtr<MallocHook::SbrkHook> sbrk_hook_; 98 extern AtomicPtr<MallocHook::SbrkHook> sbrk_hook_;
99 // End DEPRECATED code. 99 // End DEPRECATED code.
100 100
101 // Maximum of 7 hooks means that HookList is 8 words. 101 // Maximum of 7 hooks means that HookList is 8 words.
102 static const int kHookListMaxValues = 7; 102 static const int kHookListMaxValues = 7;
103 103
104 // HookList: a class that provides synchronized insertions and removals and 104 // HookList: a class that provides synchronized insertions and removals and
105 // lockless traversal. Most of the implementation is in malloc_hook.cc. 105 // lockless traversal. Most of the implementation is in malloc_hook.cc.
106 template <typename T> 106 template <typename T>
107 struct HookList { 107 struct PERFTOOLS_DLL_DECL HookList {
108 COMPILE_ASSERT(sizeof(T) <= sizeof(AtomicWord), T_should_fit_in_AtomicWord); 108 COMPILE_ASSERT(sizeof(T) <= sizeof(AtomicWord), T_should_fit_in_AtomicWord);
109 109
110 // Adds value to the list. Note that duplicates are allowed. Thread-safe and 110 // Adds value to the list. Note that duplicates are allowed. Thread-safe and
111 // blocking (acquires hooklist_spinlock). Returns true on success; false 111 // blocking (acquires hooklist_spinlock). Returns true on success; false
112 // otherwise (failures include invalid value and no space left). 112 // otherwise (failures include invalid value and no space left).
113 bool Add(T value); 113 bool Add(T value);
114 114
115 // Removes the first entry matching value from the list. Thread-safe and 115 // Removes the first entry matching value from the list. Thread-safe and
116 // blocking (acquires hooklist_spinlock). Returns true on success; false 116 // blocking (acquires hooklist_spinlock). Returns true on success; false
117 // otherwise (failures include invalid value and no value found). 117 // otherwise (failures include invalid value and no value found).
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (!base::internal::sbrk_hooks_.empty() && increment != 0) { 313 if (!base::internal::sbrk_hooks_.empty() && increment != 0) {
314 InvokeSbrkHookSlow(result, increment); 314 InvokeSbrkHookSlow(result, increment);
315 } 315 }
316 // The following code is DEPRECATED. 316 // The following code is DEPRECATED.
317 MallocHook::SbrkHook hook = MallocHook::GetSbrkHook(); 317 MallocHook::SbrkHook hook = MallocHook::GetSbrkHook();
318 if (hook != NULL && increment != 0) (*hook)(result, increment); 318 if (hook != NULL && increment != 0) (*hook)(result, increment);
319 // End DEPRECATED code. 319 // End DEPRECATED code.
320 } 320 }
321 321
322 #endif /* _MALLOC_HOOK_INL_H_ */ 322 #endif /* _MALLOC_HOOK_INL_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698