Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 MemoryCoordinator_h | 5 #ifndef MemoryCoordinator_h |
| 6 #define MemoryCoordinator_h | 6 #define MemoryCoordinator_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "platform/wtf/Noncopyable.h" | 10 #include "platform/wtf/Noncopyable.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 // Whether the device Blink runs on is a low-end device. | 38 // Whether the device Blink runs on is a low-end device. |
| 39 // Can be overridden in layout tests via internals. | 39 // Can be overridden in layout tests via internals. |
| 40 static bool IsLowEndDevice(); | 40 static bool IsLowEndDevice(); |
| 41 | 41 |
| 42 // Returns the amount of physical memory in megabytes on the device. | 42 // Returns the amount of physical memory in megabytes on the device. |
| 43 static int64_t GetPhysicalMemoryMB(); | 43 static int64_t GetPhysicalMemoryMB(); |
| 44 | 44 |
| 45 // Override the value of the physical memory for testing. | 45 // Override the value of the physical memory for testing. |
| 46 static void SetPhysicalMemoryMBForTesting(int64_t); | 46 static void SetPhysicalMemoryMBForTesting(int64_t); |
| 47 | 47 |
| 48 // Returns true when available memory is low. | |
| 49 // TODO(keishi): Remove when MemoryState is ready. | |
| 50 static bool HasLowAvailableMemory(); | |
|
haraken
2017/06/12 06:14:20
Where is the implementation of this method?
keishi
2017/06/12 07:48:12
Sorry. Added.
| |
| 51 | |
| 48 // Caches whether this device is a low-end device and the device physical | 52 // Caches whether this device is a low-end device and the device physical |
| 49 // memory in static members. instance() is not used as it's a heap allocated | 53 // memory in static members. instance() is not used as it's a heap allocated |
| 50 // object - meaning it's not thread-safe as well as might break tests counting | 54 // object - meaning it's not thread-safe as well as might break tests counting |
| 51 // the heap size. | 55 // the heap size. |
| 52 static void Initialize(); | 56 static void Initialize(); |
| 53 | 57 |
| 54 void RegisterClient(MemoryCoordinatorClient*); | 58 void RegisterClient(MemoryCoordinatorClient*); |
| 55 void UnregisterClient(MemoryCoordinatorClient*); | 59 void UnregisterClient(MemoryCoordinatorClient*); |
| 56 | 60 |
| 57 // TODO(bashi): Deprecating. Remove this when MemoryPressureListener is | 61 // TODO(bashi): Deprecating. Remove this when MemoryPressureListener is |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 75 | 79 |
| 76 static bool is_low_end_device_; | 80 static bool is_low_end_device_; |
| 77 static int64_t physical_memory_mb_; | 81 static int64_t physical_memory_mb_; |
| 78 | 82 |
| 79 HeapHashSet<WeakMember<MemoryCoordinatorClient>> clients_; | 83 HeapHashSet<WeakMember<MemoryCoordinatorClient>> clients_; |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 } // namespace blink | 86 } // namespace blink |
| 83 | 87 |
| 84 #endif // MemoryCoordinator_h | 88 #endif // MemoryCoordinator_h |
| OLD | NEW |