naiveproxy/third_party/blink/public/mojom/blob/blob_registry.mojom
2018-08-11 05:35:24 +00:00

58 lines
2.7 KiB
Plaintext

// 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.
module blink.mojom;
import "third_party/blink/public/mojom/blob/blob.mojom";
import "third_party/blink/public/mojom/blob/blob_url_store.mojom";
import "third_party/blink/public/mojom/blob/data_element.mojom";
import "third_party/blink/public/mojom/blob/serialized_blob.mojom";
import "url/mojom/origin.mojom";
// This interface is used to inform a client of progress, in particular when
// creating a blob from a data stream.
interface ProgressClient {
// Called everytime a new chunk of data has been read from the stream, and
// written to a blob being built. |delta| is the size of the latest chunk,
// so when the blob is finished the sum of all the |delta| values will be
// equal to the size of the created blob.
OnProgress(uint64 delta);
};
// This interface is the primary access point from renderer to the browser's
// blob system. This interface provides methods to register new blobs and get
// references to existing blobs.
interface BlobRegistry {
// Registers a new blob with the blob registry.
// TODO(mek): Make this method non-sync and get rid of the UUID parameter once
// enough of the rest of the system doesn't rely on the UUID anymore.
[Sync] Register(blink.mojom.Blob& blob, string uuid,
string content_type, string content_disposition,
array<DataElement> elements) => ();
// Creates a new blob out of a data pipe.
// |length_hint| is only used as a hint, to decide if the blob should be
// stored in memory or on disk. Registration will still succeed even if less
// or more bytes are read from the pipe. The resulting SerializedBlob can be
// inspected to see how many bytes actually did end up being read from
// the pipe. Pass 0 if nothing is known about the expected size.
// If something goes wrong (for example the blob system doesn't have enough
// available space to store all the data from the stream) null will be
// returned.
RegisterFromStream(string content_type, string content_disposition,
uint64 length_hint,
handle<data_pipe_consumer> data,
associated ProgressClient? progress_client)
=> (SerializedBlob? blob);
// Returns a reference to an existing blob. Should not be used by new code,
// is only exposed to make converting existing blob using code easier.
// TODO(mek): Remove when crbug.com/740744 is resolved.
[Sync] GetBlobFromUUID(Blob& blob, string uuid) => ();
// Returns a BlobURLStore for a specific origin.
URLStoreForOrigin(url.mojom.Origin origin,
associated blink.mojom.BlobURLStore& url_store);
};