OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 | 5 |
6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <crt_externs.h> | 9 #include <crt_externs.h> |
10 #include <dlfcn.h> | 10 #include <dlfcn.h> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 exec_name_end - last_slash - 1); | 162 exec_name_end - last_slash - 1); |
163 // Start w/ the next entry next time through | 163 // Start w/ the next entry next time through |
164 ++index_of_kinfo_proc_; | 164 ++index_of_kinfo_proc_; |
165 // Done | 165 // Done |
166 return true; | 166 return true; |
167 } | 167 } |
168 return false; | 168 return false; |
169 } | 169 } |
170 | 170 |
171 bool NamedProcessIterator::IncludeEntry() { | 171 bool NamedProcessIterator::IncludeEntry() { |
172 return (SysWideToUTF8(executable_name_) == entry().exe_file() && | 172 return (executable_name_ == entry().exe_file() && |
173 ProcessIterator::IncludeEntry()); | 173 ProcessIterator::IncludeEntry()); |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 // ------------------------------------------------------------------------ | 177 // ------------------------------------------------------------------------ |
178 // NOTE: about ProcessMetrics | 178 // NOTE: about ProcessMetrics |
179 // | 179 // |
180 // Getting a mach task from a pid for another process requires permissions in | 180 // Getting a mach task from a pid for another process requires permissions in |
181 // general, so there doesn't really seem to be a way to do these (and spinning | 181 // general, so there doesn't really seem to be a way to do these (and spinning |
182 // up ps to fetch each stats seems dangerous to put in a base api for anyone to | 182 // up ps to fetch each stats seems dangerous to put in a base api for anyone to |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 @selector(allocWithZone:)); | 874 @selector(allocWithZone:)); |
875 g_old_allocWithZone = reinterpret_cast<allocWithZone_t>( | 875 g_old_allocWithZone = reinterpret_cast<allocWithZone_t>( |
876 method_getImplementation(orig_method)); | 876 method_getImplementation(orig_method)); |
877 CHECK(g_old_allocWithZone) | 877 CHECK(g_old_allocWithZone) |
878 << "Failed to get allocWithZone allocation function."; | 878 << "Failed to get allocWithZone allocation function."; |
879 method_setImplementation(orig_method, | 879 method_setImplementation(orig_method, |
880 reinterpret_cast<IMP>(oom_killer_allocWithZone)); | 880 reinterpret_cast<IMP>(oom_killer_allocWithZone)); |
881 } | 881 } |
882 | 882 |
883 } // namespace base | 883 } // namespace base |
OLD | NEW |