| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // A Predictor object is instantiated once in the browser process, and manages | 5 // A Predictor object is instantiated once in the browser process, and manages |
| 6 // both preresolution of hostnames, as well as TCP/IP preconnection to expected | 6 // both preresolution of hostnames, as well as TCP/IP preconnection to expected |
| 7 // subresources. | 7 // subresources. |
| 8 // Most hostname lists are provided by the renderer processes, and include URLs | 8 // Most hostname lists are provided by the renderer processes, and include URLs |
| 9 // that *might* be used in the near future by the browsing user. One goal of | 9 // that *might* be used in the near future by the browsing user. One goal of |
| 10 // this class is to cause the underlying DNS structure to lookup a hostname | 10 // this class is to cause the underlying DNS structure to lookup a hostname |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 // orginial hostname. | 485 // orginial hostname. |
| 486 Referrers referrers_; | 486 Referrers referrers_; |
| 487 | 487 |
| 488 // List of URLs in referrers_ currently being trimmed (scaled down to | 488 // List of URLs in referrers_ currently being trimmed (scaled down to |
| 489 // eventually be aged out of use). | 489 // eventually be aged out of use). |
| 490 std::vector<GURL> urls_being_trimmed_; | 490 std::vector<GURL> urls_being_trimmed_; |
| 491 | 491 |
| 492 // A time after which we need to do more trimming of referrers. | 492 // A time after which we need to do more trimming of referrers. |
| 493 base::TimeTicks next_trim_time_; | 493 base::TimeTicks next_trim_time_; |
| 494 | 494 |
| 495 scoped_ptr<ScopedRunnableMethodFactory<Predictor> > trim_task_factory_; | 495 scoped_ptr<base::WeakPtrFactory<Predictor> > weak_factory_; |
| 496 | 496 |
| 497 DISALLOW_COPY_AND_ASSIGN(Predictor); | 497 DISALLOW_COPY_AND_ASSIGN(Predictor); |
| 498 }; | 498 }; |
| 499 | 499 |
| 500 // This version of the predictor is used for testing. | 500 // This version of the predictor is used for testing. |
| 501 class SimplePredictor : public Predictor { | 501 class SimplePredictor : public Predictor { |
| 502 public: | 502 public: |
| 503 explicit SimplePredictor(bool preconnect_enabled) | 503 explicit SimplePredictor(bool preconnect_enabled) |
| 504 : Predictor(preconnect_enabled) {} | 504 : Predictor(preconnect_enabled) {} |
| 505 virtual ~SimplePredictor() {} | 505 virtual ~SimplePredictor() {} |
| 506 virtual void InitNetworkPredictor(PrefService* user_prefs, | 506 virtual void InitNetworkPredictor(PrefService* user_prefs, |
| 507 PrefService* local_state, | 507 PrefService* local_state, |
| 508 IOThread* io_thread); | 508 IOThread* io_thread); |
| 509 virtual void ShutdownOnUIThread(PrefService* user_prefs); | 509 virtual void ShutdownOnUIThread(PrefService* user_prefs); |
| 510 }; | 510 }; |
| 511 | 511 |
| 512 } // namespace chrome_browser_net | 512 } // namespace chrome_browser_net |
| 513 | 513 |
| 514 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 514 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
| OLD | NEW |