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

Unified Diff: webkit/blob/blob_url_request_job_factory.cc

Issue 11410019: ********** Chromium Blob hacking (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « webkit/blob/blob_url_request_job_factory.h ('k') | webkit/blob/view_blob_internals_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/blob/blob_url_request_job_factory.cc
===================================================================
--- webkit/blob/blob_url_request_job_factory.cc (revision 183651)
+++ webkit/blob/blob_url_request_job_factory.cc (working copy)
@@ -9,39 +9,52 @@
#include "base/message_loop_proxy.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job_factory.h"
-#include "webkit/blob/blob_storage_controller.h"
+#include "webkit/blob/blob_storage_context.h"
#include "webkit/blob/blob_url_request_job.h"
#include "webkit/fileapi/file_system_context.h"
namespace webkit_blob {
+namespace {
+int kUserDataKey;
+
+BlobDataHandle* GetRequestedBlobDataHandle(net::URLRequest* request) {
+ return reinterpret_cast<BlobDataHandle*>(
+ request->GetUserData(&kUserDataKey));
+}
+} // namespace
+
+void BlobProtocolHandler::SetRequestedBlobDataHandle(
+ net::URLRequest* request,
+ scoped_ptr<BlobDataHandle> blob_data_handle) {
+ // The request takes ownership
+ request->SetUserData(&kUserDataKey, blob_data_handle.release());
+}
+
BlobProtocolHandler::BlobProtocolHandler(
- webkit_blob::BlobStorageController* blob_storage_controller,
+ webkit_blob::BlobStorageContext* blob_storage_context,
fileapi::FileSystemContext* file_system_context,
base::MessageLoopProxy* loop_proxy)
- : blob_storage_controller_(blob_storage_controller),
- file_system_context_(file_system_context),
+ : file_system_context_(file_system_context),
file_loop_proxy_(loop_proxy) {
- DCHECK(blob_storage_controller_);
- DCHECK(file_system_context_);
- DCHECK(file_loop_proxy_);
}
BlobProtocolHandler::~BlobProtocolHandler() {}
net::URLRequestJob* BlobProtocolHandler::MaybeCreateJob(
net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
- scoped_refptr<webkit_blob::BlobData> data = LookupBlobData(request);
- if (!data) {
- // This request is not coming through resource dispatcher host.
- data = blob_storage_controller_->GetBlobDataFromUrl(request->url());
- }
return new webkit_blob::BlobURLRequestJob(
- request, network_delegate, data, file_system_context_, file_loop_proxy_);
+ request, network_delegate, LookupBlobData(request), file_system_context_, file_loop_proxy_);
}
scoped_refptr<webkit_blob::BlobData>
BlobProtocolHandler::LookupBlobData(net::URLRequest* request) const {
+ // We don't lookup based on the requested url. The caller is responsible for
+ // Setting up what blob to retrieve by calling SetRequestedBlobDataHandle prior
+ // to starting the URLRequest.
+ BlobDataHandle* blob_data_handle = GetRequestedBlobDataHandle(request);
+ if (blob_data_handle)
+ return blob_data_handle->data();
return NULL;
}
« no previous file with comments | « webkit/blob/blob_url_request_job_factory.h ('k') | webkit/blob/view_blob_internals_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698