| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ | 5 #ifndef CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ | 6 #define CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/sequenced_task_runner_helpers.h" | 15 #include "base/sequenced_task_runner_helpers.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "services/service_manager/public/cpp/bind_source_info.h" |
| 18 #include "third_party/WebKit/public/platform/blobs.mojom.h" |
| 17 | 19 |
| 18 namespace base { | 20 namespace base { |
| 19 class FilePath; | 21 class FilePath; |
| 20 class TaskRunner; | 22 class TaskRunner; |
| 21 class Time; | 23 class Time; |
| 22 } | 24 } |
| 23 | 25 |
| 24 namespace storage { | 26 namespace storage { |
| 27 class BlobRegistryImpl; |
| 25 class BlobStorageContext; | 28 class BlobStorageContext; |
| 26 } | 29 } |
| 27 | 30 |
| 28 namespace content { | 31 namespace content { |
| 29 class BlobHandle; | 32 class BlobHandle; |
| 30 class BrowserContext; | 33 class BrowserContext; |
| 31 struct ChromeBlobStorageContextDeleter; | 34 struct ChromeBlobStorageContextDeleter; |
| 32 class ResourceRequestBodyImpl; | 35 class ResourceRequestBodyImpl; |
| 33 class ResourceContext; | 36 class ResourceContext; |
| 34 | 37 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 57 std::unique_ptr<BlobHandle> CreateMemoryBackedBlob(const char* data, | 60 std::unique_ptr<BlobHandle> CreateMemoryBackedBlob(const char* data, |
| 58 size_t length); | 61 size_t length); |
| 59 | 62 |
| 60 // Returns a NULL scoped_ptr on failure. | 63 // Returns a NULL scoped_ptr on failure. |
| 61 std::unique_ptr<BlobHandle> CreateFileBackedBlob( | 64 std::unique_ptr<BlobHandle> CreateFileBackedBlob( |
| 62 const base::FilePath& path, | 65 const base::FilePath& path, |
| 63 int64_t offset, | 66 int64_t offset, |
| 64 int64_t size, | 67 int64_t size, |
| 65 const base::Time& expected_modification_time); | 68 const base::Time& expected_modification_time); |
| 66 | 69 |
| 70 void BindBlobRegistry(const service_manager::BindSourceInfo& source_info, |
| 71 storage::mojom::BlobRegistryRequest request); |
| 72 |
| 67 protected: | 73 protected: |
| 68 virtual ~ChromeBlobStorageContext(); | 74 virtual ~ChromeBlobStorageContext(); |
| 69 | 75 |
| 70 private: | 76 private: |
| 71 friend class base::DeleteHelper<ChromeBlobStorageContext>; | 77 friend class base::DeleteHelper<ChromeBlobStorageContext>; |
| 72 friend class base::RefCountedThreadSafe<ChromeBlobStorageContext, | 78 friend class base::RefCountedThreadSafe<ChromeBlobStorageContext, |
| 73 ChromeBlobStorageContextDeleter>; | 79 ChromeBlobStorageContextDeleter>; |
| 74 friend struct ChromeBlobStorageContextDeleter; | 80 friend struct ChromeBlobStorageContextDeleter; |
| 75 | 81 |
| 76 void DeleteOnCorrectThread() const; | 82 void DeleteOnCorrectThread() const; |
| 77 | 83 |
| 78 std::unique_ptr<storage::BlobStorageContext> context_; | 84 std::unique_ptr<storage::BlobStorageContext> context_; |
| 85 std::unique_ptr<storage::BlobRegistryImpl> blob_registry_; |
| 79 }; | 86 }; |
| 80 | 87 |
| 81 struct ChromeBlobStorageContextDeleter { | 88 struct ChromeBlobStorageContextDeleter { |
| 82 static void Destruct(const ChromeBlobStorageContext* context) { | 89 static void Destruct(const ChromeBlobStorageContext* context) { |
| 83 context->DeleteOnCorrectThread(); | 90 context->DeleteOnCorrectThread(); |
| 84 } | 91 } |
| 85 }; | 92 }; |
| 86 | 93 |
| 87 // Returns the BlobStorageContext associated with the | 94 // Returns the BlobStorageContext associated with the |
| 88 // ChromeBlobStorageContext instance passed in. | 95 // ChromeBlobStorageContext instance passed in. |
| 89 storage::BlobStorageContext* GetBlobStorageContext( | 96 storage::BlobStorageContext* GetBlobStorageContext( |
| 90 ChromeBlobStorageContext* blob_storage_context); | 97 ChromeBlobStorageContext* blob_storage_context); |
| 91 | 98 |
| 92 // Attaches blob data handles to the ResourceRequestBodyImpl body passed in. | 99 // Attaches blob data handles to the ResourceRequestBodyImpl body passed in. |
| 93 // This is used for POST and PUT requests. | 100 // This is used for POST and PUT requests. |
| 94 void AttachRequestBodyBlobDataHandles(ResourceRequestBodyImpl* body, | 101 void AttachRequestBodyBlobDataHandles(ResourceRequestBodyImpl* body, |
| 95 ResourceContext* resource_context); | 102 ResourceContext* resource_context); |
| 96 | 103 |
| 97 } // namespace content | 104 } // namespace content |
| 98 | 105 |
| 99 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ | 106 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ |
| OLD | NEW |