OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // This file intentionally does not have header guards, it's included | |
6 // inside a macro to generate enum and a java class for the values. | |
7 | |
8 #ifndef DEFINE_MEMORY_PRESSURE_LEVEL | |
9 #error "DEFINE_MEMORY_PRESSURE_LEVEL should be defined." | |
10 #endif | |
11 | |
12 // Modules are advised to free buffers that are cheap to re-allocate and not | |
13 // immediately needed. | |
14 DEFINE_MEMORY_PRESSURE_LEVEL(MEMORY_PRESSURE_MODERATE, 0) | |
15 | |
16 // At this level, modules are advised to free all possible memory. | |
17 // The alternative is to be killed by the system, which means all memory will | |
18 // have to be re-created, plus the cost of starting up from cold. | |
Peter Kasting
2013/06/07 01:00:43
Nit: starting up from cold -> a cold start
bulach
2013/06/07 11:06:58
Done.
| |
19 DEFINE_MEMORY_PRESSURE_LEVEL(MEMORY_PRESSURE_CRITICAL, 2) | |
20 | |
21 // TODO(bulach): REMOVE ME!!!! | |
22 // At this level, the system has no other option but to kill the app. | |
23 // All modules should free as much memory as they possibly can, otherwise the | |
24 // platform will just kill the app. | |
25 // In other words, if a module holds on to a buffer X and the app gets killed, | |
26 // later on the entire app will have to be restarted and the buffer X will have | |
27 // to be recreated. So it's almost always guaranteed to be better to free | |
28 // all possible memory at this pressure level. | |
29 DEFINE_MEMORY_PRESSURE_LEVEL(MEMORY_PRESSURE_SURRENDER_OR_DIE, 2) | |
bulach
2013/06/06 09:28:30
btw: I don't want this to be funny or anything, bu
joth
2013/06/06 22:36:46
This gets into brinkmanship. IF the system _really
Peter Kasting
2013/06/07 01:00:43
I think this SURRENDER_OR_DIE case adds nothing to
bulach
2013/06/07 11:06:58
Done.
| |
OLD | NEW |