| OLD | NEW |
| 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 "content/renderer/stats_collection_controller.h" | 5 #include "content/renderer/stats_collection_controller.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } else { | 59 } else { |
| 60 item.SetDouble("load_start_ms", (load_start_time - base::Time::UnixEpoch()) | 60 item.SetDouble("load_start_ms", (load_start_time - base::Time::UnixEpoch()) |
| 61 .InMillisecondsF()); | 61 .InMillisecondsF()); |
| 62 } | 62 } |
| 63 if (load_start_time.is_null() || load_stop_time.is_null()) { | 63 if (load_start_time.is_null() || load_stop_time.is_null()) { |
| 64 item.Set("load_duration_ms", base::Value::CreateNullValue()); | 64 item.Set("load_duration_ms", base::Value::CreateNullValue()); |
| 65 } else { | 65 } else { |
| 66 item.SetDouble("load_duration_ms", | 66 item.SetDouble("load_duration_ms", |
| 67 (load_stop_time - load_start_time).InMillisecondsF()); | 67 (load_stop_time - load_start_time).InMillisecondsF()); |
| 68 } | 68 } |
| 69 base::JSONWriter::Write(&item, result); | 69 base::JSONWriter::Write(item, result); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 // static | 74 // static |
| 75 gin::WrapperInfo StatsCollectionController::kWrapperInfo = { | 75 gin::WrapperInfo StatsCollectionController::kWrapperInfo = { |
| 76 gin::kEmbedderNativeGin | 76 gin::kEmbedderNativeGin |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 // static | 79 // static |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 std::string tab_timing_json; | 153 std::string tab_timing_json; |
| 154 ConvertLoadTimeToJSON( | 154 ConvertLoadTimeToJSON( |
| 155 observer->load_start_time(), observer->load_stop_time(), | 155 observer->load_start_time(), observer->load_stop_time(), |
| 156 &tab_timing_json); | 156 &tab_timing_json); |
| 157 return tab_timing_json; | 157 return tab_timing_json; |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace content | 160 } // namespace content |
| OLD | NEW |