Chromium Code Reviews| 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 #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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 predictor->SaveDnsPrefetchStateForNextStartupAndTrim( | 787 predictor->SaveDnsPrefetchStateForNextStartupAndTrim( |
| 788 startup_list, referral_list, completion); | 788 startup_list, referral_list, completion); |
| 789 } | 789 } |
| 790 | 790 |
| 791 void Predictor::SaveStateForNextStartupAndTrim() { | 791 void Predictor::SaveStateForNextStartupAndTrim() { |
| 792 if (!predictor_enabled_) | 792 if (!predictor_enabled_) |
| 793 return; | 793 return; |
| 794 if (!CanPreresolveAndPreconnect()) | 794 if (!CanPreresolveAndPreconnect()) |
| 795 return; | 795 return; |
| 796 | 796 |
| 797 base::WaitableEvent completion(true, false); | 797 base::WaitableEvent completion( |
| 798 base::WaitableEvent::ResetPolicy::MANUAL, | |
|
Nico
2016/06/04 01:48:18
if this must be an enum class i feel it shouldn't
gab
2016/06/04 11:45:20
We thought about that [1] but decided to go this r
Nico
2016/06/04 16:33:56
I submit that if every step along the way seems to
gab
2016/06/04 19:03:22
Hmm, do you have a specific counterproposal? I'm h
| |
| 799 base::WaitableEvent::InitialState::NOT_SIGNALED); | |
| 798 | 800 |
| 799 ListPrefUpdate update_startup_list(user_prefs_, | 801 ListPrefUpdate update_startup_list(user_prefs_, |
| 800 prefs::kDnsPrefetchingStartupList); | 802 prefs::kDnsPrefetchingStartupList); |
| 801 ListPrefUpdate update_referral_list(user_prefs_, | 803 ListPrefUpdate update_referral_list(user_prefs_, |
| 802 prefs::kDnsPrefetchingHostReferralList); | 804 prefs::kDnsPrefetchingHostReferralList); |
| 803 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 805 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 804 SaveDnsPrefetchStateForNextStartupAndTrimOnIOThread( | 806 SaveDnsPrefetchStateForNextStartupAndTrimOnIOThread( |
| 805 update_startup_list.Get(), | 807 update_startup_list.Get(), |
| 806 update_referral_list.Get(), | 808 update_referral_list.Get(), |
| 807 &completion, | 809 &completion, |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1361 } | 1363 } |
| 1362 | 1364 |
| 1363 void SimplePredictor::ShutdownOnUIThread() { | 1365 void SimplePredictor::ShutdownOnUIThread() { |
| 1364 SetShutdown(true); | 1366 SetShutdown(true); |
| 1365 } | 1367 } |
| 1366 | 1368 |
| 1367 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } | 1369 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } |
| 1368 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } | 1370 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } |
| 1369 | 1371 |
| 1370 } // namespace chrome_browser_net | 1372 } // namespace chrome_browser_net |
| OLD | NEW |