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

Side by Side Diff: third_party/tcmalloc/chromium/src/spin_lock_wrapper.cc

Issue 986503002: components/metrics: Add runtime memory leak detector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create CallStackManager out of LeakDetectorImpl Created 5 years, 3 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <gperftools/spin_lock_wrapper.h>
6
7 #include <new>
8
9 #include "base/logging.h"
10 #include "base/spinlock.h"
11 #include <gperftools/custom_allocator.h>
12
13 SpinLockWrapper::SpinLockWrapper() {
14 CHECK(CustomAllocator::IsInitialized());
15 lock_ = new(CustomAllocator::Allocate(sizeof(SpinLock))) SpinLock;
16 }
17
18 SpinLockWrapper::~SpinLockWrapper() {
19 lock_->~SpinLock();
20 CustomAllocator::Free(lock_, sizeof(*lock_));
21 lock_ = nullptr;
22 }
23
24 void SpinLockWrapper::Lock() {
25 lock_->Lock();
26 }
27
28 void SpinLockWrapper::Unlock() {
29 lock_->Unlock();
30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698