Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1492)

Unified Diff: content/browser/storage_partition_impl_map.cc

Issue 23223003: Chromium Blob hacking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/storage_partition_impl_map.cc
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc
index c5721aee667f653d391592867196ff8950e51c99..d02542ca1faca0f20f68fb73c90542ba41e0ffea 100644
--- a/content/browser/storage_partition_impl_map.cc
+++ b/content/browser/storage_partition_impl_map.cc
@@ -34,96 +34,52 @@
#include "crypto/sha2.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
+#include "webkit/browser/blob/blob_storage_context.h"
#include "webkit/browser/blob/blob_url_request_job_factory.h"
#include "webkit/browser/fileapi/file_system_url_request_job_factory.h"
#include "webkit/common/blob/blob_data.h"
using appcache::AppCacheService;
using fileapi::FileSystemContext;
-using webkit_blob::BlobStorageController;
+using webkit_blob::BlobStorageContext;
namespace content {
namespace {
-class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
+// A derivative that knows about Streams too.
+class BlobProtocolHandler : public webkit_blob::BlobProtocolHandler {
public:
BlobProtocolHandler(ChromeBlobStorageContext* blob_storage_context,
StreamContext* stream_context,
fileapi::FileSystemContext* file_system_context)
- : blob_storage_context_(blob_storage_context),
+ : webkit_blob::BlobProtocolHandler(
+ file_system_context,
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
+ .get()),
+ blob_storage_context_(blob_storage_context),
stream_context_(stream_context),
- file_system_context_(file_system_context) {}
+ file_system_context_(file_system_context) {
+ }
- virtual ~BlobProtocolHandler() {}
+ virtual ~BlobProtocolHandler() {
+ }
virtual net::URLRequestJob* MaybeCreateJob(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const OVERRIDE {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (!webkit_blob_protocol_handler_impl_) {
- webkit_blob_protocol_handler_impl_.reset(
- new WebKitBlobProtocolHandlerImpl(blob_storage_context_->controller(),
- stream_context_.get(),
- file_system_context_.get()));
- }
- return webkit_blob_protocol_handler_impl_->MaybeCreateJob(request,
- network_delegate);
+ scoped_refptr<Stream> stream =
+ stream_context_->registry()->GetStream(request->url());
+ if (stream.get())
+ return new StreamURLRequestJob(request, network_delegate, stream);
+ return webkit_blob::BlobProtocolHandler::MaybeCreateJob(
+ request, network_delegate);
}
private:
- // An implementation of webkit_blob::BlobProtocolHandler that gets
- // the BlobData from ResourceRequestInfoImpl.
- class WebKitBlobProtocolHandlerImpl
- : public webkit_blob::BlobProtocolHandler {
- public:
- WebKitBlobProtocolHandlerImpl(
- webkit_blob::BlobStorageController* blob_storage_controller,
- StreamContext* stream_context,
- fileapi::FileSystemContext* file_system_context)
- : webkit_blob::BlobProtocolHandler(
- blob_storage_controller,
- file_system_context,
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
- .get()),
- stream_context_(stream_context) {}
-
- virtual ~WebKitBlobProtocolHandlerImpl() {}
-
- virtual net::URLRequestJob* MaybeCreateJob(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const OVERRIDE {
- scoped_refptr<Stream> stream =
- stream_context_->registry()->GetStream(request->url());
- if (stream.get())
- return new StreamURLRequestJob(request, network_delegate, stream);
-
- return webkit_blob::BlobProtocolHandler::MaybeCreateJob(
- request, network_delegate);
- }
-
- private:
- // webkit_blob::BlobProtocolHandler implementation.
- virtual scoped_refptr<webkit_blob::BlobData>
- LookupBlobData(net::URLRequest* request) const OVERRIDE {
- const ResourceRequestInfoImpl* info =
- ResourceRequestInfoImpl::ForRequest(request);
- if (!info)
- return NULL;
- return info->requested_blob_data();
- }
-
- const scoped_refptr<StreamContext> stream_context_;
- DISALLOW_COPY_AND_ASSIGN(WebKitBlobProtocolHandlerImpl);
- };
-
const scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
const scoped_refptr<StreamContext> stream_context_;
const scoped_refptr<fileapi::FileSystemContext> file_system_context_;
-
- mutable scoped_ptr<WebKitBlobProtocolHandlerImpl>
- webkit_blob_protocol_handler_impl_;
-
DISALLOW_COPY_AND_ASSIGN(BlobProtocolHandler);
};
« no previous file with comments | « content/browser/net/view_blob_internals_job_factory.cc ('k') | content/browser/webui/url_data_manager_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698