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

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

Issue 1025613005: Fix SearchBox::LogEvent for out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Charlie's nits 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/searchbox/searchbox.cc
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc
index 58e76dfb6ffbcc64b89eecf0ea58d6036e4a3f56..01ef84755d43af38343ed6553b967841f54c0083 100644
--- a/chrome/renderer/searchbox/searchbox.cc
+++ b/chrome/renderer/searchbox/searchbox.cc
@@ -160,13 +160,19 @@ 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);
- base::TimeDelta delta = base::TimeDelta::FromMilliseconds(now - start);
+ // The main frame for the current RenderView may be out-of-process, in which
+ // case it won't have performance(). Use the default delta of 0 in this
+ // case.
+ base::TimeDelta delta;
+ if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame()) {
+ // 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);
+ delta = base::TimeDelta::FromMilliseconds(now - start);
+ }
render_view()->Send(new ChromeViewHostMsg_LogEvent(
render_view()->GetRoutingID(), page_seq_no_, event, delta));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698