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

Side by Side Diff: base/process/memory_win.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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/process/launch_win.cc ('k') | base/process/process_handle_win.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/process/memory.h" 5 #include "base/process/memory.h"
6 6
7 #include <new.h> 7 #include <new.h>
8 #include <psapi.h> 8 #include <psapi.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 12
14 // malloc_unchecked is required to implement UncheckedMalloc properly. 13 // malloc_unchecked is required to implement UncheckedMalloc properly.
15 // It's provided by allocator_shim_win.cc but since that's not always present, 14 // It's provided by allocator_shim_win.cc but since that's not always present,
16 // we provide a default that falls back to regular malloc. 15 // we provide a default that falls back to regular malloc.
17 typedef void* (*MallocFn)(size_t); 16 typedef void* (*MallocFn)(size_t);
18 extern "C" void* (*const malloc_unchecked)(size_t); 17 extern "C" void* (*const malloc_unchecked)(size_t);
19 extern "C" void* (*const malloc_default)(size_t) = &malloc; 18 extern "C" void* (*const malloc_default)(size_t) = &malloc;
20 19
21 #if defined(_M_IX86) 20 #if defined(_M_IX86)
22 #pragma comment(linker, "/alternatename:_malloc_unchecked=_malloc_default") 21 #pragma comment(linker, "/alternatename:_malloc_unchecked=_malloc_default")
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 _set_new_mode(1); 59 _set_new_mode(1);
61 } 60 }
62 61
63 // Implemented using a weak symbol. 62 // Implemented using a weak symbol.
64 bool UncheckedMalloc(size_t size, void** result) { 63 bool UncheckedMalloc(size_t size, void** result) {
65 *result = malloc_unchecked(size); 64 *result = malloc_unchecked(size);
66 return *result != NULL; 65 return *result != NULL;
67 } 66 }
68 67
69 } // namespace base 68 } // namespace base
OLDNEW
« no previous file with comments | « base/process/launch_win.cc ('k') | base/process/process_handle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698