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

Unified Diff: chrome/browser/prerender/prerender_tracker.h

Issue 7060012: PrerenderTracker Cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Response to comment Created 9 years, 7 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 | chrome/browser/prerender/prerender_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_tracker.h
===================================================================
--- chrome/browser/prerender/prerender_tracker.h (revision 86287)
+++ chrome/browser/prerender/prerender_tracker.h (working copy)
@@ -28,13 +28,13 @@
// Attempts to set the status of the specified RenderViewHost to
// FINAL_STATUS_USED. Returns true on success. Returns false if it has
- // already been cancelled for any reason, or is no longer prerendering.
+ // already been cancelled for any reason or is no longer prerendering.
// Can only be called only on the IO thread. This method will not call
// PrerenderContents::set_final_status() on the corresponding
// PrerenderContents.
//
- // If it returns true, all subsequent calls to TryCancel for the RenderView
- // will return false.
+ // If it returns true, all subsequent calls to TryCancel and TryUse for the
+ // RenderView will return false.
bool TryUse(int child_id, int route_id);
// Attempts to cancel prerendering by the specified RenderView, setting the
@@ -65,7 +65,8 @@
bool GetFinalStatus(int child_id, int route_id,
FinalStatus* final_status) const;
- protected:
+ private:
+ friend struct DefaultSingletonTraits<PrerenderTracker>;
friend class PrerenderContents;
FRIEND_TEST_ALL_PREFIXES(PrerenderTrackerTest, PrerenderTrackerUsed);
@@ -74,6 +75,16 @@
FRIEND_TEST_ALL_PREFIXES(PrerenderTrackerTest, PrerenderTrackerCancelledFast);
FRIEND_TEST_ALL_PREFIXES(PrerenderTrackerTest, PrerenderTrackerMultiple);
+ typedef std::pair<int, int> ChildRouteIdPair;
+
+ // Map of child/route id pairs to final statuses.
+ typedef std::map<ChildRouteIdPair, RenderViewInfo> FinalStatusMap;
+ // Set of child/route id pairs that may be prerendering.
+ typedef std::set<ChildRouteIdPair> PossiblyPrerenderingChildRouteIdPairs;
+
+ PrerenderTracker();
+ ~PrerenderTracker();
+
// Must be called when a RenderView starts prerendering, before the first
// navigation starts to avoid any races.
void OnPrerenderingStarted(int child_id, int route_id,
@@ -84,26 +95,21 @@
// destroyed.
void OnPrerenderingFinished(int child_id, int route_id);
- private:
- friend struct DefaultSingletonTraits<PrerenderTracker>;
-
- typedef std::pair<int, int> ChildRouteIdPair;
-
- // Map of child/route id pairs to final statuses.
- typedef std::map<ChildRouteIdPair, RenderViewInfo> FinalStatusMap;
- // Set of child/route id pairs that may be prerendering.
- typedef std::set<ChildRouteIdPair> PossiblyPrerenderingChildRouteIdPairs;
-
- PrerenderTracker();
- ~PrerenderTracker();
-
// Attempts to set the FinalStatus of the specified RenderView to
- // |final_status|. If the FinalStatus of the RenderView has already been
- // set, does nothing. Returns the resulting FinalStatus of that RenderView,
- // regardless of success or failure. If the RenderView isn't currently
- // prerendering, returns FINAL_STATUS_MAX.
- FinalStatus SetFinalStatus(int child_id, int route_id,
- FinalStatus final_status);
+ // |desired_final_status|. If non-NULL, |actual_final_status| is set to the
+ // FinalStatus of the RenderView.
+ //
+ // If the FinalStatus of the RenderView is successfully set, returns true and
+ // sets |actual_final_status| to |desired_final_status|.
+ //
+ // If the FinalStatus of the RenderView was already set, returns false and
+ // sets |actual_final_status| to the actual FinalStatus of the RenderView.
+ //
+ // If the RenderView is not a prerendering RenderView, returns false and sets
+ // |actual_final_status| to FINAL_STATUS_MAX.
+ bool SetFinalStatus(int child_id, int route_id,
+ FinalStatus desired_final_status,
+ FinalStatus* actual_final_status);
// Add/remove the specified pair to |possibly_prerendering_io_thread_set_| on
// the IO Thread.
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698