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

Unified Diff: net/url_request/sdch_dictionary_fetcher.cc

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix component linkage 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/url_request/sdch_dictionary_fetcher.h ('k') | net/url_request/sdch_dictionary_fetcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/sdch_dictionary_fetcher.cc
diff --git a/net/url_request/sdch_dictionary_fetcher.cc b/net/url_request/sdch_dictionary_fetcher.cc
index 580619312c8ef646ef9d469b4fccdb1691c60dd6..5ac65efc96df2813918c298a7c41d1919d54d015 100644
--- a/net/url_request/sdch_dictionary_fetcher.cc
+++ b/net/url_request/sdch_dictionary_fetcher.cc
@@ -11,6 +11,7 @@
#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"
@@ -45,16 +46,15 @@ void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) {
// 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) {
+ if ((!fetch_queue_.empty() && fetch_queue_.back() == dictionary_url) ||
+ attempted_load_.find(dictionary_url) != attempted_load_.end()) {
+ // TODO(rdsmith): log this error to the net log of the URLRequest
+ // initiating this fetch, once URLRequest will be passed here.
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);
+ SDCH_DICTIONARY_PREVIOUSLY_SCHEDULED_TO_DOWNLOAD);
return;
}
+
attempted_load_.insert(dictionary_url);
fetch_queue_.push(dictionary_url);
@@ -166,6 +166,7 @@ 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;
}
@@ -207,7 +208,12 @@ 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.
- SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_FETCH_READ_FAILED);
+ SdchManager::SdchErrorRecovery(SDCH_DICTIONARY_FETCH_READ_FAILED);
+ current_request_->net_log().AddEvent(
+ NetLog::TYPE_SDCH_DICTIONARY_ERROR,
+ base::Bind(&NetLogSdchDictionaryFetchProblemCallback,
+ SDCH_DICTIONARY_FETCH_READ_FAILED, current_request_->url(),
+ true));
DLOG(FATAL)
<< "URLRequest::Read() returned false without IO pending or error!";
return ERR_FAILED;
@@ -228,8 +234,10 @@ int SdchDictionaryFetcher::DoCompleteRequest(int rv) {
DCHECK(CalledOnValidThread());
// If the dictionary was successfully fetched, add it to the manager.
- if (rv == OK)
- dictionary_fetched_callback_.Run(dictionary_, current_request_->url());
+ if (rv == OK) {
+ dictionary_fetched_callback_.Run(dictionary_, current_request_->url(),
+ current_request_->net_log());
+ }
current_request_.reset();
buffer_ = NULL;
« no previous file with comments | « net/url_request/sdch_dictionary_fetcher.h ('k') | net/url_request/sdch_dictionary_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698