| 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 599 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 600 // Just finish up work if an incremental trim is in progress. | 600 // Just finish up work if an incremental trim is in progress. |
| 601 if (urls_being_trimmed_.empty()) | 601 if (urls_being_trimmed_.empty()) |
| 602 LoadUrlsForTrimming(); | 602 LoadUrlsForTrimming(); |
| 603 IncrementalTrimReferrers(true); // Do everything now. | 603 IncrementalTrimReferrers(true); // Do everything now. |
| 604 } | 604 } |
| 605 | 605 |
| 606 void Predictor::SerializeReferrers(ListValue* referral_list) { | 606 void Predictor::SerializeReferrers(ListValue* referral_list) { |
| 607 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 607 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 608 referral_list->Clear(); | 608 referral_list->Clear(); |
| 609 referral_list->Append(new FundamentalValue(PREDICTOR_REFERRER_VERSION)); | 609 referral_list->Append(new base::FundamentalValue(PREDICTOR_REFERRER_VERSION)); |
| 610 for (Referrers::const_iterator it = referrers_.begin(); | 610 for (Referrers::const_iterator it = referrers_.begin(); |
| 611 it != referrers_.end(); ++it) { | 611 it != referrers_.end(); ++it) { |
| 612 // Serialize the list of subresource names. | 612 // Serialize the list of subresource names. |
| 613 Value* subresource_list(it->second.Serialize()); | 613 Value* subresource_list(it->second.Serialize()); |
| 614 | 614 |
| 615 // Create a list for each referer. | 615 // Create a list for each referer. |
| 616 ListValue* motivator(new ListValue); | 616 ListValue* motivator(new ListValue); |
| 617 motivator->Append(new StringValue(it->first.spec())); | 617 motivator->Append(new StringValue(it->first.spec())); |
| 618 motivator->Append(subresource_list); | 618 motivator->Append(subresource_list); |
| 619 | 619 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 // If we omit a port, it will default to 80 or 443 as appropriate. | 763 // If we omit a port, it will default to 80 or 443 as appropriate. |
| 764 std::string colon_plus_port; | 764 std::string colon_plus_port; |
| 765 if (url.has_port()) | 765 if (url.has_port()) |
| 766 colon_plus_port = ":" + url.port(); | 766 colon_plus_port = ":" + url.port(); |
| 767 | 767 |
| 768 return GURL(scheme + "://" + url.host() + colon_plus_port); | 768 return GURL(scheme + "://" + url.host() + colon_plus_port); |
| 769 } | 769 } |
| 770 | 770 |
| 771 | 771 |
| 772 } // namespace chrome_browser_net | 772 } // namespace chrome_browser_net |
| OLD | NEW |