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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 } | 606 } |
607 } | 607 } |
608 | 608 |
609 void Predictor::DeserializeReferrers(const base::ListValue& referral_list) { | 609 void Predictor::DeserializeReferrers(const base::ListValue& referral_list) { |
610 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 610 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
611 int format_version = -1; | 611 int format_version = -1; |
612 if (referral_list.GetSize() > 0 && | 612 if (referral_list.GetSize() > 0 && |
613 referral_list.GetInteger(0, &format_version) && | 613 referral_list.GetInteger(0, &format_version) && |
614 format_version == kPredictorReferrerVersion) { | 614 format_version == kPredictorReferrerVersion) { |
615 for (size_t i = 1; i < referral_list.GetSize(); ++i) { | 615 for (size_t i = 1; i < referral_list.GetSize(); ++i) { |
616 base::ListValue* motivator; | 616 const base::ListValue* motivator; |
617 if (!referral_list.GetList(i, &motivator)) { | 617 if (!referral_list.GetList(i, &motivator)) { |
618 NOTREACHED(); | 618 NOTREACHED(); |
619 return; | 619 return; |
620 } | 620 } |
621 std::string motivating_url_spec; | 621 std::string motivating_url_spec; |
622 if (!motivator->GetString(0, &motivating_url_spec)) { | 622 if (!motivator->GetString(0, &motivating_url_spec)) { |
623 NOTREACHED(); | 623 NOTREACHED(); |
624 return; | 624 return; |
625 } | 625 } |
626 | 626 |
627 Value* subresource_list; | 627 const Value* subresource_list; |
628 if (!motivator->Get(1, &subresource_list)) { | 628 if (!motivator->Get(1, &subresource_list)) { |
629 NOTREACHED(); | 629 NOTREACHED(); |
630 return; | 630 return; |
631 } | 631 } |
632 | 632 |
633 referrers_[GURL(motivating_url_spec)].Deserialize(*subresource_list); | 633 referrers_[GURL(motivating_url_spec)].Deserialize(*subresource_list); |
634 } | 634 } |
635 } | 635 } |
636 } | 636 } |
637 | 637 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 IOThread* io_thread, | 1176 IOThread* io_thread, |
1177 net::URLRequestContextGetter* getter) { | 1177 net::URLRequestContextGetter* getter) { |
1178 // Empty function for unittests. | 1178 // Empty function for unittests. |
1179 } | 1179 } |
1180 | 1180 |
1181 void SimplePredictor::ShutdownOnUIThread(PrefService* user_prefs) { | 1181 void SimplePredictor::ShutdownOnUIThread(PrefService* user_prefs) { |
1182 SetShutdown(true); | 1182 SetShutdown(true); |
1183 } | 1183 } |
1184 | 1184 |
1185 } // namespace chrome_browser_net | 1185 } // namespace chrome_browser_net |
OLD | NEW |