OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_ | |
6 #define CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "content/common/url_loader_factory.mojom.h" | |
11 #include "content/public/browser/browser_thread.h" | |
12 #include "mojo/public/cpp/bindings/binding_set.h" | |
13 | |
14 namespace storage { | |
15 class FileSystemContext; | |
16 } | |
17 | |
18 namespace content { | |
19 class ChromeBlobStorageContext; | |
20 class StoragePartitionImpl; | |
21 | |
22 // A class for creating URLLoaderFactory for blob scheme. | |
23 // There should be one owned per StoragePartition. | |
24 class BlobURLLoaderFactory | |
25 : public base::RefCountedThreadSafe<BlobURLLoaderFactory, | |
dmurph
2017/05/25 21:37:10
Can we make this not refcounted?
jam
2017/05/26 04:46:47
It's used on StoragePartition and passed to the IO
| |
26 BrowserThread::DeleteOnIOThread>, | |
27 public mojom::URLLoaderFactory { | |
28 public: | |
29 explicit BlobURLLoaderFactory(StoragePartitionImpl* storage_partition); | |
30 | |
31 // Creates a URLLoaderFactory interface pointer for serving blob requests. | |
32 // Called on the UI thread. | |
33 mojom::URLLoaderFactoryPtr CreateFactory(); | |
34 | |
35 private: | |
36 friend class base::DeleteHelper<BlobURLLoaderFactory>; | |
37 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | |
38 | |
39 ~BlobURLLoaderFactory() override; | |
40 | |
41 void BindOnIO(mojom::URLLoaderFactoryRequest request); | |
42 | |
43 // mojom::URLLoaderFactory implementation: | |
44 void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest loader, | |
45 int32_t routing_id, | |
46 int32_t request_id, | |
47 uint32_t options, | |
48 const ResourceRequest& request, | |
49 mojom::URLLoaderClientPtr client) override; | |
50 void SyncLoad(int32_t routing_id, | |
51 int32_t request_id, | |
52 const ResourceRequest& request, | |
53 SyncLoadCallback callback) override; | |
54 | |
55 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | |
56 scoped_refptr<storage::FileSystemContext> file_system_context_; | |
57 | |
58 // Used on the IO thread. | |
59 mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(BlobURLLoaderFactory); | |
62 }; | |
63 | |
64 } // namespace content | |
65 | |
66 #endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_URL_LOADER_FACTORY_H_ | |
OLD | NEW |