summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extension_protocols.cc129
-rw-r--r--content/browser/histogram_internals_request_job.cc11
-rw-r--r--content/browser/histogram_internals_request_job.h7
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host_unittest.cc11
-rw-r--r--content/browser/tcmalloc_internals_request_job.cc11
-rw-r--r--content/browser/tcmalloc_internals_request_job.h7
-rw-r--r--net/base/mime_util.cc4
-rw-r--r--net/url_request/url_request_data_job.cc14
-rw-r--r--net/url_request/url_request_data_job.h9
-rw-r--r--net/url_request/url_request_simple_job.cc14
-rw-r--r--net/url_request/url_request_simple_job.h23
-rw-r--r--webkit/appcache/view_appcache_internals_job.cc37
-rw-r--r--webkit/blob/view_blob_internals_job.cc11
-rw-r--r--webkit/blob/view_blob_internals_job.h9
14 files changed, 195 insertions, 102 deletions
diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc
index 59e12d9..ceada7e 100644
--- a/chrome/browser/extensions/extension_protocols.cc
+++ b/chrome/browser/extensions/extension_protocols.cc
@@ -9,11 +9,13 @@
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/logging.h"
+#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/thread_restrictions.h"
+#include "base/threading/worker_pool.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_info_map.h"
#include "chrome/browser/net/chrome_url_request_context.h"
@@ -58,6 +60,12 @@ net::HttpResponseHeaders* BuildHttpHeaders(
return new net::HttpResponseHeaders(raw_headers);
}
+void ReadMimeTypeFromFile(const FilePath& filename,
+ std::string* mime_type,
+ bool* result) {
+ *result = net::GetMimeTypeFromFile(filename, mime_type);
+}
+
class URLRequestResourceBundleJob : public net::URLRequestSimpleJob {
public:
URLRequestResourceBundleJob(
@@ -65,35 +73,38 @@ class URLRequestResourceBundleJob : public net::URLRequestSimpleJob {
const std::string& content_security_policy, bool send_cors_header)
: net::URLRequestSimpleJob(request),
filename_(filename),
- resource_id_(resource_id) {
+ resource_id_(resource_id),
+ weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
response_info_.headers = BuildHttpHeaders(content_security_policy,
send_cors_header);
}
// Overridden from URLRequestSimpleJob:
- 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 {
const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
*data = rb.GetRawDataResource(
resource_id_, ui::SCALE_FACTOR_NONE).as_string();
- // Requests should not block on the disk! On Windows this goes to the
- // registry.
- // http://code.google.com/p/chromium/issues/detail?id=59849
- bool result;
- {
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- result = net::GetMimeTypeFromFile(filename_, mime_type);
- }
-
- if (StartsWithASCII(*mime_type, "text/", false)) {
- // All of our HTML files should be UTF-8 and for other resource types
- // (like images), charset doesn't matter.
- DCHECK(IsStringUTF8(*data));
- *charset = "utf-8";
- }
- return result;
+ std::string* read_mime_type = new std::string;
+ bool* read_result = new bool;
+ bool posted = base::WorkerPool::PostTaskAndReply(
+ FROM_HERE,
+ base::Bind(&ReadMimeTypeFromFile, filename_,
+ base::Unretained(read_mime_type),
+ base::Unretained(read_result)),
+ base::Bind(&URLRequestResourceBundleJob::OnMimeTypeRead,
+ weak_factory_.GetWeakPtr(),
+ mime_type, charset, data,
+ base::Owned(read_mime_type),
+ base::Owned(read_result),
+ callback),
+ true /* task is slow */);
+ DCHECK(posted);
+
+ return net::ERR_IO_PENDING;
}
virtual void GetResponseInfo(net::HttpResponseInfo* info) {
@@ -103,6 +114,23 @@ class URLRequestResourceBundleJob : public net::URLRequestSimpleJob {
private:
virtual ~URLRequestResourceBundleJob() { }
+ void OnMimeTypeRead(std::string* out_mime_type,
+ std::string* charset,
+ std::string* data,
+ std::string* read_mime_type,
+ bool* read_result,
+ const net::CompletionCallback& callback) {
+ *out_mime_type = *read_mime_type;
+ if (StartsWithASCII(*read_mime_type, "text/", false)) {
+ // All of our HTML files should be UTF-8 and for other resource types
+ // (like images), charset doesn't matter.
+ DCHECK(IsStringUTF8(*data));
+ *charset = "utf-8";
+ }
+ int result = *read_result? net::OK: net::ERR_INVALID_URL;
+ callback.Run(result);
+ }
+
// We need the filename of the resource to determine the mime type.
FilePath filename_;
@@ -110,6 +138,8 @@ class URLRequestResourceBundleJob : public net::URLRequestSimpleJob {
int resource_id_;
net::HttpResponseInfo response_info_;
+
+ mutable base::WeakPtrFactory<URLRequestResourceBundleJob> weak_factory_;
};
class GeneratedBackgroundPageJob : public net::URLRequestSimpleJob {
@@ -125,9 +155,10 @@ class GeneratedBackgroundPageJob : public net::URLRequestSimpleJob {
}
// Overridden from URLRequestSimpleJob:
- 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 {
*mime_type = "text/html";
*charset = "utf-8";
@@ -138,7 +169,7 @@ class GeneratedBackgroundPageJob : public net::URLRequestSimpleJob {
*data += "\"></script>\n";
}
- return true;
+ return net::OK;
}
virtual void GetResponseInfo(net::HttpResponseInfo* info) {
@@ -152,13 +183,25 @@ class GeneratedBackgroundPageJob : public net::URLRequestSimpleJob {
net::HttpResponseInfo response_info_;
};
+void ReadResourceFilePath(const ExtensionResource& resource,
+ FilePath* file_path) {
+ *file_path = resource.GetFilePath();
+}
+
class URLRequestExtensionJob : public net::URLRequestFileJob {
public:
URLRequestExtensionJob(net::URLRequest* request,
- const FilePath& filename,
+ const std::string& extension_id,
+ const FilePath& directory_path,
const std::string& content_security_policy,
bool send_cors_header)
- : net::URLRequestFileJob(request, filename) {
+ : net::URLRequestFileJob(request, FilePath()),
+ // TODO(tc): Move all of these files into resources.pak so we don't break
+ // when updating on Linux.
+ resource_(extension_id, directory_path,
+ extension_file_util::ExtensionURLToRelativeFilePath(
+ request->url())),
+ weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
response_info_.headers = BuildHttpHeaders(content_security_policy,
send_cors_header);
}
@@ -167,10 +210,30 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
*info = response_info_;
}
+ virtual void Start() OVERRIDE {
+ FilePath* read_file_path = new FilePath;
+ bool posted = base::WorkerPool::PostTaskAndReply(
+ FROM_HERE,
+ base::Bind(&ReadResourceFilePath, resource_,
+ base::Unretained(read_file_path)),
+ base::Bind(&URLRequestExtensionJob::OnFilePathRead,
+ weak_factory_.GetWeakPtr(),
+ base::Owned(read_file_path)),
+ true /* task is slow */);
+ DCHECK(posted);
+ }
+
private:
virtual ~URLRequestExtensionJob() {}
+ void OnFilePathRead(FilePath* read_file_path) {
+ file_path_ = *read_file_path;
+ URLRequestFileJob::Start();
+ }
+
net::HttpResponseInfo response_info_;
+ ExtensionResource resource_;
+ base::WeakPtrFactory<URLRequestExtensionJob> weak_factory_;
};
bool ExtensionCanLoadInIncognito(const ResourceRequestInfo* info,
@@ -322,20 +385,8 @@ ExtensionProtocolHandler::MaybeCreateJob(net::URLRequest* request) const {
}
}
}
- // TODO(tc): Move all of these files into resources.pak so we don't break
- // when updating on Linux.
- ExtensionResource resource(extension_id, directory_path,
- extension_file_util::ExtensionURLToRelativeFilePath(request->url()));
-
- FilePath resource_file_path;
- {
- // Getting the file path will touch the file system. Fixing
- // crbug.com/59849 would also fix this. Suppress the error for now.
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- resource_file_path = resource.GetFilePath();
- }
- return new URLRequestExtensionJob(request, resource_file_path,
+ return new URLRequestExtensionJob(request, extension_id, directory_path,
content_security_policy, send_cors_header);
}
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() {}
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index c398561..62788dc 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -88,7 +88,9 @@ class MimeUtil : public PlatformMimeUtil {
StrictMappings strict_format_map_;
}; // class MimeUtil
-static base::LazyInstance<MimeUtil> g_mime_util = LAZY_INSTANCE_INITIALIZER;
+// This variable is Leaky because we need to access it from WorkerPool threads.
+static base::LazyInstance<MimeUtil>::Leaky g_mime_util =
+ LAZY_INSTANCE_INITIALIZER;
struct MimeInfo {
const char* mime_type;
diff --git a/net/url_request/url_request_data_job.cc b/net/url_request/url_request_data_job.cc
index 9e239d3..ed58cbb 100644
--- a/net/url_request/url_request_data_job.cc
+++ b/net/url_request/url_request_data_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 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.
@@ -7,6 +7,7 @@
#include "net/url_request/url_request_data_job.h"
#include "net/base/data_url.h"
+#include "net/base/net_errors.h"
namespace net {
@@ -20,15 +21,16 @@ URLRequestJob* URLRequestDataJob::Factory(URLRequest* request,
return new URLRequestDataJob(request);
}
-bool URLRequestDataJob::GetData(std::string* mime_type,
- std::string* charset,
- std::string* data) const {
+int URLRequestDataJob::GetData(std::string* mime_type,
+ std::string* charset,
+ std::string* data,
+ const CompletionCallback& callback) const {
// Check if data URL is valid. If not, don't bother to try to extract data.
// Otherwise, parse the data from the data URL.
const GURL& url = request_->url();
if (!url.is_valid())
- return false;
- return DataURL::Parse(url, mime_type, charset, data);
+ return ERR_INVALID_URL;
+ return DataURL::Parse(url, mime_type, charset, data)? OK: ERR_INVALID_URL;
}
URLRequestDataJob::~URLRequestDataJob() {
diff --git a/net/url_request/url_request_data_job.h b/net/url_request/url_request_data_job.h
index 8284bed..4d1f5c1 100644
--- a/net/url_request/url_request_data_job.h
+++ b/net/url_request/url_request_data_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.
@@ -21,9 +21,10 @@ class URLRequestDataJob : public URLRequestSimpleJob {
static URLRequest::ProtocolFactory Factory;
// URLRequestSimpleJob
- 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 CompletionCallback& callback) const OVERRIDE;
private:
virtual ~URLRequestDataJob();
diff --git a/net/url_request/url_request_simple_job.cc b/net/url_request/url_request_simple_job.cc
index 1b81351..8ab59f6 100644
--- a/net/url_request/url_request_simple_job.cc
+++ b/net/url_request/url_request_simple_job.cc
@@ -57,13 +57,19 @@ void URLRequestSimpleJob::StartAsync() {
if (!request_)
return;
- if (GetData(&mime_type_, &charset_, &data_)) {
+ int result = GetData(&mime_type_, &charset_, &data_,
+ base::Bind(&URLRequestSimpleJob::OnGetDataCompleted,
+ weak_factory_.GetWeakPtr()));
+ if (result != ERR_IO_PENDING)
+ OnGetDataCompleted(result);
+}
+
+void URLRequestSimpleJob::OnGetDataCompleted(int result) {
+ if (result == OK) {
// Notify that the headers are complete
NotifyHeadersComplete();
} else {
- // what should the error code be?
- NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED,
- ERR_INVALID_URL));
+ NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
}
}
diff --git a/net/url_request/url_request_simple_job.h b/net/url_request/url_request_simple_job.h
index 09062ae..9e1945e 100644
--- a/net/url_request/url_request_simple_job.h
+++ b/net/url_request/url_request_simple_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.
@@ -8,6 +8,7 @@
#include <string>
#include "base/memory/weak_ptr.h"
+#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
#include "net/url_request/url_request_job.h"
@@ -29,15 +30,27 @@ class NET_EXPORT URLRequestSimpleJob : public URLRequestJob {
protected:
virtual ~URLRequestSimpleJob();
- // subclasses must override the way response data is determined.
- virtual bool GetData(std::string* mime_type,
- std::string* charset,
- std::string* data) const = 0;
+ // Subclasses must override the way response data is determined.
+ // The return value should be:
+ // - OK if data is obtained;
+ // - ERR_IO_PENDING if async processing is needed to finish obtaining data.
+ // This is the only case when |callback| should be called after
+ // completion of the operation. In other situations |callback| should
+ // never be called;
+ // - any other ERR_* code to indicate an error. This code will be used
+ // as the error code in the URLRequestStatus when the URLRequest
+ // is finished.
+ virtual int GetData(std::string* mime_type,
+ std::string* charset,
+ std::string* data,
+ const CompletionCallback& callback) const = 0;
protected:
void StartAsync();
private:
+ void OnGetDataCompleted(int result);
+
std::string mime_type_;
std::string charset_;
std::string data_;
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;