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

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

Issue 114923005: base: Discardable memory types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add switches::kUseDiscardableMemory to kForwardSwitches Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/memory/discardable_memory.cc ('k') | base/memory/discardable_memory_android.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_allocator_android.h" 5 #include "base/memory/discardable_memory_allocator_android.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 offset_(offset), 65 offset_(offset),
66 size_(size), 66 size_(size),
67 locked_(true) { 67 locked_(true) {
68 } 68 }
69 69
70 // Implemented below AshmemRegion since this requires the full definition of 70 // Implemented below AshmemRegion since this requires the full definition of
71 // AshmemRegion. 71 // AshmemRegion.
72 virtual ~DiscardableAshmemChunk(); 72 virtual ~DiscardableAshmemChunk();
73 73
74 // DiscardableMemory: 74 // DiscardableMemory:
75 virtual LockDiscardableMemoryStatus Lock() OVERRIDE { 75 virtual DiscardableMemoryLockStatus Lock() OVERRIDE {
76 DCHECK(!locked_); 76 DCHECK(!locked_);
77 locked_ = true; 77 locked_ = true;
78 return internal::LockAshmemRegion(fd_, offset_, size_, address_); 78 return internal::LockAshmemRegion(fd_, offset_, size_, address_);
79 } 79 }
80 80
81 virtual void Unlock() OVERRIDE { 81 virtual void Unlock() OVERRIDE {
82 DCHECK(locked_); 82 DCHECK(locked_);
83 locked_ = false; 83 locked_ = false;
84 internal::UnlockAshmemRegion(fd_, offset_, size_, address_); 84 internal::UnlockAshmemRegion(fd_, offset_, size_, address_);
85 } 85 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 DCHECK_LE(ashmem_regions_.size(), 5U); 423 DCHECK_LE(ashmem_regions_.size(), 5U);
424 const ScopedVector<AshmemRegion>::iterator it = std::find( 424 const ScopedVector<AshmemRegion>::iterator it = std::find(
425 ashmem_regions_.begin(), ashmem_regions_.end(), region); 425 ashmem_regions_.begin(), ashmem_regions_.end(), region);
426 DCHECK_NE(ashmem_regions_.end(), it); 426 DCHECK_NE(ashmem_regions_.end(), it);
427 std::swap(*it, ashmem_regions_.back()); 427 std::swap(*it, ashmem_regions_.back());
428 ashmem_regions_.pop_back(); 428 ashmem_regions_.pop_back();
429 } 429 }
430 430
431 } // namespace internal 431 } // namespace internal
432 } // namespace base 432 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/discardable_memory.cc ('k') | base/memory/discardable_memory_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698