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

Side by Side Diff: components/framelet/browser/framelet_memory_tracker.h

Issue 1602663003: Framelet Prototype 2016 using Mojo IPC Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Disabled oilpan Created 4 years, 11 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 #ifndef COMPONENTS_FRAMELET_BROWSER_FRAMELET_MEMORY_TRACKER_H_
6 #define COMPONENTS_FRAMELET_BROWSER_FRAMELET_MEMORY_TRACKER_H_
7
8 #include <set>
9
10 #include "base/supports_user_data.h"
11 #include "base/timer/timer.h"
12
13 namespace content {
14 class BrowserContext;
15 }
16
17 namespace framelet {
18
19 class FrameletMemoryTrackerClient;
20
21 class FrameletMemoryTracker : public base::SupportsUserData::Data {
22 public:
23 class ClientID {
24 public:
25 ClientID();
26 ClientID(int render_process_id, int routing_id);
27 ~ClientID();
28
29 int render_process_id() const { return render_process_id_; }
30 int routing_id() const { return routing_id_; }
31
32 bool operator<(const ClientID& other) const;
33 bool operator==(const ClientID& other) const;
34
35 private:
36 const int render_process_id_;
37 const int routing_id_;
38 };
39
40 // Returns the FrameletMemoryTracker associated with |context|. If one isn't
41 // available, then it is created and returned.
42 static FrameletMemoryTracker* FromBrowserContext(
43 content::BrowserContext* context);
44
45 void ReportHeapSize(const ClientID& client_id, int heap_size);
46
47 void AddClient(const ClientID& client_id,
48 FrameletMemoryTrackerClient* framelet);
49 void RemoveClient(const ClientID& client_id);
50
51 private:
52 FrameletMemoryTracker();
53 ~FrameletMemoryTracker() override;
54
55 void OnElapsedTime();
56
57 std::map<ClientID, FrameletMemoryTrackerClient*> clients_;
58 std::set<ClientID> acks_pending_;
59 base::RepeatingTimer timer_;
60
61 DISALLOW_COPY_AND_ASSIGN(FrameletMemoryTracker);
62 };
63
64 } // namespace framelet
65
66 #endif // COMPONENTS_FRAMELET_BROWSER_FRAMELET_MEMORY_TRACKER_H_
OLDNEW
« no previous file with comments | « components/framelet/browser/framelet_guest.cc ('k') | components/framelet/browser/framelet_memory_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698