diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 21:37:04 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 21:37:04 +0000 |
commit | 7234e6cc82609038c3dbb5bd175e73d7ea93fd76 (patch) | |
tree | f9ec71ceb5f9a26d33799df74db6fb0988a20d42 /chrome/browser/net/sdch_dictionary_fetcher.h | |
parent | 568a0bebd0c3c296e473b2e434c679634e7c68bf (diff) | |
download | chromium_src-7234e6cc82609038c3dbb5bd175e73d7ea93fd76.zip chromium_src-7234e6cc82609038c3dbb5bd175e73d7ea93fd76.tar.gz chromium_src-7234e6cc82609038c3dbb5bd175e73d7ea93fd76.tar.bz2 |
Fetch SDCH dictionary as soon as current URL fetch completes
Rather than just waiting for 15 seconds, this patch fetches the
"suggested dicitionary" as soon as the current download completes.
This avoids stealing bandwidth from the original download, but
works as quickly as possible to get the dictionary, so that the
user can receive compression results asap.
r=wtc
Review URL: http://codereview.chromium.org/20254
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/sdch_dictionary_fetcher.h')
-rw-r--r-- | chrome/browser/net/sdch_dictionary_fetcher.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/chrome/browser/net/sdch_dictionary_fetcher.h b/chrome/browser/net/sdch_dictionary_fetcher.h index b943a24..a0a9e2f 100644 --- a/chrome/browser/net/sdch_dictionary_fetcher.h +++ b/chrome/browser/net/sdch_dictionary_fetcher.h @@ -13,6 +13,7 @@ #include <string> #include "base/compiler_specific.h" +#include "base/scoped_ptr.h" #include "base/task.h" #include "chrome/browser/net/url_fetcher.h" #include "net/base/sdch_manager.h" @@ -20,7 +21,7 @@ class SdchDictionaryFetcher : public URLFetcher::Delegate, public SdchFetcher { public: - SdchDictionaryFetcher() : + SdchDictionaryFetcher() : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), task_is_pending_(false) {} virtual ~SdchDictionaryFetcher() {} @@ -31,8 +32,11 @@ class SdchDictionaryFetcher : public URLFetcher::Delegate, virtual void Schedule(const GURL& dictionary_url); private: - // Delay between Schedule and actual download. - static const int kMsDelayFromRequestTillDownload = 15000; + // Delay in ms between Schedule and actual download. + // This leaves the URL in a queue, which is de-duped, so that there is less + // chance we'll try to load the same URL multiple times when a pile of + // page subresources (or tabs opened in parallel) all suggest the dictionary. + static const int kMsDelayFromRequestTillDownload = 100; // Ensure the download after the above delay. void ScheduleDelayedRun(); |