OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "base/memory/discardable_memory_manager.h" | 5 #include "base/memory/discardable_memory_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 | 37 |
38 bool is_locked() const { return is_locked_; } | 38 bool is_locked() const { return is_locked_; } |
39 | 39 |
40 private: | 40 private: |
41 bool is_allocated_; | 41 bool is_allocated_; |
42 bool is_locked_; | 42 bool is_locked_; |
43 }; | 43 }; |
44 | 44 |
45 class DiscardableMemoryManagerTestBase { | 45 class DiscardableMemoryManagerTestBase { |
46 public: | 46 public: |
47 DiscardableMemoryManagerTestBase() { | 47 DiscardableMemoryManagerTestBase() |
48 : manager_(64 * 1024 * 1024, 12 * 1024 * 1024) { | |
willchan no longer on Chromium
2014/05/05 22:39:28
Can you add a comment here for why you chose these
reveman
2014/05/06 14:26:46
Reduced the size of these constants and added a co
| |
48 manager_.RegisterMemoryPressureListener(); | 49 manager_.RegisterMemoryPressureListener(); |
49 } | 50 } |
50 | 51 |
51 protected: | 52 protected: |
52 enum LockStatus { | 53 enum LockStatus { |
53 LOCK_STATUS_FAILED, | 54 LOCK_STATUS_FAILED, |
54 LOCK_STATUS_PURGED, | 55 LOCK_STATUS_PURGED, |
55 LOCK_STATUS_SUCCESS | 56 LOCK_STATUS_SUCCESS |
56 }; | 57 }; |
57 | 58 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 Unretained(this))); | 418 Unretained(this))); |
418 memory_usage_thread_.message_loop()->PostTask( | 419 memory_usage_thread_.message_loop()->PostTask( |
419 FROM_HERE, | 420 FROM_HERE, |
420 Bind(&ThreadedDiscardableMemoryManagerTest::SignalHelper, | 421 Bind(&ThreadedDiscardableMemoryManagerTest::SignalHelper, |
421 Unretained(this))); | 422 Unretained(this))); |
422 thread_sync_.Wait(); | 423 thread_sync_.Wait(); |
423 } | 424 } |
424 | 425 |
425 } // namespace | 426 } // namespace |
426 } // namespace base | 427 } // namespace base |
OLD | NEW |