Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: net/base/sdch_dictionary_fetcher.cc

Issue 704493002: Revert "Sdch view for net-internals" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/sdch_dictionary_fetcher.h ('k') | net/base/sdch_dictionary_fetcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_dictionary_fetcher.cc
diff --git a/net/base/sdch_dictionary_fetcher.cc b/net/base/sdch_dictionary_fetcher.cc
index e4b4b5ae9f6740f1d324f2f7fa58aad4c741d5ed..8d08b9a678afabacd828ee0b8efb70989362fabf 100644
--- a/net/base/sdch_dictionary_fetcher.cc
+++ b/net/base/sdch_dictionary_fetcher.cc
@@ -11,7 +11,6 @@
#include "base/compiler_specific.h"
#include "base/thread_task_runner_handle.h"
#include "net/base/load_flags.h"
-#include "net/base/sdch_net_log_params.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_status.h"
#include "net/url_request/url_request_throttler_manager.h"
@@ -41,18 +40,22 @@ SdchDictionaryFetcher::~SdchDictionaryFetcher() {
DCHECK(CalledOnValidThread());
}
-bool SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) {
+void 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)
- return false;
-
- if (attempted_load_.find(dictionary_url) != attempted_load_.end())
- return false;
-
+ 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;
+ }
attempted_load_.insert(dictionary_url);
fetch_queue_.push(dictionary_url);
@@ -62,8 +65,6 @@ bool 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 true;
}
void SdchDictionaryFetcher::Cancel() {
@@ -166,7 +167,6 @@ int SdchDictionaryFetcher::DoDispatchRequest(int rv) {
next_state_ = STATE_REQUEST_STARTED;
current_request_->Start();
- current_request_->net_log().AddEvent(NetLog::TYPE_SDCH_DICTIONARY_FETCH);
return OK;
}
@@ -208,7 +208,7 @@ int SdchDictionaryFetcher::DoRead(int rv) {
// an infinite loop. It's not clear how to handle a read failure
// without a promise to invoke the callback at some point in the future,
// so the request is failed.
- LogDictionaryFetchError(SDCH_DICTIONARY_FETCH_READ_FAILED);
+ SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_FETCH_READ_FAILED);
DLOG(FATAL) <<
"URLRequest::Read() returned false without IO pending or error!";
return ERR_FAILED;
@@ -229,12 +229,8 @@ int SdchDictionaryFetcher::DoCompleteRequest(int rv) {
DCHECK(CalledOnValidThread());
// If the dictionary was successfully fetched, add it to the manager.
- if (rv == OK) {
- SdchProblemCode problem =
- consumer_->AddSdchDictionary(dictionary_, current_request_->url());
- if (problem != SDCH_OK)
- LogDictionaryFetchError(problem);
- }
+ if (rv == OK)
+ consumer_->AddSdchDictionary(dictionary_, current_request_->url());
current_request_.reset();
buffer_ = NULL;
@@ -245,15 +241,4 @@ int SdchDictionaryFetcher::DoCompleteRequest(int rv) {
return OK;
}
-void SdchDictionaryFetcher::LogDictionaryFetchError(SdchProblemCode error) {
- CHECK(current_request_.get());
- SdchManager::SdchErrorRecovery(error);
- current_request_->net_log().AddEvent(
- NetLog::TYPE_SDCH_DICTIONARY_ERROR,
- base::Bind(&NetLogSdchDictionaryFetchProblemCallback,
- error,
- current_request_->url(),
- true));
-}
-
} // namespace net
« no previous file with comments | « net/base/sdch_dictionary_fetcher.h ('k') | net/base/sdch_dictionary_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698