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

Side by Side Diff: net/base/sdch_dictionary_fetcher.cc

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/base/sdch_dictionary_fetcher.h" 5 #include "net/base/sdch_dictionary_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
(...skipping 18 matching lines...) Expand all
29 DCHECK(CalledOnValidThread()); 29 DCHECK(CalledOnValidThread());
30 } 30 }
31 31
32 void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) { 32 void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) {
33 DCHECK(CalledOnValidThread()); 33 DCHECK(CalledOnValidThread());
34 34
35 // Avoid pushing duplicate copy onto queue. We may fetch this url again later 35 // Avoid pushing duplicate copy onto queue. We may fetch this url again later
36 // and get a different dictionary, but there is no reason to have it in the 36 // and get a different dictionary, but there is no reason to have it in the
37 // queue twice at one time. 37 // queue twice at one time.
38 if (!fetch_queue_.empty() && fetch_queue_.back() == dictionary_url) { 38 if (!fetch_queue_.empty() && fetch_queue_.back() == dictionary_url) {
39 SdchManager::SdchErrorRecovery( 39 manager_->SdchErrorRecovery(
40 SdchManager::DICTIONARY_ALREADY_SCHEDULED_TO_DOWNLOAD); 40 SdchManager::DICTIONARY_ALREADY_SCHEDULED_TO_DOWNLOAD,
41 dictionary_url);
41 return; 42 return;
42 } 43 }
43 if (attempted_load_.find(dictionary_url) != attempted_load_.end()) { 44 if (attempted_load_.find(dictionary_url) != attempted_load_.end()) {
44 SdchManager::SdchErrorRecovery( 45 manager_->SdchErrorRecovery(
45 SdchManager::DICTIONARY_ALREADY_TRIED_TO_DOWNLOAD); 46 SdchManager::DICTIONARY_ALREADY_TRIED_TO_DOWNLOAD,
47 dictionary_url);
46 return; 48 return;
47 } 49 }
48 attempted_load_.insert(dictionary_url); 50 attempted_load_.insert(dictionary_url);
49 fetch_queue_.push(dictionary_url); 51 fetch_queue_.push(dictionary_url);
50 ScheduleDelayedRun(); 52 ScheduleDelayedRun();
51 } 53 }
52 54
53 void SdchDictionaryFetcher::Cancel() { 55 void SdchDictionaryFetcher::Cancel() {
54 DCHECK(CalledOnValidThread()); 56 DCHECK(CalledOnValidThread());
55 57
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 (source->GetStatus().status() == URLRequestStatus::SUCCESS)) { 98 (source->GetStatus().status() == URLRequestStatus::SUCCESS)) {
97 std::string data; 99 std::string data;
98 source->GetResponseAsString(&data); 100 source->GetResponseAsString(&data);
99 manager_->AddSdchDictionary(data, source->GetURL()); 101 manager_->AddSdchDictionary(data, source->GetURL());
100 } 102 }
101 current_fetch_.reset(NULL); 103 current_fetch_.reset(NULL);
102 ScheduleDelayedRun(); 104 ScheduleDelayedRun();
103 } 105 }
104 106
105 } // namespace net 107 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698