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

Unified Diff: chrome/renderer/page_load_metrics/page_timing_metrics_sender.cc

Issue 2823523003: [Page Load Metrics] PageLoadMetrics Mojofication. (Closed)
Patch Set: Addressed comments, remove unnecessary RunUntilIdle, call OnTimingUpdated directly in unit tests Created 3 years, 8 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: chrome/renderer/page_load_metrics/page_timing_metrics_sender.cc
diff --git a/chrome/renderer/page_load_metrics/page_timing_metrics_sender.cc b/chrome/renderer/page_load_metrics/page_timing_metrics_sender.cc
index e016bb3251445b98216fb664624a3b9a22bd3572..1fa66beaf49fd587dc234db8bb34e35505cbff0c 100644
--- a/chrome/renderer/page_load_metrics/page_timing_metrics_sender.cc
+++ b/chrome/renderer/page_load_metrics/page_timing_metrics_sender.cc
@@ -7,9 +7,12 @@
#include <utility>
#include "base/callback.h"
+#include "base/feature_list.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/page_load_metrics/page_load_metrics_messages.h"
+#include "chrome/renderer/page_load_metrics/page_timing_sender.h"
#include "ipc/ipc_sender.h"
namespace page_load_metrics {
@@ -22,10 +25,12 @@ const int kTimerDelayMillis = 1000;
PageTimingMetricsSender::PageTimingMetricsSender(
IPC::Sender* ipc_sender,
int routing_id,
+ PageTimingSender* page_timing_sender,
std::unique_ptr<base::Timer> timer,
const PageLoadTiming& initial_timing)
: ipc_sender_(ipc_sender),
routing_id_(routing_id),
+ page_timing_sender_(page_timing_sender),
timer_(std::move(timer)),
last_timing_(initial_timing),
metadata_(PageLoadMetadata()) {
@@ -76,6 +81,10 @@ void PageTimingMetricsSender::EnsureSendTimer(int delay) {
}
void PageTimingMetricsSender::SendNow() {
+ if (base::FeatureList::IsEnabled(features::kPageLoadMetricsMojofication)) {
+ page_timing_sender_->SendTiming(last_timing_, metadata_);
+ return;
+ }
ipc_sender_->Send(new PageLoadMetricsMsg_TimingUpdated(
routing_id_, last_timing_, metadata_));
}

Powered by Google App Engine
This is Rietveld 408576698