| OLD | NEW |
| 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" |
| 11 #include "net/url_request/url_fetcher.h" | 11 #include "net/url_request/url_fetcher.h" |
| 12 #include "net/url_request/url_request_context_getter.h" | 12 #include "net/url_request/url_request_context_getter.h" |
| 13 #include "net/url_request/url_request_status.h" | 13 #include "net/url_request/url_request_status.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 SdchDictionaryFetcher::SdchDictionaryFetcher( | 17 SdchDictionaryFetcher::SdchDictionaryFetcher( |
| 18 SdchManager* manager, | 18 SdchManager* manager, |
| 19 scoped_refptr<URLRequestContextGetter> context) | 19 scoped_refptr<URLRequestContextGetter> context) |
| 20 : manager_(manager), | 20 : manager_(manager), |
| 21 weak_factory_(this), | |
| 22 task_is_pending_(false), | 21 task_is_pending_(false), |
| 23 context_(context) { | 22 context_(context), |
| 23 weak_factory_(this) { |
| 24 DCHECK(CalledOnValidThread()); | 24 DCHECK(CalledOnValidThread()); |
| 25 DCHECK(manager); | 25 DCHECK(manager); |
| 26 } | 26 } |
| 27 | 27 |
| 28 SdchDictionaryFetcher::~SdchDictionaryFetcher() { | 28 SdchDictionaryFetcher::~SdchDictionaryFetcher() { |
| 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()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 (source->GetStatus().status() == URLRequestStatus::SUCCESS)) { | 96 (source->GetStatus().status() == URLRequestStatus::SUCCESS)) { |
| 97 std::string data; | 97 std::string data; |
| 98 source->GetResponseAsString(&data); | 98 source->GetResponseAsString(&data); |
| 99 manager_->AddSdchDictionary(data, source->GetURL()); | 99 manager_->AddSdchDictionary(data, source->GetURL()); |
| 100 } | 100 } |
| 101 current_fetch_.reset(NULL); | 101 current_fetch_.reset(NULL); |
| 102 ScheduleDelayedRun(); | 102 ScheduleDelayedRun(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace net | 105 } // namespace net |
| OLD | NEW |