OLD | NEW |
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 <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 base::Time earliest_create_date); | 296 base::Time earliest_create_date); |
297 | 297 |
298 static const int kNumCookieStatuses; | 298 static const int kNumCookieStatuses; |
299 | 299 |
300 // Called when a PrerenderResourceThrottle defers a request. If the prerender | 300 // Called when a PrerenderResourceThrottle defers a request. If the prerender |
301 // is used it'll be resumed on the IO thread, otherwise they will get | 301 // is used it'll be resumed on the IO thread, otherwise they will get |
302 // cancelled automatically if prerendering is cancelled. | 302 // cancelled automatically if prerendering is cancelled. |
303 void AddResourceThrottle( | 303 void AddResourceThrottle( |
304 const base::WeakPtr<PrerenderResourceThrottle>& throttle); | 304 const base::WeakPtr<PrerenderResourceThrottle>& throttle); |
305 | 305 |
| 306 // Increments the number of bytes fetched over the network for this prerender. |
| 307 void AddNetworkBytes(int64 bytes); |
| 308 |
306 protected: | 309 protected: |
307 PrerenderContents(PrerenderManager* prerender_manager, | 310 PrerenderContents(PrerenderManager* prerender_manager, |
308 Profile* profile, | 311 Profile* profile, |
309 const GURL& url, | 312 const GURL& url, |
310 const content::Referrer& referrer, | 313 const content::Referrer& referrer, |
311 Origin origin, | 314 Origin origin, |
312 uint8 experiment_id); | 315 uint8 experiment_id); |
313 | 316 |
314 // Set the final status for how the PrerenderContents was used. This | 317 // Set the final status for how the PrerenderContents was used. This |
315 // should only be called once, and should be called before the prerender | 318 // should only be called once, and should be called before the prerender |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 alias_session_storage_namespace; | 457 alias_session_storage_namespace; |
455 | 458 |
456 // Indicates what internal cookie events (see prerender_contents.cc) have | 459 // Indicates what internal cookie events (see prerender_contents.cc) have |
457 // occurred, using 1 bit for each possible InternalCookieEvent. | 460 // occurred, using 1 bit for each possible InternalCookieEvent. |
458 int cookie_status_; | 461 int cookie_status_; |
459 | 462 |
460 // Resources that are throttled, pending a prerender use. Can only access a | 463 // Resources that are throttled, pending a prerender use. Can only access a |
461 // throttle on the IO thread. | 464 // throttle on the IO thread. |
462 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; | 465 std::vector<base::WeakPtr<PrerenderResourceThrottle> > resource_throttles_; |
463 | 466 |
| 467 // A running tally of the number of bytes this prerender has caused to be |
| 468 // transferred over the network for resources. Updated with AddNetworkBytes. |
| 469 int64 network_bytes_; |
| 470 |
464 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); | 471 DISALLOW_COPY_AND_ASSIGN(PrerenderContents); |
465 }; | 472 }; |
466 | 473 |
467 } // namespace prerender | 474 } // namespace prerender |
468 | 475 |
469 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ | 476 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_CONTENTS_H_ |
OLD | NEW |