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

Side by Side Diff: chrome/browser/prerender/prerender_tracker.h

Issue 141163002: Make PrerenderTracker's resource_throttle_io_thread_map_ use RenderFrame IDs instead of RenderView … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TRACKER_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TRACKER_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TRACKER_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TRACKER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 17 matching lines...) Expand all
28 // PrerenderTracker is responsible for keeping track of all prerendering 28 // PrerenderTracker is responsible for keeping track of all prerendering
29 // RenderViews. 29 // RenderViews.
30 class PrerenderTracker : public base::NonThreadSafe, 30 class PrerenderTracker : public base::NonThreadSafe,
31 public PrerenderContents::Observer { 31 public PrerenderContents::Observer {
32 public: 32 public:
33 typedef std::pair<int, int> ChildRouteIdPair; 33 typedef std::pair<int, int> ChildRouteIdPair;
34 34
35 PrerenderTracker(); 35 PrerenderTracker();
36 virtual ~PrerenderTracker(); 36 virtual ~PrerenderTracker();
37 37
38 // Returns whether or not a RenderView is prerendering. Can only be called on
39 // the IO thread. Does not acquire a lock, so may claim a RenderView that has
40 // been displayed or destroyed is still prerendering.
41 bool IsPrerenderingOnIOThread(int child_id, int route_id) const;
42
43 // Returns whether or not a RenderFrame and URL are regarding a pending 38 // Returns whether or not a RenderFrame and URL are regarding a pending
44 // prerender swap. Can only be called on the IO thread. Does not acquire a 39 // prerender swap. Can only be called on the IO thread. Does not acquire a
45 // lock. 40 // lock.
46 bool IsPendingSwapRequestOnIOThread(int render_process_id, 41 bool IsPendingSwapRequestOnIOThread(int render_process_id,
47 int render_frame_id, 42 int render_frame_id,
48 const GURL& url) const; 43 const GURL& url) const;
49 44
50 // Called when a PrerenderResourceThrottle defers a request. Cancel 45 // Called when a PrerenderResourceThrottle defers a request. Cancel
51 // or Resume will be called on |throttle| when the prerender is 46 // or Resume will be called on |throttle| when the prerender is
52 // canceled or used, respectively. 47 // canceled or used, respectively.
(...skipping 13 matching lines...) Expand all
66 const ChildRouteIdPair& render_frame_route_id_pair, 61 const ChildRouteIdPair& render_frame_route_id_pair,
67 const GURL& url); 62 const GURL& url);
68 63
69 // Called to remove the throttles for a pending prerender swap. 64 // Called to remove the throttles for a pending prerender swap.
70 void RemovePrerenderPendingSwap( 65 void RemovePrerenderPendingSwap(
71 const ChildRouteIdPair& render_frame_route_id_pair, 66 const ChildRouteIdPair& render_frame_route_id_pair,
72 bool swap_successful); 67 bool swap_successful);
73 68
74 private: 69 private:
75 friend class PrerenderContents; 70 friend class PrerenderContents;
71 friend class PrerenderTrackerTest;
76 72
77 // Map of child/route id pairs to final statuses. 73 // Map of child/route id pairs to final statuses.
78 typedef std::map<ChildRouteIdPair, RenderViewInfo> FinalStatusMap; 74 typedef std::map<ChildRouteIdPair, RenderViewInfo> FinalStatusMap;
79 // List of throttled requests. 75 // List of throttled requests.
80 typedef std::vector<base::WeakPtr<PrerenderResourceThrottle> > 76 typedef std::vector<base::WeakPtr<PrerenderResourceThrottle> >
81 ResourceThrottleList; 77 ResourceThrottleList;
82 // Set of throttled requests. 78 // Set of throttled requests.
83 typedef std::map<ChildRouteIdPair, ResourceThrottleList> ResourceThrottleMap; 79 typedef std::map<ChildRouteIdPair, ResourceThrottleList> ResourceThrottleMap;
84 struct PendingSwapThrottleData { 80 struct PendingSwapThrottleData {
85 explicit PendingSwapThrottleData(const GURL& swap_url); 81 explicit PendingSwapThrottleData(const GURL& swap_url);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Map of pending prerender swaps and their associated throttles, 116 // Map of pending prerender swaps and their associated throttles,
121 // maintained on the IO thread. 117 // maintained on the IO thread.
122 PendingSwapThrottleMap pending_swap_throttle_map_; 118 PendingSwapThrottleMap pending_swap_throttle_map_;
123 119
124 DISALLOW_COPY_AND_ASSIGN(PrerenderTracker); 120 DISALLOW_COPY_AND_ASSIGN(PrerenderTracker);
125 }; 121 };
126 122
127 } // namespace prerender 123 } // namespace prerender
128 124
129 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TRACKER_H_ 125 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698