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

Unified Diff: chrome/browser/page_load_metrics/observers/android_page_load_metrics_observer.cc

Issue 2472163003: [CustomTabs] Report the navigation start as absolute time (Closed)
Patch Set: Cache tick offset Created 4 years, 1 month 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/browser/page_load_metrics/observers/android_page_load_metrics_observer.cc
diff --git a/chrome/browser/page_load_metrics/observers/android_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/android_page_load_metrics_observer.cc
index 7dcc94a5071c73c7982440f866e333050d7488af..b1ca8e15c9cc1b2a6899331b50621c67502e7c3b 100644
--- a/chrome/browser/page_load_metrics/observers/android_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/android_page_load_metrics_observer.cc
@@ -9,6 +9,7 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/android/scoped_java_ref.h"
+#include "base/time/time.h"
#include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
@@ -19,6 +20,15 @@ AndroidPageLoadMetricsObserver::AndroidPageLoadMetricsObserver(
content::WebContents* web_contents)
: web_contents_(web_contents) {}
+page_load_metrics::PageLoadMetricsObserver::ObservePolicy
+AndroidPageLoadMetricsObserver::OnStart(
+ content::NavigationHandle* navigation_handle,
+ const GURL& currently_committed_url,
+ bool started_in_foreground) {
+ navigation_start_ = navigation_handle->NavigationStart();
+ return CONTINUE_OBSERVING;
+}
+
void AndroidPageLoadMetricsObserver::OnFirstContentfulPaint(
const page_load_metrics::PageLoadTiming& timing,
const page_load_metrics::PageLoadExtraInfo& extra_info) {
@@ -29,5 +39,8 @@ void AndroidPageLoadMetricsObserver::OnFirstContentfulPaint(
web_contents_->GetJavaWebContents();
JNIEnv* env = base::android::AttachCurrentThread();
Java_PageLoadMetrics_onFirstContentfulPaint(
- env, java_web_contents, static_cast<jlong>(first_contentful_paint_ms));
+ env, java_web_contents,
+ static_cast<jlong>(
+ (navigation_start_ - base::TimeTicks()).InMicroseconds()),
+ static_cast<jlong>(first_contentful_paint_ms));
}

Powered by Google App Engine
This is Rietveld 408576698