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

Side by Side Diff: content/public/browser/memory_coordinator_delegate.h

Issue 2518653002: memory coordinator: Set variation parameters if available (Closed)
Patch Set: 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_PUBLIC_BROWSER_MEMORY_COORDINATOR_DELEGATE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_MEMORY_COORDINATOR_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_MEMORY_COORDINATOR_DELEGATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_MEMORY_COORDINATOR_DELEGATE_H_
7 7
8 #include "content/common/content_export.h" 8 #include "content/common/content_export.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 // Parameters for memory coordinator V0.
13 struct MemoryCoordinatorV0Params {
bashi 2016/11/18 20:07:27 Exposing the details is bad, but I couldn't find a
14 // The median size of a renderer on the current platform. This is used to
15 // convert the amount of free memory to an expected number of new renderers
16 // that could be started before hitting critical memory pressure.
17 int expected_renderer_size;
18 // When in a NORMAL state and the potential number of new renderers drops
19 // below this level, the coordinator will transition to a THROTTLED state.
20 int new_renderers_until_throttled;
21 // When in a NORMAL/THROTTLED state and the potential number of new renderers
22 // drops below this level, the coordinator will transition to a SUSPENDED
23 // state.
24 int new_renderers_until_suspended;
25 // When in a THROTTLED/SUSPENDED state and the potential number of new
26 // renderers rises above this level, the coordinator will transition to a
27 // NORMAL state.
28 int new_renderers_back_to_normal;
29 // When in a SUSPENDED state and the potential number of new renderers rises
30 // above this level, the coordinator will transition to a SUSPENDED state.
31 int new_renderers_back_to_throttled;
32 // The memory coordinator stays in the same state at least this duration even
33 // when there are considerable changes in the amount of free memory to prevent
34 // thrashing.
35 base::TimeDelta minimum_transition_period;
36 // The interval of checking the amount of free memory.
37 base::TimeDelta monitoring_interval;
38 };
39
12 // A delegate class which is used by the memory coordinator. 40 // A delegate class which is used by the memory coordinator.
13 class CONTENT_EXPORT MemoryCoordinatorDelegate { 41 class CONTENT_EXPORT MemoryCoordinatorDelegate {
14 public: 42 public:
15 virtual ~MemoryCoordinatorDelegate() {} 43 virtual ~MemoryCoordinatorDelegate() {}
16 44
17 // Returns true when a given backgrounded renderer process can be suspended. 45 // Returns true when a given backgrounded renderer process can be suspended.
18 virtual bool CanSuspendBackgroundedRenderer(int render_process_id) = 0; 46 virtual bool CanSuspendBackgroundedRenderer(int render_process_id) = 0;
47
48 // Overrides memory coordinator parameters if variations are available.
49 virtual void OverrideParameters(MemoryCoordinatorV0Params* params) = 0;
19 }; 50 };
20 51
21 } // namespace content 52 } // namespace content
22 53
23 #endif // CONTENT_PUBLIC_BROWSER_MEMORY_COORDINATOR_DELEGATE_H_ 54 #endif // CONTENT_PUBLIC_BROWSER_MEMORY_COORDINATOR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698