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 /webkit | |
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 'webkit')
-rw-r--r-- | webkit/appcache/view_appcache_internals_job.cc | 37 | ||||
-rw-r--r-- | webkit/blob/view_blob_internals_job.cc | 11 | ||||
-rw-r--r-- | webkit/blob/view_blob_internals_job.h | 9 |
3 files changed, 33 insertions, 24 deletions
diff --git a/webkit/appcache/view_appcache_internals_job.cc b/webkit/appcache/view_appcache_internals_job.cc index 3c043ba..da6ff63 100644 --- a/webkit/appcache/view_appcache_internals_job.cc +++ b/webkit/appcache/view_appcache_internals_job.cc @@ -19,6 +19,7 @@ #include "base/utf_string_conversions.h" #include "net/base/escape.h" #include "net/base/io_buffer.h" +#include "net/base/net_errors.h" #include "net/http/http_response_headers.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_simple_job.h" @@ -334,9 +335,10 @@ class MainPageJob : public BaseInternalsJob { } // Produces a page containing the listing - virtual bool GetData(std::string* mime_type, - std::string* charset, - std::string* out) const { + virtual int GetData(std::string* mime_type, + std::string* charset, + std::string* out, + const net::CompletionCallback& callback) const OVERRIDE { mime_type->assign("text/html"); charset->assign("UTF-8"); @@ -361,7 +363,7 @@ class MainPageJob : public BaseInternalsJob { EmitAppCacheInfoVector(base_url, appcache_service_, appcaches, out); } EmitPageEnd(out); - return true; + return net::OK; } private: @@ -384,10 +386,11 @@ class RedirectToMainPageJob : public BaseInternalsJob { RedirectToMainPageJob(net::URLRequest* request, AppCacheService* service) : BaseInternalsJob(request, service) {} - virtual bool GetData(std::string* mime_type, - std::string* charset, - std::string* data) const { - return true; // IsRedirectResponse induces a redirect. + virtual int GetData(std::string* mime_type, + std::string* charset, + std::string* data, + const net::CompletionCallback& callback) const OVERRIDE { + return net::OK; // IsRedirectResponse induces a redirect. } virtual bool IsRedirectResponse(GURL* location, int* http_status_code) { @@ -447,9 +450,10 @@ class ViewAppCacheJob : public BaseInternalsJob, } // Produces a page containing the entries listing. - virtual bool GetData(std::string* mime_type, - std::string* charset, - std::string* out) const { + virtual int GetData(std::string* mime_type, + std::string* charset, + std::string* out, + const net::CompletionCallback& callback) const OVERRIDE { mime_type->assign("text/html"); charset->assign("UTF-8"); out->clear(); @@ -466,7 +470,7 @@ class ViewAppCacheJob : public BaseInternalsJob, out); } EmitPageEnd(out); - return true; + return net::OK; } private: @@ -519,9 +523,10 @@ class ViewEntryJob : public BaseInternalsJob, } // Produces a page containing the response headers and data. - virtual bool GetData(std::string* mime_type, - std::string* charset, - std::string* out) const { + virtual int GetData(std::string* mime_type, + std::string* charset, + std::string* out, + const net::CompletionCallback& callback) const OVERRIDE { mime_type->assign("text/html"); charset->assign("UTF-8"); out->clear(); @@ -544,7 +549,7 @@ class ViewEntryJob : public BaseInternalsJob, out->append("Failed to read response headers and data.<br>"); } EmitPageEnd(out); - return true; + return net::OK; } private: diff --git a/webkit/blob/view_blob_internals_job.cc b/webkit/blob/view_blob_internals_job.cc index 46fd269..e5eb6aa 100644 --- a/webkit/blob/view_blob_internals_job.cc +++ b/webkit/blob/view_blob_internals_job.cc @@ -15,6 +15,7 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "net/base/escape.h" +#include "net/base/net_errors.h" #include "net/url_request/url_request.h" #include "webkit/blob/blob_data.h" #include "webkit/blob/blob_storage_controller.h" @@ -142,9 +143,11 @@ void ViewBlobInternalsJob::DoWorkAsync() { StartAsync(); } -bool ViewBlobInternalsJob::GetData(std::string* mime_type, - std::string* charset, - std::string* data) const { +int ViewBlobInternalsJob::GetData( + std::string* mime_type, + std::string* charset, + std::string* data, + const net::CompletionCallback& callback) const { mime_type->assign("text/html"); charset->assign("UTF-8"); @@ -155,7 +158,7 @@ bool ViewBlobInternalsJob::GetData(std::string* mime_type, else GenerateHTML(data); EndHTML(data); - return true; + return net::OK; } void ViewBlobInternalsJob::GenerateHTML(std::string* out) const { diff --git a/webkit/blob/view_blob_internals_job.h b/webkit/blob/view_blob_internals_job.h index 1167815..24324ca 100644 --- a/webkit/blob/view_blob_internals_job.h +++ b/webkit/blob/view_blob_internals_job.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,9 +28,10 @@ class BLOB_EXPORT ViewBlobInternalsJob : public net::URLRequestSimpleJob { BlobStorageController* blob_storage_controller); virtual void Start() OVERRIDE; - 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; virtual bool IsRedirectResponse(GURL* location, int* http_status_code) OVERRIDE; virtual void Kill() OVERRIDE; |