Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/startup_metric_utils/browser/startup_metric_utils.h" | 5 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Look for the struct housing information for the current process. | 132 // Look for the struct housing information for the current process. |
| 133 DWORD proc_id = ::GetCurrentProcessId(); | 133 DWORD proc_id = ::GetCurrentProcessId(); |
| 134 size_t index = 0; | 134 size_t index = 0; |
| 135 while (index < buffer.size()) { | 135 while (index < buffer.size()) { |
| 136 DCHECK_LE(index + sizeof(SYSTEM_PROCESS_INFORMATION_EX), buffer.size()); | 136 DCHECK_LE(index + sizeof(SYSTEM_PROCESS_INFORMATION_EX), buffer.size()); |
| 137 SYSTEM_PROCESS_INFORMATION_EX* proc_info = | 137 SYSTEM_PROCESS_INFORMATION_EX* proc_info = |
| 138 reinterpret_cast<SYSTEM_PROCESS_INFORMATION_EX*>(buffer.data() + index); | 138 reinterpret_cast<SYSTEM_PROCESS_INFORMATION_EX*>(buffer.data() + index); |
| 139 if (reinterpret_cast<DWORD>(proc_info->UniqueProcessId) == proc_id) { | 139 if (reinterpret_cast<uintptr_t>(proc_info->UniqueProcessId) == proc_id) { |
|
Will Harris
2015/11/10 18:05:14
UniqueProcessId is a HANDLE, shouldn't this be a d
brucedawson
2015/11/10 18:43:26
There's no truncation because proc_id is extended
| |
| 140 *hard_fault_count = proc_info->HardFaultCount; | 140 *hard_fault_count = proc_info->HardFaultCount; |
| 141 return true; | 141 return true; |
| 142 } | 142 } |
| 143 // The list ends when NextEntryOffset is zero. This also prevents busy | 143 // The list ends when NextEntryOffset is zero. This also prevents busy |
| 144 // looping if the data is in fact invalid. | 144 // looping if the data is in fact invalid. |
| 145 if (proc_info->NextEntryOffset <= 0) | 145 if (proc_info->NextEntryOffset <= 0) |
| 146 return false; | 146 return false; |
| 147 index += proc_info->NextEntryOffset; | 147 index += proc_info->NextEntryOffset; |
| 148 } | 148 } |
| 149 | 149 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 | 499 |
| 500 base::Time MainEntryPointTime() { | 500 base::Time MainEntryPointTime() { |
| 501 return g_main_entry_point_time.Get(); | 501 return g_main_entry_point_time.Get(); |
| 502 } | 502 } |
| 503 | 503 |
| 504 StartupTemperature GetStartupTemperature() { | 504 StartupTemperature GetStartupTemperature() { |
| 505 return g_startup_temperature; | 505 return g_startup_temperature; |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace startup_metric_utils | 508 } // namespace startup_metric_utils |
| OLD | NEW |