Chromium Code Reviews| 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 #include <vector> | |
| 12 | 13 |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/sequenced_task_runner_helpers.h" | 16 #include "base/sequenced_task_runner_helpers.h" |
| 16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "storage/browser/blob/blob_data_handle.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 { |
| 25 class BlobStorageContext; | 27 class BlobStorageContext; |
| 26 } | 28 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 static void Destruct(const ChromeBlobStorageContext* context) { | 84 static void Destruct(const ChromeBlobStorageContext* context) { |
| 83 context->DeleteOnCorrectThread(); | 85 context->DeleteOnCorrectThread(); |
| 84 } | 86 } |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 // Returns the BlobStorageContext associated with the | 89 // Returns the BlobStorageContext associated with the |
| 88 // ChromeBlobStorageContext instance passed in. | 90 // ChromeBlobStorageContext instance passed in. |
| 89 storage::BlobStorageContext* GetBlobStorageContext( | 91 storage::BlobStorageContext* GetBlobStorageContext( |
| 90 ChromeBlobStorageContext* blob_storage_context); | 92 ChromeBlobStorageContext* blob_storage_context); |
| 91 | 93 |
| 92 // Attaches blob data handles to the ResourceRequestBodyImpl body passed in. | 94 using BlobHandles = std::vector<std::unique_ptr<storage::BlobDataHandle>>; |
| 93 // This is used for POST and PUT requests. | 95 |
| 94 bool AttachRequestBodyBlobDataHandles(ResourceRequestBodyImpl* body, | 96 // returns a vector of BlobDataHandles, that ensure the data isn't cleaned up |
| 95 ResourceContext* resource_context); | 97 // until they're destroyed. Returns nullptr on failure, and an empty vector when |
| 98 // there are no blobs. This is used for POST and PUT requests. | |
| 99 std::unique_ptr<BlobHandles> GetBodyBlobDataHandles( | |
|
dmurph
2017/06/27 21:29:07
Can you have this just return the vector? You can
mmenke
2017/06/27 21:32:22
We need a way to fail. The only reason I used a u
dmurph
2017/06/27 21:35:53
What about providing the 'out' vector in an argume
mmenke
2017/06/27 21:48:44
Works for me, done.
| |
| 100 ResourceRequestBodyImpl* body, | |
| 101 ResourceContext* resource_context); | |
| 96 | 102 |
| 97 } // namespace content | 103 } // namespace content |
| 98 | 104 |
| 99 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ | 105 #endif // CONTENT_BROWSER_FILEAPI_CHROME_BLOB_STORAGE_CONTEXT_H_ |
| OLD | NEW |