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

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: Remove redundant base:: prefix 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
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 <memory>
Nico 2016/04/04 17:14:56 unused
dcheng 2016/04/04 17:43:39 Done.
12
11 #include "base/logging.h" 13 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 14
14 // malloc_unchecked is required to implement UncheckedMalloc properly. 15 // malloc_unchecked is required to implement UncheckedMalloc properly.
15 // It's provided by allocator_shim_win.cc but since that's not always present, 16 // 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. 17 // we provide a default that falls back to regular malloc.
17 typedef void* (*MallocFn)(size_t); 18 typedef void* (*MallocFn)(size_t);
18 extern "C" void* (*const malloc_unchecked)(size_t); 19 extern "C" void* (*const malloc_unchecked)(size_t);
19 extern "C" void* (*const malloc_default)(size_t) = &malloc; 20 extern "C" void* (*const malloc_default)(size_t) = &malloc;
20 21
21 #if defined(_M_IX86) 22 #if defined(_M_IX86)
22 #pragma comment(linker, "/alternatename:_malloc_unchecked=_malloc_default") 23 #pragma comment(linker, "/alternatename:_malloc_unchecked=_malloc_default")
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return instance; 72 return instance;
72 } 73 }
73 74
74 // Implemented using a weak symbol. 75 // Implemented using a weak symbol.
75 bool UncheckedMalloc(size_t size, void** result) { 76 bool UncheckedMalloc(size_t size, void** result) {
76 *result = malloc_unchecked(size); 77 *result = malloc_unchecked(size);
77 return *result != NULL; 78 return *result != NULL;
78 } 79 }
79 80
80 } // namespace base 81 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698