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

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

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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/mac/scoped_authorizationref.h ('k') | base/mac/scoped_mach_vm.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 #ifndef BASE_MAC_SCOPED_MACH_VM_H_ 5 #ifndef BASE_MAC_SCOPED_MACH_VM_H_
6 #define BASE_MAC_SCOPED_MACH_VM_H_ 6 #define BASE_MAC_SCOPED_MACH_VM_H_
7 7
8 #include <mach/mach.h> 8 #include <mach/mach.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 30 matching lines...) Expand all
41 // return false; 41 // return false;
42 // } 42 // }
43 // ScopedMachVM vm_owner(address, mach_vm_round_page(size)); 43 // ScopedMachVM vm_owner(address, mach_vm_round_page(size));
44 44
45 namespace base { 45 namespace base {
46 namespace mac { 46 namespace mac {
47 47
48 class BASE_EXPORT ScopedMachVM { 48 class BASE_EXPORT ScopedMachVM {
49 public: 49 public:
50 explicit ScopedMachVM(vm_address_t address = 0, vm_size_t size = 0) 50 explicit ScopedMachVM(vm_address_t address = 0, vm_size_t size = 0)
51 : address_(address), 51 : address_(address), size_(size) {
52 size_(size) { 52 DCHECK_EQ(address % PAGE_SIZE, 0u);
53 DCHECK(address % PAGE_SIZE == 0); 53 DCHECK_EQ(size % PAGE_SIZE, 0u);
54 DCHECK(size % PAGE_SIZE == 0);
55 } 54 }
56 55
57 ~ScopedMachVM() { 56 ~ScopedMachVM() {
58 if (size_) { 57 if (size_) {
59 vm_deallocate(mach_task_self(), address_, size_); 58 vm_deallocate(mach_task_self(), address_, size_);
60 } 59 }
61 } 60 }
62 61
63 void reset(vm_address_t address = 0, vm_size_t size = 0); 62 void reset(vm_address_t address = 0, vm_size_t size = 0);
64 63
(...skipping 19 matching lines...) Expand all
84 vm_address_t address_; 83 vm_address_t address_;
85 vm_size_t size_; 84 vm_size_t size_;
86 85
87 DISALLOW_COPY_AND_ASSIGN(ScopedMachVM); 86 DISALLOW_COPY_AND_ASSIGN(ScopedMachVM);
88 }; 87 };
89 88
90 } // namespace mac 89 } // namespace mac
91 } // namespace base 90 } // namespace base
92 91
93 #endif // BASE_MAC_SCOPED_MACH_VM_H_ 92 #endif // BASE_MAC_SCOPED_MACH_VM_H_
OLDNEW
« no previous file with comments | « base/mac/scoped_authorizationref.h ('k') | base/mac/scoped_mach_vm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698