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

Side by Side Diff: chrome/browser/predictors/resource_prefetch_common.cc

Issue 10416002: Seculative resource prefetching for URLs CL. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moving to WeakPtrs and RVHD. Created 8 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/predictors/resource_prefetch_common.h"
6
7 #include "content/public/browser/render_process_host.h"
8 #include "content/public/browser/render_view_host.h"
9 #include "content/public/browser/web_contents.h"
10
11 namespace predictors {
12
13 NavigationID::NavigationID() : render_process_id_(-1), render_view_id_(-1) {
14 }
15
16 NavigationID::NavigationID(const NavigationID& other)
17 : render_process_id_(other.render_process_id_),
18 render_view_id_(other.render_view_id_),
19 main_frame_url_(other.main_frame_url_),
20 creation_time_(other.creation_time_) {
21 }
22
23 NavigationID::NavigationID(const content::WebContents& web_contents)
24 : render_process_id_(web_contents.GetRenderProcessHost()->GetID()),
25 render_view_id_(web_contents.GetRenderViewHost()->GetRoutingID()),
26 main_frame_url_(web_contents.GetURL()) {
27 }
28
29 bool NavigationID::operator<(const NavigationID& rhs) const {
dominich 2012/05/30 15:35:01 you should check for -1 for process/view, or add a
Shishir 2012/05/30 18:07:15 Done.
30 if (render_process_id_ != rhs.render_process_id_)
31 return render_process_id_ < rhs.render_process_id_;
32 else if (render_view_id_ != rhs.render_view_id_)
33 return render_view_id_ < rhs.render_view_id_;
34 else
35 return main_frame_url_ < rhs.main_frame_url_;
36 }
37
38 bool NavigationID::operator==(const NavigationID& rhs) const {
dominich 2012/05/30 15:35:01 check for -1 process/view
Shishir 2012/05/30 18:07:15 Done.
39 return IsSameRenderer(rhs) && main_frame_url_ == rhs.main_frame_url_;
40 }
41
42 bool NavigationID::IsSameRenderer(const NavigationID& other) const {
dominich 2012/05/30 15:35:01 check for -1 process/view
Shishir 2012/05/30 18:07:15 Done.
43 return render_process_id_ == other.render_process_id_ &&
44 render_view_id_ == other.render_view_id_;
45 }
46
47 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698