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

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

Issue 2482783002: Add StateOn{Moderate,Critical}NotificationReceived metrics (Closed)
Patch Set: Remove std::move() 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
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/memory/memory_coordinator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/memory_pressure_monitor.h"
9 #include "base/process/process_handle.h" 10 #include "base/process/process_handle.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.
(...skipping 26 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 // Records memory pressure notifications. Called by MemoryPressureMonitor.
57 // TODO(bashi): Remove this when MemoryPressureMonitor is retired.
58 void RecordMemoryPressure(
59 base::MemoryPressureMonitor::MemoryPressureLevel level);
60
55 // Called when ChildMemoryCoordinator calls AddChild(). 61 // Called when ChildMemoryCoordinator calls AddChild().
56 virtual void OnChildAdded(int render_process_id) {} 62 virtual void OnChildAdded(int render_process_id) {}
57 63
58 virtual base::MemoryState GetCurrentMemoryState() const; 64 virtual base::MemoryState GetCurrentMemoryState() const;
59 virtual void SetCurrentMemoryStateForTesting(base::MemoryState memory_state); 65 virtual void SetCurrentMemoryStateForTesting(base::MemoryState memory_state);
60 66
61 protected: 67 protected:
62 // Constructor. Protected as this is a singleton, but accessible for 68 // Constructor. Protected as this is a singleton, but accessible for
63 // unittests. 69 // unittests.
64 MemoryCoordinator(); 70 MemoryCoordinator();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 ChildInfoMap children_; 111 ChildInfoMap children_;
106 112
107 std::unique_ptr<MemoryCoordinatorDelegate> delegate_; 113 std::unique_ptr<MemoryCoordinatorDelegate> delegate_;
108 114
109 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator); 115 DISALLOW_COPY_AND_ASSIGN(MemoryCoordinator);
110 }; 116 };
111 117
112 } // namespace content 118 } // namespace content
113 119
114 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_ 120 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_H_
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/memory/memory_coordinator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698