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

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

Issue 2807163002: [Prerender] Restore request priorities when swapped in (Closed)
Patch Set: Fix test: default image priority can be LOWEST or MEDIUM Created 3 years, 8 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
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_CONTENTS_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 // Marks prerender as used and releases any throttled resource requests. 229 // Marks prerender as used and releases any throttled resource requests.
230 void PrepareForUse(); 230 void PrepareForUse();
231 231
232 // Called when a PrerenderResourceThrottle defers a request. If the prerender 232 // Called when a PrerenderResourceThrottle defers a request. If the prerender
233 // is used it'll be resumed on the IO thread, otherwise they will get 233 // is used it'll be resumed on the IO thread, otherwise they will get
234 // cancelled automatically if prerendering is cancelled. 234 // cancelled automatically if prerendering is cancelled.
235 void AddResourceThrottle( 235 void AddResourceThrottle(
236 const base::WeakPtr<PrerenderResourceThrottle>& throttle); 236 const base::WeakPtr<PrerenderResourceThrottle>& throttle);
237 237
238 // Called when a PrerenderResourceThrottle changes a resource priority to
239 // net::IDLE. The resources are reset back to their original priorities when
240 // the prerender contents is swapped in.
241 void AddIdleResource(
242 const base::WeakPtr<PrerenderResourceThrottle>& throttle);
243
238 // Increments the number of bytes fetched over the network for this prerender. 244 // Increments the number of bytes fetched over the network for this prerender.
239 void AddNetworkBytes(int64_t bytes); 245 void AddNetworkBytes(int64_t bytes);
240 246
241 bool prerendering_has_been_cancelled() const { 247 bool prerendering_has_been_cancelled() const {
242 return prerendering_has_been_cancelled_; 248 return prerendering_has_been_cancelled_;
243 } 249 }
244 250
245 // Running byte count. Increased when each resource completes loading. 251 // Running byte count. Increased when each resource completes loading.
246 int64_t network_bytes() { return network_bytes_; } 252 int64_t network_bytes() { return network_bytes_; }
247 253
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 gfx::Rect bounds_; 371 gfx::Rect bounds_;
366 372
367 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; 373 typedef std::vector<history::HistoryAddPageArgs> AddPageVector;
368 374
369 // Caches pages to be added to the history. 375 // Caches pages to be added to the history.
370 AddPageVector add_page_vector_; 376 AddPageVector add_page_vector_;
371 377
372 // Resources that are throttled, pending a prerender use. Can only access a 378 // Resources that are throttled, pending a prerender use. Can only access a
373 // throttle on the IO thread. 379 // throttle on the IO thread.
374 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; 380 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_;
381 // Resources for which the priority was lowered to net::IDLE.
382 std::vector<base::WeakPtr<PrerenderResourceThrottle>> idle_resources_;
375 383
376 // A running tally of the number of bytes this prerender has caused to be 384 // A running tally of the number of bytes this prerender has caused to be
377 // transferred over the network for resources. Updated with AddNetworkBytes. 385 // transferred over the network for resources. Updated with AddNetworkBytes.
378 int64_t network_bytes_; 386 int64_t network_bytes_;
379 387
380 base::WeakPtrFactory<PrerenderContents> weak_factory_; 388 base::WeakPtrFactory<PrerenderContents> weak_factory_;
381 389
382 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); 390 DISALLOW_COPY_AND_ASSIGN(PrerenderContents);
383 }; 391 };
384 392
385 } // namespace prerender 393 } // namespace prerender
386 394
387 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 395 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698