OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/ukm/ukm_source.h" | 5 #include "components/ukm/ukm_source.h" |
6 #include "components/metrics/proto/ukm/source.pb.h" | 6 #include "components/metrics/proto/ukm/source.pb.h" |
7 | 7 |
8 namespace ukm { | 8 namespace ukm { |
9 | 9 |
10 UkmSource::UkmSource() = default; | 10 UkmSource::UkmSource() = default; |
11 | 11 |
12 UkmSource::~UkmSource() = default; | 12 UkmSource::~UkmSource() = default; |
13 | 13 |
14 void UkmSource::PopulateProto(Source* proto_source) { | 14 void UkmSource::PopulateProto(Source* proto_source) { |
15 proto_source->set_url(committed_url_.spec()); | 15 proto_source->set_url(url_.spec()); |
16 | 16 |
17 proto_source->set_first_contentful_paint_msec( | 17 if (parse_start_) |
18 first_contentful_paint_.InMilliseconds()); | 18 proto_source->set_parse_start_msec(parse_start_.value().InMilliseconds()); |
| 19 if (total_time_) |
| 20 proto_source->set_total_time_msec(total_time_.value().InMilliseconds()); |
| 21 |
| 22 if (first_contentful_paint_) { |
| 23 proto_source->set_first_contentful_paint_msec( |
| 24 first_contentful_paint_.value().InMilliseconds()); |
| 25 } |
| 26 if (first_meaningful_paint_) { |
| 27 proto_source->set_experimental_first_meaningful_paint_msec( |
| 28 first_meaningful_paint_.value().InMilliseconds()); |
| 29 } |
19 } | 30 } |
20 | 31 |
21 } // namespace ukm | 32 } // namespace ukm |
OLD | NEW |