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

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

Issue 55333002: Make possible to check memory allocations inside chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make possible to check memory allocations inside chromium Created 7 years, 1 month 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 <psapi.h> 7 #include <psapi.h>
8 8
9 #include "base/allocator/unchecked_malloc.h"
willchan no longer on Chromium 2013/11/02 21:11:44 Why?
10 #include "base/base_export.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 13
12 namespace base { 14 namespace base {
13 15
14 namespace { 16 namespace {
15 17
16 void OnNoMemory() { 18 void OnNoMemory() {
17 // Kill the process. This is important for security, since WebKit doesn't 19 // Kill the process. This is important for security, since WebKit doesn't
18 // NULL-check many memory allocations. If a malloc fails, returns NULL, and 20 // NULL-check many memory allocations. If a malloc fails, returns NULL, and
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (!::GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 78 if (!::GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
77 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, 79 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
78 static_cast<char*>(address), 80 static_cast<char*>(address),
79 &instance)) { 81 &instance)) {
80 NOTREACHED(); 82 NOTREACHED();
81 } 83 }
82 return instance; 84 return instance;
83 } 85 }
84 86
85 } // namespace base 87 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698