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

Side by Side Diff: components/startup_metric_utils/browser/startup_metric_utils.cc

Issue 1422773008: Fixing remaining VC++ 2015 64-bit build breaks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding #ifdefs Created 5 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 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"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/sys_info.h" 13 #include "base/sys_info.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 15
16 #if defined(OS_WIN) 16 #if defined(OS_WIN)
17 #include <winternl.h> 17 #include <winternl.h>
18 #include "base/win/win_util.h"
18 #include "base/win/windows_version.h" 19 #include "base/win/windows_version.h"
19 #endif 20 #endif
20 21
21 namespace startup_metric_utils { 22 namespace startup_metric_utils {
22 23
23 namespace { 24 namespace {
24 25
25 // Mark as volatile to defensively make sure usage is thread-safe. 26 // Mark as volatile to defensively make sure usage is thread-safe.
26 // Note that at the time of this writing, access is only on the UI thread. 27 // Note that at the time of this writing, access is only on the UI thread.
27 volatile bool g_non_browser_ui_displayed = false; 28 volatile bool g_non_browser_ui_displayed = false;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return false; 130 return false;
130 } 131 }
131 132
132 // Look for the struct housing information for the current process. 133 // Look for the struct housing information for the current process.
133 DWORD proc_id = ::GetCurrentProcessId(); 134 DWORD proc_id = ::GetCurrentProcessId();
134 size_t index = 0; 135 size_t index = 0;
135 while (index < buffer.size()) { 136 while (index < buffer.size()) {
136 DCHECK_LE(index + sizeof(SYSTEM_PROCESS_INFORMATION_EX), buffer.size()); 137 DCHECK_LE(index + sizeof(SYSTEM_PROCESS_INFORMATION_EX), buffer.size());
137 SYSTEM_PROCESS_INFORMATION_EX* proc_info = 138 SYSTEM_PROCESS_INFORMATION_EX* proc_info =
138 reinterpret_cast<SYSTEM_PROCESS_INFORMATION_EX*>(buffer.data() + index); 139 reinterpret_cast<SYSTEM_PROCESS_INFORMATION_EX*>(buffer.data() + index);
139 if (reinterpret_cast<DWORD>(proc_info->UniqueProcessId) == proc_id) { 140 if (base::win::HandleToUint32(proc_info->UniqueProcessId) == proc_id) {
140 *hard_fault_count = proc_info->HardFaultCount; 141 *hard_fault_count = proc_info->HardFaultCount;
141 return true; 142 return true;
142 } 143 }
143 // The list ends when NextEntryOffset is zero. This also prevents busy 144 // The list ends when NextEntryOffset is zero. This also prevents busy
144 // looping if the data is in fact invalid. 145 // looping if the data is in fact invalid.
145 if (proc_info->NextEntryOffset <= 0) 146 if (proc_info->NextEntryOffset <= 0)
146 return false; 147 return false;
147 index += proc_info->NextEntryOffset; 148 index += proc_info->NextEntryOffset;
148 } 149 }
149 150
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 499
499 base::Time MainEntryPointTime() { 500 base::Time MainEntryPointTime() {
500 return g_main_entry_point_time.Get(); 501 return g_main_entry_point_time.Get();
501 } 502 }
502 503
503 StartupTemperature GetStartupTemperature() { 504 StartupTemperature GetStartupTemperature() {
504 return g_startup_temperature; 505 return g_startup_temperature;
505 } 506 }
506 507
507 } // namespace startup_metric_utils 508 } // namespace startup_metric_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698