| 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 // Support modularity by calling to load a new SDCH filter dictionary. | 5 // Support modularity by calling to load a new SDCH filter dictionary. |
| 6 // Note that this sort of calling can't be done in the /net directory, as it has | 6 // Note that this sort of calling can't be done in the /net directory, as it has |
| 7 // no concept of the HTTP cache (which is only visible at the browser level). | 7 // no concept of the HTTP cache (which is only visible at the browser level). |
| 8 | 8 |
| 9 #ifndef NET_BASE_SDCH_DICTIONARY_FETCHER_H_ | 9 #ifndef NET_BASE_SDCH_DICTIONARY_FETCHER_H_ |
| 10 #define NET_BASE_SDCH_DICTIONARY_FETCHER_H_ | 10 #define NET_BASE_SDCH_DICTIONARY_FETCHER_H_ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // page subresources (or tabs opened in parallel) all suggest the dictionary. | 47 // page subresources (or tabs opened in parallel) all suggest the dictionary. |
| 48 static const int kMsDelayFromRequestTillDownload = 100; | 48 static const int kMsDelayFromRequestTillDownload = 100; |
| 49 | 49 |
| 50 // Ensure the download after the above delay. | 50 // Ensure the download after the above delay. |
| 51 void ScheduleDelayedRun(); | 51 void ScheduleDelayedRun(); |
| 52 | 52 |
| 53 // Make sure we're processing (or waiting for) the the arrival of the next URL | 53 // Make sure we're processing (or waiting for) the the arrival of the next URL |
| 54 // in the |fetch_queue_|. | 54 // in the |fetch_queue_|. |
| 55 void StartFetching(); | 55 void StartFetching(); |
| 56 | 56 |
| 57 // Report sdch problem to netlog and add histogram. |
| 58 void LogSdchProblem(SdchManager::ProblemCodes problem, GURL url) const; |
| 59 |
| 57 // Implementation of URLFetcherDelegate. Called after transmission | 60 // Implementation of URLFetcherDelegate. Called after transmission |
| 58 // completes (either successfully or with failure). | 61 // completes (either successfully or with failure). |
| 59 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 62 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; |
| 60 | 63 |
| 61 SdchManager* const manager_; | 64 SdchManager* const manager_; |
| 62 | 65 |
| 63 // A queue of URLs that are being used to download dictionaries. | 66 // A queue of URLs that are being used to download dictionaries. |
| 64 std::queue<GURL> fetch_queue_; | 67 std::queue<GURL> fetch_queue_; |
| 65 // The currently outstanding URL fetch of a dicitonary. | 68 // The currently outstanding URL fetch of a dicitonary. |
| 66 // If this is null, then there is no outstanding request. | 69 // If this is null, then there is no outstanding request. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 84 // bandwidth trying repeatedly). | 87 // bandwidth trying repeatedly). |
| 85 // The following set lists all the dictionary URLs that we've tried to load, | 88 // The following set lists all the dictionary URLs that we've tried to load, |
| 86 // so that we won't try to load from an URL more than once. | 89 // so that we won't try to load from an URL more than once. |
| 87 // TODO(jar): Try to augment the SDCH proposal to include this restiction. | 90 // TODO(jar): Try to augment the SDCH proposal to include this restiction. |
| 88 std::set<GURL> attempted_load_; | 91 std::set<GURL> attempted_load_; |
| 89 | 92 |
| 90 // Store the system_url_request_context_getter to use it when we start | 93 // Store the system_url_request_context_getter to use it when we start |
| 91 // fetching. | 94 // fetching. |
| 92 scoped_refptr<URLRequestContextGetter> context_; | 95 scoped_refptr<URLRequestContextGetter> context_; |
| 93 | 96 |
| 97 BoundNetLog net_log_; |
| 98 |
| 94 DISALLOW_COPY_AND_ASSIGN(SdchDictionaryFetcher); | 99 DISALLOW_COPY_AND_ASSIGN(SdchDictionaryFetcher); |
| 95 }; | 100 }; |
| 96 | 101 |
| 97 } // namespace net | 102 } // namespace net |
| 98 | 103 |
| 99 #endif // NET_BASE_SDCH_DICTIONARY_FETCHER_H_ | 104 #endif // NET_BASE_SDCH_DICTIONARY_FETCHER_H_ |
| OLD | NEW |