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

Unified Diff: content/browser/blob_storage/blob_url_loader_factory.h

Issue 2906543002: Add support for reading blobs when using the network service. (Closed)
Patch Set: merge and switch back to associated request Created 3 years, 7 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 | « content/browser/BUILD.gn ('k') | content/browser/blob_storage/blob_url_loader_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/blob_storage/blob_url_loader_factory.h
diff --git a/content/browser/blob_storage/blob_url_loader_factory.h b/content/browser/blob_storage/blob_url_loader_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..85c39f31f74246f4e2f010ca05a07a9b65e7526b
--- /dev/null
+++ b/content/browser/blob_storage/blob_url_loader_factory.h
@@ -0,0 +1,69 @@
+// Copyright 2017 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.
+
+#ifndef CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_
+#define CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
+#include "content/common/url_loader_factory.mojom.h"
+#include "content/public/browser/browser_thread.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+
+namespace storage {
+class BlobStorageContext;
+class FileSystemContext;
+}
+
+namespace content {
+
+// A class for creating URLLoaderFactory for blob scheme.
+// There should be one owned per StoragePartition.
+class BlobURLLoaderFactory
+ : public base::RefCountedThreadSafe<BlobURLLoaderFactory,
+ BrowserThread::DeleteOnIOThread>,
+ public mojom::URLLoaderFactory {
+ public:
+ CONTENT_EXPORT BlobURLLoaderFactory(
+ base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
+ scoped_refptr<storage::FileSystemContext> file_system_context);
+
+ // Creates a URLLoaderFactory interface pointer for serving blob requests.
+ // Called on the UI thread.
+ mojom::URLLoaderFactoryPtr CreateFactory();
+
+ // mojom::URLLoaderFactory implementation:
+ void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest loader,
+ int32_t routing_id,
+ int32_t request_id,
+ uint32_t options,
+ const ResourceRequest& request,
+ mojom::URLLoaderClientPtr client) override;
+ void SyncLoad(int32_t routing_id,
+ int32_t request_id,
+ const ResourceRequest& request,
+ SyncLoadCallback callback) override;
+
+ private:
+ friend class base::DeleteHelper<BlobURLLoaderFactory>;
+ friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
+
+ ~BlobURLLoaderFactory() override;
+
+ void BindOnIO(mojom::URLLoaderFactoryRequest request);
+
+ // Safe to have a raw pointer since the IO thread
dmurph 2017/06/02 20:10:33 nit: update comment, no longer raw pointer.
+ base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
+ scoped_refptr<storage::FileSystemContext> file_system_context_;
+
+ // Used on the IO thread.
+ mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlobURLLoaderFactory);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/blob_storage/blob_url_loader_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698