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

Side by Side Diff: base/trace_event/heap_profiler_allocation_register_win.cc

Issue 2929673005: Code cleanup and typos in trace_event [NFC] (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/trace_event/heap_profiler_allocation_register.h" 5 #include "base/trace_event/heap_profiler_allocation_register.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/bits.h" 10 #include "base/bits.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // read/write accessible space is still at least |min_size| bytes. 44 // read/write accessible space is still at least |min_size| bytes.
45 void* guard_addr = 45 void* guard_addr =
46 reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(addr) + size); 46 reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(addr) + size);
47 result = VirtualAlloc(guard_addr, GetGuardSize(), MEM_COMMIT, PAGE_NOACCESS); 47 result = VirtualAlloc(guard_addr, GetGuardSize(), MEM_COMMIT, PAGE_NOACCESS);
48 PCHECK(result != nullptr); 48 PCHECK(result != nullptr);
49 49
50 return addr; 50 return addr;
51 } 51 }
52 52
53 void FreeGuardedVirtualMemory(void* address, size_t allocated_size) { 53 void FreeGuardedVirtualMemory(void* address, size_t allocated_size) {
54 // For |VirtualFree|, the size passed with |MEM_RELEASE| mut be 0. Windows 54 // For |VirtualFree|, the size passed with |MEM_RELEASE| must be 0. Windows
55 // automatically frees the entire region that was reserved by the 55 // automatically frees the entire region that was reserved by the
56 // |VirtualAlloc| with flag |MEM_RESERVE|. 56 // |VirtualAlloc| with flag |MEM_RESERVE|.
57 VirtualFree(address, 0, MEM_RELEASE); 57 VirtualFree(address, 0, MEM_RELEASE);
58 } 58 }
59 59
60 } // namespace internal 60 } // namespace internal
61 } // namespace trace_event 61 } // namespace trace_event
62 } // namespace base 62 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker.cc ('k') | base/trace_event/memory_dump_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698