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

Side by Side Diff: content/browser/memory/memory_coordinator.h

Issue 2360433002: Memory-monitor for Mac. (Closed)
Patch Set: calculate adjustment based on poll interval; limit calculations to avoid overflow Created 4 years, 1 month 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ 5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_
6 #define CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ 6 #define CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_
7 7
8 #include "base/memory/memory_coordinator_client_registry.h" 8 #include "base/memory/memory_coordinator_client_registry.h"
9 #include "base/process/process_handle.h" 9 #include "base/process/process_handle.h"
10 #include "base/time/time.h"
10 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
11 #include "content/common/memory_coordinator.mojom.h" 12 #include "content/common/memory_coordinator.mojom.h"
12 #include "content/public/browser/memory_coordinator_delegate.h" 13 #include "content/public/browser/memory_coordinator_delegate.h"
13 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 // NOTE: Memory coordinator is under development and not fully working. 18 // NOTE: Memory coordinator is under development and not fully working.
18 // TODO(bashi): Add more explanations when we implement memory coordinator V0. 19 // TODO(bashi): Add more explanations when we implement memory coordinator V0.
19 20
(...skipping 25 matching lines...) Expand all
45 // Dispatches a memory state change to the provided process. Returns true if 46 // Dispatches a memory state change to the provided process. Returns true if
46 // the process is tracked by this coordinator and successfully dispatches, 47 // the process is tracked by this coordinator and successfully dispatches,
47 // returns false otherwise. 48 // returns false otherwise.
48 bool SetMemoryState( 49 bool SetMemoryState(
49 int render_process_id, mojom::MemoryState memory_state); 50 int render_process_id, mojom::MemoryState memory_state);
50 51
51 // Returns the memory state of the specified render process. Returns UNKNOWN 52 // Returns the memory state of the specified render process. Returns UNKNOWN
52 // if the process is not tracked by this coordinator. 53 // if the process is not tracked by this coordinator.
53 mojom::MemoryState GetMemoryState(int render_process_id) const; 54 mojom::MemoryState GetMemoryState(int render_process_id) const;
54 55
56 // Returns the interval between memory checks.
57 virtual base::TimeDelta GetMonitoringInterval() const;
58
55 // Called when ChildMemoryCoordinator calls AddChild(). 59 // Called when ChildMemoryCoordinator calls AddChild().
56 virtual void OnChildAdded(int render_process_id) {} 60 virtual void OnChildAdded(int render_process_id) {}
57 61
58 virtual base::MemoryState GetCurrentMemoryState() const; 62 virtual base::MemoryState GetCurrentMemoryState() const;
59 virtual void SetCurrentMemoryStateForTesting(base::MemoryState memory_state); 63 virtual void SetCurrentMemoryStateForTesting(base::MemoryState memory_state);
60 64
61 protected: 65 protected:
62 // Constructor. Protected as this is a singleton, but accessible for 66 // Constructor. Protected as this is a singleton, but accessible for
63 // unittests. 67 // unittests.
64 MemoryCoordinator(); 68 MemoryCoordinator();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 ChildInfoMap children_; 109 ChildInfoMap children_;
106 110
107 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; 111 std::unique_ptr<MemoryCoordinatorDelegate> delegate_;
108 112
109 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); 113 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator);
110 }; 114 };
111 115
112 } // namespace content 116 } // namespace content
113 117
114 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ 118 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698