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

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 missing include Created 7 years 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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 offset_(offset), 63 offset_(offset),
64 size_(size), 64 size_(size),
65 locked_(true) { 65 locked_(true) {
66 } 66 }
67 67
68 // Implemented below AshmemRegion since this requires the full definition of 68 // Implemented below AshmemRegion since this requires the full definition of
69 // AshmemRegion. 69 // AshmemRegion.
70 virtual ~DiscardableAshmemChunk(); 70 virtual ~DiscardableAshmemChunk();
71 71
72 // DiscardableMemory: 72 // DiscardableMemory:
73 virtual LockDiscardableMemoryStatus Lock() OVERRIDE { 73 virtual DiscardableMemoryLockStatus Lock() OVERRIDE {
74 DCHECK(!locked_); 74 DCHECK(!locked_);
75 locked_ = true; 75 locked_ = true;
76 return internal::LockAshmemRegion(fd_, offset_, size_, address_); 76 return internal::LockAshmemRegion(fd_, offset_, size_, address_);
77 } 77 }
78 78
79 virtual void Unlock() OVERRIDE { 79 virtual void Unlock() OVERRIDE {
80 DCHECK(locked_); 80 DCHECK(locked_);
81 locked_ = false; 81 locked_ = false;
82 internal::UnlockAshmemRegion(fd_, offset_, size_, address_); 82 internal::UnlockAshmemRegion(fd_, offset_, size_, address_);
83 } 83 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 DCHECK_LE(ashmem_regions_.size(), 5U); 409 DCHECK_LE(ashmem_regions_.size(), 5U);
410 const ScopedVector<AshmemRegion>::iterator it = std::find( 410 const ScopedVector<AshmemRegion>::iterator it = std::find(
411 ashmem_regions_.begin(), ashmem_regions_.end(), region); 411 ashmem_regions_.begin(), ashmem_regions_.end(), region);
412 DCHECK_NE(ashmem_regions_.end(), it); 412 DCHECK_NE(ashmem_regions_.end(), it);
413 std::swap(*it, ashmem_regions_.back()); 413 std::swap(*it, ashmem_regions_.back());
414 ashmem_regions_.pop_back(); 414 ashmem_regions_.pop_back();
415 } 415 }
416 416
417 } // namespace internal 417 } // namespace internal
418 } // namespace base 418 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698