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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: components/framelet/browser/framelet_memory_tracker.h
diff --git a/components/framelet/browser/framelet_memory_tracker.h b/components/framelet/browser/framelet_memory_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..19a60e0c375aadf1ae08e9a7af0eea8c9ee52454
--- /dev/null
+++ b/components/framelet/browser/framelet_memory_tracker.h
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_FRAMELET_BROWSER_FRAMELET_MEMORY_TRACKER_H_
+#define COMPONENTS_FRAMELET_BROWSER_FRAMELET_MEMORY_TRACKER_H_
+
+#include <set>
+
+#include "base/supports_user_data.h"
+#include "base/timer/timer.h"
+
+namespace content {
+class BrowserContext;
+}
+
+namespace framelet {
+
+class FrameletMemoryTrackerClient;
+
+class FrameletMemoryTracker : public base::SupportsUserData::Data {
+ public:
+ class ClientID {
+ public:
+ ClientID();
+ ClientID(int render_process_id, int routing_id);
+ ~ClientID();
+
+ int render_process_id() const { return render_process_id_; }
+ int routing_id() const { return routing_id_; }
+
+ bool operator<(const ClientID& other) const;
+ bool operator==(const ClientID& other) const;
+
+ private:
+ const int render_process_id_;
+ const int routing_id_;
+ };
+
+ // Returns the FrameletMemoryTracker associated with |context|. If one isn't
+ // available, then it is created and returned.
+ static FrameletMemoryTracker* FromBrowserContext(
+ content::BrowserContext* context);
+
+ void ReportHeapSize(const ClientID& client_id, int heap_size);
+
+ void AddClient(const ClientID& client_id,
+ FrameletMemoryTrackerClient* framelet);
+ void RemoveClient(const ClientID& client_id);
+
+ private:
+ FrameletMemoryTracker();
+ ~FrameletMemoryTracker() override;
+
+ void OnElapsedTime();
+
+ std::map<ClientID, FrameletMemoryTrackerClient*> clients_;
+ std::set<ClientID> acks_pending_;
+ base::RepeatingTimer timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(FrameletMemoryTracker);
+};
+
+} // namespace framelet
+
+#endif // COMPONENTS_FRAMELET_BROWSER_FRAMELET_MEMORY_TRACKER_H_
« 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