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

Side by Side Diff: chrome/profiling/stack_storage.cc

Issue 2943733002: Add out-of-process memory logging stream parsing. (Closed)
Patch Set: Remove version Created 3 years, 6 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 2017 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 "chrome/profiling/stack_storage.h"
6
7 #include "chrome/profiling/stack.h"
8
9 namespace profiling {
10
11 StackStorage::StackStorage() {}
12
13 StackStorage::~StackStorage() {}
14
15 StackStorage::Key StackStorage::Insert(Stack&& stack) {
16 base::AutoLock lock(lock_);
17
18 StackStorage::Key key = stacks_.insert(std::move(stack)).first;
19 key->AddRef();
20 return key;
21 }
22
23 void StackStorage::Free(const Key& key) {
24 base::AutoLock lock(lock_);
25 if (!key->Release())
26 stacks_.erase(key);
Boris Vidolov 2017/06/17 03:13:15 I am wondering if we really need to release stacks
brettw 2017/06/19 23:29:46 I think freeing the stacks makes a big difference
27 }
28
29 void StackStorage::Free(const std::vector<Key>& keys) {
30 base::AutoLock lock(lock_);
31 for (size_t i = 0; i < keys.size(); i++) {
32 if (!keys[i]->Release())
33 stacks_.erase(keys[i]);
34 }
35 }
36
37 const Stack& StackStorage::GetStackForKey(const Key& key) const {
38 // Since the caller should own a reference to the key and the container has
39 // stable iterators, we can access without a lock.
40 return *key;
41 }
42
43 } // namespace profiling
OLDNEW
« chrome/profiling/stack_storage.h ('K') | « chrome/profiling/stack_storage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698