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

Unified Diff: chrome/renderer/searchbox/searchbox.cc

Issue 1006753003: Add time from navigation_start to NTP LogEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/searchbox/searchbox.cc
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc
index 9adce8536714bf97658937ee385048a46db5c780..79b900f6e6df2b7bb084f0ee80d4fa41b5709418 100644
--- a/chrome/renderer/searchbox/searchbox.cc
+++ b/chrome/renderer/searchbox/searchbox.cc
@@ -9,6 +9,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/time/time.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/favicon/favicon_url_parser.h"
#include "chrome/common/omnibox_focus_state.h"
@@ -16,10 +17,13 @@
#include "chrome/common/url_constants.h"
#include "chrome/renderer/searchbox/searchbox_extension.h"
#include "components/favicon_base/favicon_types.h"
+#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "net/base/escape.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "third_party/WebKit/public/web/WebPerformance.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "url/gurl.h"
@@ -156,8 +160,16 @@ SearchBox::~SearchBox() {
}
void SearchBox::LogEvent(NTPLoggingEventType event) {
+ // navigation_start in ms.
+ uint64 start = 1000 * (render_view()->GetMainRenderFrame()->GetWebFrame()->
+ performance().navigationStart());
+ uint64 now =
+ (base::TimeTicks::Now() - base::TimeTicks::UnixEpoch()).InMilliseconds();
+ DCHECK(now >= start);
+ uint64 delta = now - start;
Dan Beam 2015/03/17 17:17:19 i'm really confused as to what everything here is
fserb 2015/03/17 17:41:32 I've tried my best to do it this way before, which
+ DVLOG(1) << now << " - " << start << " = " << delta;
Dan Beam 2015/03/17 17:17:19 remove debug logging... unless there's some purpos
fserb 2015/03/17 17:41:32 Done.
render_view()->Send(new ChromeViewHostMsg_LogEvent(
- render_view()->GetRoutingID(), page_seq_no_, event));
+ render_view()->GetRoutingID(), page_seq_no_, event, delta));
}
void SearchBox::LogMostVisitedImpression(int position,
« chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc ('K') | « chrome/common/render_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698