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

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

Issue 2943733002: Add out-of-process memory logging stream parsing. (Closed)
Patch Set: Add TODO 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
« no previous file with comments | « chrome/profiling/address.h ('k') | chrome/profiling/allocation_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/backtrace_storage.h"
13 #include "chrome/profiling/memlog_receiver.h"
14
15 namespace profiling {
16
17 // Tracks live allocations in one process. This is an analogue to memory-infra
18 // allocation register and needs to be merged/deduped.
19 class AllocationTracker : public MemlogReceiver {
20 public:
21 using CompleteCallback = base::OnceClosure;
22
23 explicit AllocationTracker(CompleteCallback complete_cb);
24 ~AllocationTracker() override;
25
26 void OnHeader(const StreamHeader& header) override;
27 void OnAlloc(const AllocPacket& alloc_packet,
28 std::vector<Address>&& bt) override;
29 void OnFree(const FreePacket& free_packet) override;
30 void OnComplete() override;
31
32 private:
33 CompleteCallback complete_callback_;
34
35 struct Alloc {
36 Alloc(size_t sz, BacktraceStorage::Key key);
37
38 size_t size;
39 BacktraceStorage::Key backtrace_key;
40 };
41
42 // Cached pointer to the global singleton.
43 BacktraceStorage* backtrace_storage_;
44
45 std::map<Address, Alloc> live_allocs_;
46
47 DISALLOW_COPY_AND_ASSIGN(AllocationTracker);
48 };
49
50 } // namespace profiling
51
52 #endif // CHROME_PROFILING_ALLOCATION_TRACKER_H_
OLDNEW
« no previous file with comments | « chrome/profiling/address.h ('k') | chrome/profiling/allocation_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698