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

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

Issue 2833553002: Revert of [Prerender] Restore request priorities when swapped in (Closed)
Patch Set: 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
244 // Increments the number of bytes fetched over the network for this prerender. 238 // Increments the number of bytes fetched over the network for this prerender.
245 void AddNetworkBytes(int64_t bytes); 239 void AddNetworkBytes(int64_t bytes);
246 240
247 bool prerendering_has_been_cancelled() const { 241 bool prerendering_has_been_cancelled() const {
248 return prerendering_has_been_cancelled_; 242 return prerendering_has_been_cancelled_;
249 } 243 }
250 244
251 // Running byte count. Increased when each resource completes loading. 245 // Running byte count. Increased when each resource completes loading.
252 int64_t network_bytes() { return network_bytes_; } 246 int64_t network_bytes() { return network_bytes_; }
253 247
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 gfx::Rect bounds_; 365 gfx::Rect bounds_;
372 366
373 typedef std::vector<history::HistoryAddPageArgs> AddPageVector; 367 typedef std::vector<history::HistoryAddPageArgs> AddPageVector;
374 368
375 // Caches pages to be added to the history. 369 // Caches pages to be added to the history.
376 AddPageVector add_page_vector_; 370 AddPageVector add_page_vector_;
377 371
378 // Resources that are throttled, pending a prerender use. Can only access a 372 // Resources that are throttled, pending a prerender use. Can only access a
379 // throttle on the IO thread. 373 // throttle on the IO thread.
380 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; 374 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_;
383 375
384 // A running tally of the number of bytes this prerender has caused to be 376 // A running tally of the number of bytes this prerender has caused to be
385 // transferred over the network for resources. Updated with AddNetworkBytes. 377 // transferred over the network for resources. Updated with AddNetworkBytes.
386 int64_t network_bytes_; 378 int64_t network_bytes_;
387 379
388 base::WeakPtrFactory<PrerenderContents> weak_factory_; 380 base::WeakPtrFactory<PrerenderContents> weak_factory_;
389 381
390 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); 382 DISALLOW_COPY_AND_ASSIGN(PrerenderContents);
391 }; 383 };
392 384
393 } // namespace prerender 385 } // namespace prerender
394 386
395 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ 387 #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