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

Unified Diff: content/common/tab_load_stats.cc

Issue 12389073: Collect tab timing information for use in telementry-based startup tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting/compile fix Created 7 years, 9 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: content/common/tab_load_stats.cc
diff --git a/content/common/tab_load_stats.cc b/content/common/tab_load_stats.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e8d860daedd0b9cd48864a9a94ee24ada2ddf90d
--- /dev/null
+++ b/content/common/tab_load_stats.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 2013 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 "content/common/tab_load_stats.h"
+
+#include "base/json/json_writer.h"
+#include "base/values.h"
+
+namespace content {
+
+void ConvertTabLoadTimeToJSON(
+ const content::TabLoadTime& tab_load_time,
+ const base::TimeTicks& timer_start,
+ std::string *result) {
+ DictionaryValue item;
+ base::TimeDelta delta_start = tab_load_time.start_time - timer_start;
+
+ item.SetDouble("load_start_ms", delta_start.InMillisecondsF());
+ if (tab_load_time.stop_time.is_null()) {
+ item.Set("load_stop_ms", Value::CreateNullValue());
+ } else {
+ base::TimeDelta delta_stop = tab_load_time.stop_time - timer_start;
+ item.SetDouble("load_stop_ms", delta_stop.InMillisecondsF());
+ }
+ base::JSONWriter::Write(&item, result);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698