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 #include "chrome/browser/net/predictor.h" | 5 #include "chrome/browser/net/predictor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <set> | 9 #include <set> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 const UrlList& startup_urls, | 690 const UrlList& startup_urls, |
691 base::ListValue* referral_list, | 691 base::ListValue* referral_list, |
692 IOThread* io_thread, | 692 IOThread* io_thread, |
693 bool predictor_enabled) { | 693 bool predictor_enabled) { |
694 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 694 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
695 | 695 |
696 predictor_enabled_ = predictor_enabled; | 696 predictor_enabled_ = predictor_enabled; |
697 initial_observer_.reset(new InitialObserver()); | 697 initial_observer_.reset(new InitialObserver()); |
698 host_resolver_ = io_thread->globals()->host_resolver.get(); | 698 host_resolver_ = io_thread->globals()->host_resolver.get(); |
699 | 699 |
700 // ScopedRunnableMethodFactory instances need to be created and destroyed | 700 // base::WeakPtrFactory instances need to be created and destroyed |
701 // on the same thread. The predictor lives on the IO thread and will die | 701 // on the same thread. The predictor lives on the IO thread and will die |
702 // from there so now that we're on the IO thread we need to properly | 702 // from there so now that we're on the IO thread we need to properly |
703 // initialize the ScopedrunnableMethodFactory. | 703 // initialize the base::WeakPtrFactory. |
704 // TODO(groby): Check if WeakPtrFactory has the same constraint. | 704 // TODO(groby): Check if WeakPtrFactory has the same constraint. |
705 weak_factory_.reset(new base::WeakPtrFactory<Predictor>(this)); | 705 weak_factory_.reset(new base::WeakPtrFactory<Predictor>(this)); |
706 | 706 |
707 // Prefetch these hostnames on startup. | 707 // Prefetch these hostnames on startup. |
708 DnsPrefetchMotivatedList(startup_urls, UrlInfo::STARTUP_LIST_MOTIVATED); | 708 DnsPrefetchMotivatedList(startup_urls, UrlInfo::STARTUP_LIST_MOTIVATED); |
709 DeserializeReferrersThenDelete(referral_list); | 709 DeserializeReferrersThenDelete(referral_list); |
710 } | 710 } |
711 | 711 |
712 //----------------------------------------------------------------------------- | 712 //----------------------------------------------------------------------------- |
713 // This section intermingles prefetch results with actual browser HTTP | 713 // This section intermingles prefetch results with actual browser HTTP |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 PrefService* local_state, | 1205 PrefService* local_state, |
1206 IOThread* io_thread) { | 1206 IOThread* io_thread) { |
1207 // Empty function for unittests. | 1207 // Empty function for unittests. |
1208 } | 1208 } |
1209 | 1209 |
1210 void SimplePredictor::ShutdownOnUIThread(PrefService* user_prefs) { | 1210 void SimplePredictor::ShutdownOnUIThread(PrefService* user_prefs) { |
1211 SetShutdown(true); | 1211 SetShutdown(true); |
1212 } | 1212 } |
1213 | 1213 |
1214 } // namespace chrome_browser_net | 1214 } // namespace chrome_browser_net |
OLD | NEW |