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

Unified Diff: base/process_info_win.cc

Issue 10561009: Consolidate RecordBrowserStartupTime() into one location (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix review comments - utilize Time::is_null() Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: base/process_info_win.cc
diff --git a/base/process_info_win.cc b/base/process_info_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..23a151ef221db407611bbc8ddd2788ddd6fe241d
--- /dev/null
+++ b/base/process_info_win.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/process_info.h"
+
+#include <windows.h>
+
+#include "base/basictypes.h"
+#include "base/time.h"
+
+namespace {
+
+using base::Time;
+
+// Returns the process creation time, or a null time object if an error
+// occurred.
+Time ProcessCreationTimeInternal() {
+ FILETIME creation_time = {};
+ FILETIME ignore = {};
+ if (::GetProcessTimes(::GetCurrentProcess(), &creation_time, &ignore,
+ &ignore, &ignore) == false)
+ return Time();
+
+ return Time::FromFileTime(creation_time);
+}
+
+} // namespace
+
+namespace base {
+
+//static
+const Time* CurrentProcessInfo::CreationTime() {
+ static Time process_creation_time = ProcessCreationTimeInternal();
Mark Mentovai 2012/06/19 16:08:00 As in the Mac file.
+ return &process_creation_time;
+}
+
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698