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

Unified Diff: chrome/browser/predictors/resource_prefetch_common.cc

Issue 2587443002: predictors: Make speculative_prefetch_predictor work with PlzNavigate (Closed)
Patch Set: Updates after lizeb@ first review and rebase Created 4 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
Index: chrome/browser/predictors/resource_prefetch_common.cc
diff --git a/chrome/browser/predictors/resource_prefetch_common.cc b/chrome/browser/predictors/resource_prefetch_common.cc
index d2654aaf87fa99963b675f6afc0b8875bca6c9e9..a9b69f8763a1110ea0c382207997e598fcea2ced 100644
--- a/chrome/browser/predictors/resource_prefetch_common.cc
+++ b/chrome/browser/predictors/resource_prefetch_common.cc
@@ -76,52 +76,38 @@ bool IsSpeculativeResourcePrefetchingEnabled(
return false;
}
-NavigationID::NavigationID()
- : render_process_id(-1),
- render_frame_id(-1) {
-}
+NavigationID::NavigationID() : session_id(-1) {}
NavigationID::NavigationID(const NavigationID& other)
- : render_process_id(other.render_process_id),
- render_frame_id(other.render_frame_id),
+ : session_id(other.session_id),
main_frame_url(other.main_frame_url),
- creation_time(other.creation_time) {
-}
+ creation_time(other.creation_time) {}
NavigationID::NavigationID(content::WebContents* web_contents)
- : render_process_id(web_contents->GetRenderProcessHost()->GetID()),
- render_frame_id(web_contents->GetMainFrame()->GetRoutingID()),
- main_frame_url(web_contents->GetURL()) {
-}
+ : session_id(SessionTabHelper::IdForTab(web_contents)),
+ main_frame_url(web_contents->GetURL()),
+ creation_time(base::TimeTicks::Now()) {}
NavigationID::NavigationID(content::WebContents* web_contents,
const GURL& main_frame_url,
const base::TimeTicks& creation_time)
- : render_process_id(web_contents->GetRenderProcessHost()->GetID()),
- render_frame_id(web_contents->GetMainFrame()->GetRoutingID()),
+ : session_id(SessionTabHelper::IdForTab(web_contents)),
main_frame_url(main_frame_url),
creation_time(creation_time) {}
bool NavigationID::is_valid() const {
- return render_process_id != -1 && render_frame_id != -1 &&
- !main_frame_url.is_empty();
+ return session_id != -1 && !main_frame_url.is_empty();
}
bool NavigationID::operator<(const NavigationID& rhs) const {
DCHECK(is_valid() && rhs.is_valid());
- return std::tie(render_process_id, render_frame_id, main_frame_url) <
- std::tie(rhs.render_process_id, rhs.render_frame_id, rhs.main_frame_url);
+ return std::tie(session_id, main_frame_url) <
+ std::tie(rhs.session_id, rhs.main_frame_url);
}
bool NavigationID::operator==(const NavigationID& rhs) const {
DCHECK(is_valid() && rhs.is_valid());
- return IsSameRenderer(rhs) && main_frame_url == rhs.main_frame_url;
-}
-
-bool NavigationID::IsSameRenderer(const NavigationID& other) const {
- DCHECK(is_valid() && other.is_valid());
- return render_process_id == other.render_process_id &&
- render_frame_id == other.render_frame_id;
+ return session_id == rhs.session_id && main_frame_url == rhs.main_frame_url;
}
ResourcePrefetchPredictorConfig::ResourcePrefetchPredictorConfig()

Powered by Google App Engine
This is Rietveld 408576698