| 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
|
|
|