Commit 600f53f7 authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

[FileSystem] Get rid of no longer needed snapshot blob.

Since all this runs on the same thread these days, there is no longer any
reason for FileSystemDispatcher::DidCreateSnapshotFile to create a
BlobDataHandle. The callbacks called by it already do the same
synchronously anyway.

Bug: none
Change-Id: I86cbc0f0c4feeb20b6495f6741493d9a11ec98b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975088Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726446}
parent 698333e8
......@@ -109,15 +109,7 @@ class CreateFileHelper final : public SnapshotFileCallbackBase {
~CreateFileHelper() override = default;
void DidCreateSnapshotFile(const FileMetadata& metadata,
scoped_refptr<BlobDataHandle> snapshot) override {
// We can't directly use the snapshot blob data handle because the content
// type on it hasn't been set. The |snapshot| param is here to provide a a
// chain of custody thru thread bridging that is held onto until *after*
// we've coined a File with a new handle that has the correct type set on
// it. This allows the blob storage system to track when a temp file can and
// can't be safely deleted.
void DidCreateSnapshotFile(const FileMetadata& metadata) override {
result_->file_ =
DOMFileSystemBase::CreateFile(metadata, url_, type_, name_);
}
......
......@@ -290,18 +290,10 @@ SnapshotFileCallback::SnapshotFileCallback(DOMFileSystemBase* filesystem,
success_callback_(std::move(success_callback)),
error_callback_(std::move(error_callback)) {}
void SnapshotFileCallback::DidCreateSnapshotFile(
const FileMetadata& metadata,
scoped_refptr<BlobDataHandle> snapshot) {
void SnapshotFileCallback::DidCreateSnapshotFile(const FileMetadata& metadata) {
if (!success_callback_)
return;
// We can't directly use the snapshot blob data handle because the content
// type on it hasn't been set. The |snapshot| param is here to provide a
// chain of custody thru thread bridging that is held onto until *after* we've
// coined a File with a new handle that has the correct type set on it. This
// allows the blob storage system to track when a temp file can and can't be
// safely deleted.
std::move(success_callback_)
.Run(DOMFileSystemBase::CreateFile(metadata, url_,
file_system_->GetType(), name_));
......
......@@ -80,9 +80,7 @@ class SnapshotFileCallbackBase {
virtual ~SnapshotFileCallbackBase() = default;
// Called when a snapshot file is created successfully.
virtual void DidCreateSnapshotFile(
const FileMetadata&,
scoped_refptr<BlobDataHandle> snapshot) = 0;
virtual void DidCreateSnapshotFile(const FileMetadata&) = 0;
virtual void DidFail(base::File::Error error) = 0;
};
......@@ -245,8 +243,7 @@ class SnapshotFileCallback final : public SnapshotFileCallbackBase,
ExecutionContext*);
// Called when a snapshot file is created successfully.
void DidCreateSnapshotFile(const FileMetadata&,
scoped_refptr<BlobDataHandle> snapshot) override;
void DidCreateSnapshotFile(const FileMetadata&) override;
// Called when a request operation has failed.
void DidFail(base::File::Error error) override;
......
......@@ -573,13 +573,7 @@ void FileSystemDispatcher::DidCreateSnapshotFile(
FileMetadata file_metadata = FileMetadata::From(file_info);
file_metadata.platform_path = FilePathToWebString(platform_path);
auto blob_data = std::make_unique<BlobData>();
blob_data->AppendFile(file_metadata.platform_path, 0, file_metadata.length,
base::nullopt);
scoped_refptr<BlobDataHandle> snapshot_blob =
BlobDataHandle::Create(std::move(blob_data), file_metadata.length);
callbacks->DidCreateSnapshotFile(file_metadata, snapshot_blob);
callbacks->DidCreateSnapshotFile(file_metadata);
if (listener) {
mojo::Remote<mojom::blink::ReceivedSnapshotListener>(std::move(listener))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment