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

Unified Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 112453004: InstantExtended: record Instant NTP load times. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/browser/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index f779ede42c8d09490d70fa5e6a7c95ac23e7be9f..a12e8c513302ee0c3726a422dbe9032840f58cef 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
#include "chrome/browser/ui/search/search_ipc_router_policy_impl.h"
+#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_utils.h"
#include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h"
@@ -123,6 +124,19 @@ void UpdateLocationBar(content::WebContents* contents) {
#endif
}
+// Called when an NTP finishes loading. If the load start time was noted,
+// calculates and logs the total load time.
+void RecordNewTabLoadTime(content::WebContents* contents) {
+ CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(contents);
+ if (core_tab_helper->new_tab_start_time().is_null())
+ return;
+
+ base::TimeDelta duration =
+ base::TimeTicks::Now() - core_tab_helper->new_tab_start_time();
+ UMA_HISTOGRAM_TIMES("Tab.NewTabOnload", duration);
+ core_tab_helper->set_new_tab_start_time(base::TimeTicks());
Jered 2014/01/02 20:12:41 Why are you resetting the start time here?
samarth 2014/01/04 01:22:38 This is because not all code paths that open the N
+}
+
} // namespace
SearchTabHelper::SearchTabHelper(content::WebContents* web_contents)
@@ -290,8 +304,12 @@ void SearchTabHelper::DidFinishLoad(
const GURL& /* validated_url */,
bool is_main_frame,
content::RenderViewHost* /* render_view_host */) {
- if (is_main_frame)
+ if (is_main_frame) {
+ if (chrome::IsInstantNTP(web_contents_))
+ RecordNewTabLoadTime(web_contents_);
+
DetermineIfPageSupportsInstant();
+ }
}
void SearchTabHelper::NavigationEntryCommitted(
« 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