OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/common/tab_load_stats.h" |
| 6 |
| 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 void ConvertTabLoadTimeToJSON( |
| 13 const content::TabLoadTime& tab_load_time, |
| 14 const base::TimeTicks& timer_start, |
| 15 std::string *result) { |
| 16 DictionaryValue item; |
| 17 base::TimeDelta delta_start = tab_load_time.start_time - timer_start; |
| 18 |
| 19 item.SetDouble("load_start_ms", delta_start.InMillisecondsF()); |
| 20 if (tab_load_time.stop_time.is_null()) { |
| 21 item.Set("load_stop_ms", Value::CreateNullValue()); |
| 22 } else { |
| 23 base::TimeDelta delta_stop = tab_load_time.stop_time - timer_start; |
| 24 item.SetDouble("load_stop_ms", delta_stop.InMillisecondsF()); |
| 25 } |
| 26 base::JSONWriter::Write(&item, result); |
| 27 } |
| 28 |
| 29 } // namespace content |
OLD | NEW |