Index: content/common/blob.mojom |
diff --git a/content/common/blob.mojom b/content/common/blob.mojom |
new file mode 100644 |
index 0000000000000000000000000000000000000000..74e49b3f2916359b84dc45976dd58f9315db4530 |
--- /dev/null |
+++ b/content/common/blob.mojom |
@@ -0,0 +1,55 @@ |
+// Copyright 2016 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. |
+ |
+// TODO - maybe this mojom should just live in //storage? |
+ |
+module content.mojom; |
+ |
+// Maps to storage::DataElement. |
+[Native] |
+struct StorageDataElement; |
+ |
+// TODO: de-dupe this and the definition in blob_storage_constants.h |
+enum BlobCreationCancelCode { |
+ UNKNOWN = 0, |
+ OUT_OF_MEMORY = 1, |
+ // We couldn't create or write to a file. File system error, like a full disk. |
+ FILE_WRITE_FAILED = 2, |
+ // The renderer was destroyed while data was in transit. |
+ SOURCE_DIED_IN_TRANSIT = 3, |
+ // The renderer destructed the blob before it was done transferring, and there |
+ // were no outstanding references (no one is waiting to read) to keep the |
+ // blob alive. |
+ BLOB_DEREFERENCED_WHILE_BUILDING = 4, |
+ // A blob that we referenced during construction is broken, or a browser-side |
+ // builder tries to build a blob with a blob reference that isn't finished |
+ // constructing. |
+ REFERENCED_BLOB_BROKEN = 5, |
+ LAST = 5, |
+}; |
+ |
+// TODO |
+interface Blob {}; |
+ |
+interface BlobFactory { |
+ RegisterBlobUUID(string uuid, string content_type, string content_disposition, |
+ array<string> referenced_blob_uuids); |
+ |
+ // Builds a new blob. |
+ // |
+ // The StorageDataElements are used to: |
+ // * describe & transport non-memory resources (blobs, files, etc) |
+ // * describe the size of memory items |
+ // * 'shortcut' transport the memory up to the IPC limit so the browser can use |
+ // it if it's not currently full. |
+ // See https://bit.ly/BlobStorageRefactor |
+ // |
+ // This returns a handle to a Blob interface if successful. Otherwise the |
+ // build request was cancelled and |cancel_code| indicates why. If |blob| is |
+ // non-null, |cancel_code| is unspecified and should be ignored. |
+ BuildBlob(string uuid, string content_type, string content_disposition, |
+ array<string> referenced_blob_uuids, |
+ array<StorageDataElement> item_descriptions) |
+ => (associated Blob? blob, BlobCreationCancelCode cancel_code); |
+}; |