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

Side by Side Diff: base/mac/scoped_mach_vm.cc

Issue 274193007: Back out r269483 and the line of fixes that followed it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/mac/scoped_mach_vm.h ('k') | base/memory/discardable_memory_mac.cc » ('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/mac/scoped_mach_vm.h" 5 #include "base/mac/scoped_mach_vm.h"
6 6
7 #if defined(OS_IOS)
8 #define mach_vm_address_t vm_address_t
9 #define mach_vm_size_t vm_size_t
10 #define mach_vm_deallocate vm_deallocate
11 #endif // OS_IOS
12
13 namespace base { 7 namespace base {
14 namespace mac { 8 namespace mac {
15 9
16 void ScopedMachVM::reset(mach_vm_address_t address, mach_vm_size_t size) { 10 void ScopedMachVM::reset(mach_vm_address_t address, mach_vm_size_t size) {
17 DCHECK(address % PAGE_SIZE == 0); 11 DCHECK(address % PAGE_SIZE == 0);
18 DCHECK(size % PAGE_SIZE == 0); 12 DCHECK(size % PAGE_SIZE == 0);
19 13
20 if (size_) { 14 if (size_) {
21 if (address_ < address) { 15 if (address_ < address) {
22 mach_vm_deallocate(mach_task_self(), 16 mach_vm_deallocate(mach_task_self(),
23 address_, 17 address_,
24 std::min(size_, address - address_)); 18 std::min(size_, address - address_));
25 } 19 }
26 if (address_ + size_ > address + size) { 20 if (address_ + size_ > address + size) {
27 mach_vm_address_t deallocate_start = std::max(address_, address + size); 21 mach_vm_address_t deallocate_start = std::max(address_, address + size);
28 mach_vm_deallocate(mach_task_self(), 22 mach_vm_deallocate(mach_task_self(),
29 deallocate_start, 23 deallocate_start,
30 address_ + size_ - deallocate_start); 24 address_ + size_ - deallocate_start);
31 } 25 }
32 } 26 }
33 27
34 address_ = address; 28 address_ = address;
35 size_ = size; 29 size_ = size;
36 } 30 }
37 31
38 } // namespace mac 32 } // namespace mac
39 } // namespace base 33 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/scoped_mach_vm.h ('k') | base/memory/discardable_memory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698