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

Side by Side Diff: chrome/profiling/allocation_tracker.h

Issue 2943733002: Add out-of-process memory logging stream parsing. (Closed)
Patch Set: Format 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 #ifndef CHROME_PROFILING_ALLOCATION_TRACKER_H_
6 #define CHROME_PROFILING_ALLOCATION_TRACKER_H_
7
8 #include <map>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "chrome/profiling/memlog_receiver.h"
13 #include "chrome/profiling/stack_storage.h"
14
15 namespace profiling {
16
17 // Tracks live allocations in one process.
18 class AllocationTracker : public MemlogReceiver {
19 public:
20 using CompleteCallback = base::OnceClosure;
21
22 explicit AllocationTracker(CompleteCallback complete_cb);
23 ~AllocationTracker() override;
24
25 void OnHeader(const StreamHeader& header) override;
26 void OnAlloc(const AllocPacket& alloc_packet, Stack&& stack) override;
27 void OnFree(const FreePacket& free_packet) override;
28 void OnComplete() override;
29
30 private:
31 CompleteCallback complete_callback_;
32
33 struct Alloc {
34 Alloc(size_t sz, StackStorage::Key key);
35
36 size_t size;
37 StackStorage::Key stack_key;
38 };
39
40 // Cached pointer to the global singleton.
41 StackStorage* stack_storage_;
42
43 std::map<Address, Alloc> live_allocs_;
44
45 DISALLOW_COPY_AND_ASSIGN(AllocationTracker);
46 };
47
48 } // namespace profiling
49
50 #endif // CHROME_PROFILING_ALLOCATION_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698