diff options
author | paivanof@gmail.com <paivanof@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-23 17:15:10 +0000 |
---|---|---|
committer | paivanof@gmail.com <paivanof@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-23 17:15:10 +0000 |
commit | 36ffc73476203ce0ab507e79e481702e317a6922 (patch) | |
tree | 8dde21160cfeb6e5ae42643470226f19bd2e6b2d /content | |
parent | 9b000129350fe5a26574a013c44915b23acf2918 (diff) | |
download | chromium_src-36ffc73476203ce0ab507e79e481702e317a6922.zip chromium_src-36ffc73476203ce0ab507e79e481702e317a6922.tar.gz chromium_src-36ffc73476203ce0ab507e79e481702e317a6922.tar.bz2 |
Offload disk accesses to WorkerPool in ExtensionProtocolHandler
and URLRequestResourceBundleJob.
To achieve that URLRequestSimpleJob::GetData() signature changed
to allow async operation finishing. All places implementing GetData()
are updated.
Patch from Pavel Ivanov <paivanof@gmail.com>
BUG=59849,90207
Review URL: https://chromiumcodereview.appspot.com/10696135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
5 files changed, 28 insertions, 19 deletions
diff --git a/content/browser/histogram_internals_request_job.cc b/content/browser/histogram_internals_request_job.cc index 6614642..8989210 100644 --- a/content/browser/histogram_internals_request_job.cc +++ b/content/browser/histogram_internals_request_job.cc @@ -9,6 +9,7 @@ #include "content/browser/histogram_synchronizer.h" #include "googleurl/src/gurl.h" #include "net/base/escape.h" +#include "net/base/net_errors.h" #include "net/url_request/url_request.h" namespace content { @@ -59,15 +60,17 @@ void AboutHistogram(std::string* data, const std::string& path) { base::StatisticsRecorder::WriteHTMLGraph(unescaped_query, data); } -bool HistogramInternalsRequestJob::GetData(std::string* mime_type, - std::string* charset, - std::string* data) const { +int HistogramInternalsRequestJob::GetData( + std::string* mime_type, + std::string* charset, + std::string* data, + const net::CompletionCallback& callback) const { mime_type->assign("text/html"); charset->assign("UTF8"); data->clear(); AboutHistogram(data, path_); - return true; + return net::OK; } } // namespace content diff --git a/content/browser/histogram_internals_request_job.h b/content/browser/histogram_internals_request_job.h index 0613af3..b5d11ce 100644 --- a/content/browser/histogram_internals_request_job.h +++ b/content/browser/histogram_internals_request_job.h @@ -16,9 +16,10 @@ class HistogramInternalsRequestJob : public net::URLRequestSimpleJob { public: explicit HistogramInternalsRequestJob(net::URLRequest* request); - virtual bool GetData(std::string* mime_type, - std::string* charset, - std::string* data) const OVERRIDE; + virtual int GetData(std::string* mime_type, + std::string* charset, + std::string* data, + const net::CompletionCallback& callback) const OVERRIDE; private: virtual ~HistogramInternalsRequestJob() {} diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc index 263e3bc..d22181d 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -311,22 +311,23 @@ class URLRequestBigJob : public net::URLRequestSimpleJob { : net::URLRequestSimpleJob(request) { } - virtual bool GetData(std::string* mime_type, - std::string* charset, - std::string* data) const { + virtual int GetData(std::string* mime_type, + std::string* charset, + std::string* data, + const net::CompletionCallback& callback) const OVERRIDE { *mime_type = "text/plain"; *charset = "UTF-8"; std::string text; int count; if (!ParseURL(request_->url(), &text, &count)) - return false; + return net::ERR_INVALID_URL; data->reserve(text.size() * count); for (int i = 0; i < count; ++i) data->append(text); - return true; + return net::OK; } private: diff --git a/content/browser/tcmalloc_internals_request_job.cc b/content/browser/tcmalloc_internals_request_job.cc index 709ec66..5b0c45b 100644 --- a/content/browser/tcmalloc_internals_request_job.cc +++ b/content/browser/tcmalloc_internals_request_job.cc @@ -10,6 +10,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/process_type.h" +#include "net/base/net_errors.h" namespace content { @@ -101,9 +102,11 @@ void AboutTcmalloc(std::string* data) { } #endif -bool TcmallocInternalsRequestJob::GetData(std::string* mime_type, - std::string* charset, - std::string* data) const { +int TcmallocInternalsRequestJob::GetData( + std::string* mime_type, + std::string* charset, + std::string* data, + const net::CompletionCallback& callback) const { mime_type->assign("text/html"); charset->assign("UTF8"); @@ -111,7 +114,7 @@ bool TcmallocInternalsRequestJob::GetData(std::string* mime_type, #if defined(USE_TCMALLOC) AboutTcmalloc(data); #endif - return true; + return net::OK; } } // namespace content diff --git a/content/browser/tcmalloc_internals_request_job.h b/content/browser/tcmalloc_internals_request_job.h index bfdbb9a..e70c274 100644 --- a/content/browser/tcmalloc_internals_request_job.h +++ b/content/browser/tcmalloc_internals_request_job.h @@ -50,9 +50,10 @@ class TcmallocInternalsRequestJob : public net::URLRequestSimpleJob { public: explicit TcmallocInternalsRequestJob(net::URLRequest* request); - virtual bool GetData(std::string* mime_type, - std::string* charset, - std::string* data) const OVERRIDE; + virtual int GetData(std::string* mime_type, + std::string* charset, + std::string* data, + const net::CompletionCallback& callback) const OVERRIDE; protected: virtual ~TcmallocInternalsRequestJob() {} |