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

Side by Side Diff: base/memory/discardable_memory_manager_unittest.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « base/memory/discardable_memory_manager.cc ('k') | base/memory/discardable_memory_shmem.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 15 matching lines...) Expand all
26 return was_allocated; 26 return was_allocated;
27 } 27 }
28 void ReleaseLock() override { 28 void ReleaseLock() override {
29 DCHECK(is_locked_); 29 DCHECK(is_locked_);
30 is_locked_ = false; 30 is_locked_ = false;
31 } 31 }
32 void Purge() override { 32 void Purge() override {
33 DCHECK(is_allocated_); 33 DCHECK(is_allocated_);
34 is_allocated_ = false; 34 is_allocated_ = false;
35 } 35 }
36 bool IsMemoryResident() const override {
37 DCHECK(is_allocated_);
38 return true;
39 }
40 36
41 bool is_locked() const { return is_locked_; } 37 bool is_locked() const { return is_locked_; }
42 38
43 private: 39 private:
44 bool is_allocated_; 40 bool is_allocated_;
45 bool is_locked_; 41 bool is_locked_;
46 }; 42 };
47 43
48 // Tests can assume that the default limit is at least 1024. Tests that rely on 44 // Tests can assume that the default limit is at least 1024. Tests that rely on
49 // something else needs to explicit set the limit. 45 // something else needs to explicit set the limit.
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 Unretained(this))); 481 Unretained(this)));
486 memory_usage_thread_.message_loop()->PostTask( 482 memory_usage_thread_.message_loop()->PostTask(
487 FROM_HERE, 483 FROM_HERE,
488 Bind(&ThreadedDiscardableMemoryManagerTest::SignalHelper, 484 Bind(&ThreadedDiscardableMemoryManagerTest::SignalHelper,
489 Unretained(this))); 485 Unretained(this)));
490 thread_sync_.Wait(); 486 thread_sync_.Wait();
491 } 487 }
492 488
493 } // namespace 489 } // namespace
494 } // namespace base 490 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/discardable_memory_manager.cc ('k') | base/memory/discardable_memory_shmem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698