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

Side by Side Diff: third_party/WebKit/Source/platform/MemoryCoordinator.h

Issue 2933503002: Add IsCurrentlyLowMemory (Closed)
Patch Set: added comment 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 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
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 // This is not cheap and should not be called repeatedly.
50 // TODO(keishi): Remove when MemoryState is ready.
51 static bool IsCurrentlyLowMemory();
52
48 // Caches whether this device is a low-end device and the device physical 53 // 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 54 // 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 55 // object - meaning it's not thread-safe as well as might break tests counting
51 // the heap size. 56 // the heap size.
52 static void Initialize(); 57 static void Initialize();
53 58
54 void RegisterClient(MemoryCoordinatorClient*); 59 void RegisterClient(MemoryCoordinatorClient*);
55 void UnregisterClient(MemoryCoordinatorClient*); 60 void UnregisterClient(MemoryCoordinatorClient*);
56 61
57 // TODO(bashi): Deprecating. Remove this when MemoryPressureListener is 62 // TODO(bashi): Deprecating. Remove this when MemoryPressureListener is
(...skipping 17 matching lines...) Expand all
75 80
76 static bool is_low_end_device_; 81 static bool is_low_end_device_;
77 static int64_t physical_memory_mb_; 82 static int64_t physical_memory_mb_;
78 83
79 HeapHashSet<WeakMember<MemoryCoordinatorClient>> clients_; 84 HeapHashSet<WeakMember<MemoryCoordinatorClient>> clients_;
80 }; 85 };
81 86
82 } // namespace blink 87 } // namespace blink
83 88
84 #endif // MemoryCoordinator_h 89 #endif // MemoryCoordinator_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/DEPS ('k') | third_party/WebKit/Source/platform/MemoryCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698