| 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 <time.h> | 5 #include <time.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 WaitForResolutionHelper(Predictor* predictor, const UrlList& hosts, | 37 WaitForResolutionHelper(Predictor* predictor, const UrlList& hosts, |
| 38 HelperTimer* timer) | 38 HelperTimer* timer) |
| 39 : predictor_(predictor), | 39 : predictor_(predictor), |
| 40 hosts_(hosts), | 40 hosts_(hosts), |
| 41 timer_(timer) { | 41 timer_(timer) { |
| 42 } | 42 } |
| 43 | 43 |
| 44 void Run() { | 44 void Run() { |
| 45 for (UrlList::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) | 45 for (UrlList::const_iterator i = hosts_.begin(); i != hosts_.end(); ++i) |
| 46 if (predictor_->GetResolutionDuration(*i) == | 46 if (predictor_->GetResolutionDuration(*i) == |
| 47 UrlInfo::kNullDuration) | 47 UrlInfo::NullDuration()) |
| 48 return; // We don't have resolution for that host. | 48 return; // We don't have resolution for that host. |
| 49 | 49 |
| 50 // When all hostnames have been resolved, exit the loop. | 50 // When all hostnames have been resolved, exit the loop. |
| 51 timer_->Stop(); | 51 timer_->Stop(); |
| 52 MessageLoop::current()->Quit(); | 52 MessageLoop::current()->Quit(); |
| 53 delete timer_; | 53 delete timer_; |
| 54 delete this; | 54 delete this; |
| 55 } | 55 } |
| 56 | 56 |
| 57 private: | 57 private: |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 EXPECT_EQ(2U, referral_list.GetSize()); | 668 EXPECT_EQ(2U, referral_list.GetSize()); |
| 669 | 669 |
| 670 predictor.DiscardAllResults(); | 670 predictor.DiscardAllResults(); |
| 671 predictor.SerializeReferrers(&referral_list); | 671 predictor.SerializeReferrers(&referral_list); |
| 672 EXPECT_EQ(1U, referral_list.GetSize()); | 672 EXPECT_EQ(1U, referral_list.GetSize()); |
| 673 | 673 |
| 674 predictor.Shutdown(); | 674 predictor.Shutdown(); |
| 675 } | 675 } |
| 676 | 676 |
| 677 } // namespace chrome_browser_net | 677 } // namespace chrome_browser_net |
| OLD | NEW |