Index: net/base/sdch_dictionary_fetcher.cc |
diff --git a/net/base/sdch_dictionary_fetcher.cc b/net/base/sdch_dictionary_fetcher.cc |
index 3e6f590852c3ec84ec343f516ceb6c6e481133f9..a828344926e9bea1d42d5444fe0c25d03a731ec5 100644 |
--- a/net/base/sdch_dictionary_fetcher.cc |
+++ b/net/base/sdch_dictionary_fetcher.cc |
@@ -40,22 +40,19 @@ SdchDictionaryFetcher::~SdchDictionaryFetcher() { |
DCHECK(CalledOnValidThread()); |
} |
-void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) { |
+SdchFetcher::ScheduleResult SdchDictionaryFetcher::Schedule( |
+ const GURL& dictionary_url) { |
DCHECK(CalledOnValidThread()); |
// Avoid pushing duplicate copy onto queue. We may fetch this url again later |
// and get a different dictionary, but there is no reason to have it in the |
// queue twice at one time. |
- if (!fetch_queue_.empty() && fetch_queue_.back() == dictionary_url) { |
- SdchManager::SdchErrorRecovery( |
- SdchManager::DICTIONARY_ALREADY_SCHEDULED_TO_DOWNLOAD); |
- return; |
- } |
- if (attempted_load_.find(dictionary_url) != attempted_load_.end()) { |
- SdchManager::SdchErrorRecovery( |
- SdchManager::DICTIONARY_ALREADY_TRIED_TO_DOWNLOAD); |
- return; |
- } |
+ if (!fetch_queue_.empty() && fetch_queue_.back() == dictionary_url) |
+ return ALREADY_SCHEDULED; |
+ |
+ if (attempted_load_.find(dictionary_url) != attempted_load_.end()) |
+ return ALREADY_TRIED; |
+ |
attempted_load_.insert(dictionary_url); |
fetch_queue_.push(dictionary_url); |
@@ -65,6 +62,8 @@ void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) { |
// and Schedule() is only called from user code, so this call to DoLoop() |
// does not require an |if (in_loop_) return;| guard. |
DoLoop(OK); |
+ |
+ return SCHEDULE_OK; |
} |
void SdchDictionaryFetcher::Cancel() { |
@@ -162,6 +161,7 @@ int SdchDictionaryFetcher::DoDispatchRequest(int rv) { |
fetch_queue_.front(), IDLE, this, NULL); |
current_request_->SetLoadFlags(LOAD_DO_NOT_SEND_COOKIES | |
LOAD_DO_NOT_SAVE_COOKIES); |
+ current_request_->net_log().AddEvent(NetLog::TYPE_SDCH_DICTIONARY_FETCH); |
buffer_ = new IOBuffer(kBufferSize); |
fetch_queue_.pop(); |
@@ -221,7 +221,8 @@ int SdchDictionaryFetcher::DoCompleteRequest(int rv) { |
// If the dictionary was successfully fetched, add it to the manager. |
if (rv == OK) |
- consumer_->AddSdchDictionary(dictionary_, current_request_->url()); |
+ consumer_->AddSdchDictionary( |
+ dictionary_, current_request_->url(), current_request_->net_log()); |
current_request_.reset(); |
buffer_ = NULL; |