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

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

Issue 2943283002: Update default policy for memory coordinator (Closed)
Patch Set: 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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_DEFAULT_POLICY_H_ 5 #ifndef CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_DEFAULT_POLICY_H_
6 #define CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_DEFAULT_POLICY_H_ 6 #define CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_DEFAULT_POLICY_H_
7 7
8 #include "content/browser/memory/memory_coordinator_impl.h" 8 #include "content/browser/memory/memory_coordinator_impl.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 // The default policy of MemoryCoordinator. 12 // The default policy of MemoryCoordinator.
13 class MemoryCoordinatorDefaultPolicy : public MemoryCoordinatorImpl::Policy { 13 class MemoryCoordinatorDefaultPolicy : public MemoryCoordinatorImpl::Policy {
14 public: 14 public:
15 explicit MemoryCoordinatorDefaultPolicy(MemoryCoordinatorImpl* coordinator); 15 explicit MemoryCoordinatorDefaultPolicy(MemoryCoordinatorImpl* coordinator);
16 ~MemoryCoordinatorDefaultPolicy() override; 16 ~MemoryCoordinatorDefaultPolicy() override;
17 17
18 void OnCriticalCondition() override; 18 void OnCriticalCondition() override;
19 void OnConditionChanged(MemoryCondition prev, MemoryCondition next) override; 19 void OnConditionChanged(MemoryCondition prev, MemoryCondition next) override;
20 void OnChildVisibilityChanged(int render_process_id, 20 void OnChildVisibilityChanged(int render_process_id,
21 bool is_visible) override; 21 bool is_visible) override;
22 22
23 private: 23 private:
24 // Set the provided memory_state to all child processes.
25 void SetMemoryStateToAllChildren(MemoryState memory_state);
26
27 enum class PurgeTarget {
28 BACKGROUNDED,
29 ALL,
30 };
31
32 // Tries to find a candidate child process for purging memory and asks the
33 // child to purge memory.
34 bool TryToPurgeMemoryFromChildren(PurgeTarget target);
35
36 // Not owned. 24 // Not owned.
37 MemoryCoordinatorImpl* coordinator_; 25 MemoryCoordinatorImpl* coordinator_;
38 }; 26 };
39 27
40 } // namespace content 28 } // namespace content
41 29
42 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_DEFAULT_POLICY_H_ 30 #endif // CONTENT_BROWSER_MEMORY_MEMORY_COORDINATOR_DEFAULT_POLICY_H_
OLDNEW
« no previous file with comments | « content/browser/memory/memory_condition_observer.h ('k') | content/browser/memory/memory_coordinator_default_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698