Commit 18a1bc36 authored by Giovanni Ortuño Urquidi's avatar Giovanni Ortuño Urquidi Committed by Commit Bot

Revert "Make passing mojo blobs over IndexedDB work."

This reverts commit 300dbd0e.

Reason for revert: Timing out on MSAN:

https://luci-milo.appspot.com/buildbot/chromium.webkit/WebKit%20Linux%20Trusty%20MSAN/3438

Original change's description:
> Make passing mojo blobs over IndexedDB work.
> 
> Like other CLs this only adds a mojo blob handle for lifetime purposes,
> but browser-side code still uses the separately passed UUID to actually
> access the blob data.
> 
> Bug: 740744
> Change-Id: I880db368d033473d4b923083b5e84be54e8e1716
> Reviewed-on: https://chromium-review.googlesource.com/608744
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Daniel Murphy <dmurph@chromium.org>
> Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#505159}

TBR=dcheng@chromium.org,dmurph@chromium.org,mek@chromium.org,haraken@chromium.org

Change-Id: I570eaf73fa9dc307c50a9593fe51faf61537d0a8
No-Tree-Checks: true
No-Try: true
Bug: 740744
Reviewed-on: https://chromium-review.googlesource.com/691396Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505310}
parent 59f941fd
...@@ -31,9 +31,7 @@ ...@@ -31,9 +31,7 @@
#include "content/common/indexed_db/indexed_db_constants.h" #include "content/common/indexed_db/indexed_db_constants.h"
#include "content/common/indexed_db/indexed_db_metadata.h" #include "content/common/indexed_db/indexed_db_metadata.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/common/content_features.h"
#include "mojo/public/cpp/bindings/strong_associated_binding.h" #include "mojo/public/cpp/bindings/strong_associated_binding.h"
#include "storage/browser/blob/blob_impl.h"
#include "storage/browser/blob/blob_storage_context.h" #include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/blob/shareable_file_reference.h" #include "storage/browser/blob/shareable_file_reference.h"
#include "storage/browser/quota/quota_manager.h" #include "storage/browser/quota/quota_manager.h"
...@@ -761,20 +759,10 @@ bool IndexedDBCallbacks::IOThreadHelper::CreateAllBlobs( ...@@ -761,20 +759,10 @@ bool IndexedDBCallbacks::IOThreadHelper::CreateAllBlobs(
} }
IDB_TRACE("IndexedDBCallbacks::CreateAllBlobs"); IDB_TRACE("IndexedDBCallbacks::CreateAllBlobs");
DCHECK_EQ(blob_info.size(), blob_or_file_info->size()); DCHECK_EQ(blob_info.size(), blob_or_file_info->size());
storage::BlobStorageContext* blob_context = if (!dispatcher_host_->blob_storage_context())
dispatcher_host_->blob_storage_context();
if (!blob_context)
return false; return false;
for (size_t i = 0; i < blob_info.size(); ++i) { for (size_t i = 0; i < blob_info.size(); ++i)
std::string uuid = CreateBlobData(blob_info[i]); (*blob_or_file_info)[i]->uuid = CreateBlobData(blob_info[i]);
if (features::IsMojoBlobsEnabled()) {
storage::mojom::BlobPtr blob_ptr;
storage::BlobImpl::Create(blob_context->GetBlobDataFromUUID(uuid),
MakeRequest(&blob_ptr));
(*blob_or_file_info)[i]->blob = std::move(blob_ptr);
}
(*blob_or_file_info)[i]->uuid = std::move(uuid);
}
return true; return true;
} }
......
...@@ -428,7 +428,7 @@ TEST_F(IndexedDBDispatcherHostTest, PutWithInvalidBlob) { ...@@ -428,7 +428,7 @@ TEST_F(IndexedDBDispatcherHostTest, PutWithInvalidBlob) {
// Call Put with an invalid blob. // Call Put with an invalid blob.
std::vector<::indexed_db::mojom::BlobInfoPtr> blobs; std::vector<::indexed_db::mojom::BlobInfoPtr> blobs;
blobs.push_back(::indexed_db::mojom::BlobInfo::New( blobs.push_back(::indexed_db::mojom::BlobInfo::New(
nullptr, "fakeUUID", base::string16(), 100, nullptr)); "fakeUUID", base::string16(), 100, nullptr));
connection.database->Put(kTransactionId, kObjectStoreId, connection.database->Put(kTransactionId, kObjectStoreId,
Value::New("hello", std::move(blobs)), Value::New("hello", std::move(blobs)),
content::IndexedDBKey(base::UTF8ToUTF16("hello")), content::IndexedDBKey(base::UTF8ToUTF16("hello")),
......
...@@ -91,13 +91,11 @@ void IndexedDBCallbacksImpl::ConvertValue( ...@@ -91,13 +91,11 @@ void IndexedDBCallbacksImpl::ConvertValue(
blink::FilePathToWebString(info->file->path), blink::FilePathToWebString(info->file->path),
WebString::FromUTF16(info->file->name), WebString::FromUTF16(info->file->name),
WebString::FromUTF16(info->mime_type), WebString::FromUTF16(info->mime_type),
info->file->last_modified.ToDoubleT(), info->size, info->file->last_modified.ToDoubleT(), info->size);
info->blob.PassInterface().PassHandle());
} else { } else {
local_blob_info[i] = local_blob_info[i] =
WebBlobInfo(WebString::FromUTF8(info->uuid), WebBlobInfo(WebString::FromUTF8(info->uuid),
WebString::FromUTF16(info->mime_type), info->size, WebString::FromUTF16(info->mime_type), info->size);
info->blob.PassInterface().PassHandle());
} }
} }
......
...@@ -339,8 +339,6 @@ void WebIDBDatabaseImpl::Put(long long transaction_id, ...@@ -339,8 +339,6 @@ void WebIDBDatabaseImpl::Put(long long transaction_id,
blob_info->uuid = info.Uuid().Latin1(); blob_info->uuid = info.Uuid().Latin1();
DCHECK(blob_info->uuid.size()); DCHECK(blob_info->uuid.size());
blob_info->mime_type = info.GetType().Utf16(); blob_info->mime_type = info.GetType().Utf16();
blob_info->blob.Bind(storage::mojom::BlobPtrInfo(
info.CloneBlobHandle(), storage::mojom::Blob::Version_));
mojo_value->blob_or_file_info.push_back(std::move(blob_info)); mojo_value->blob_or_file_info.push_back(std::move(blob_info));
} }
......
...@@ -11,7 +11,6 @@ module indexed_db.mojom; ...@@ -11,7 +11,6 @@ module indexed_db.mojom;
import "mojo/common/file_path.mojom"; import "mojo/common/file_path.mojom";
import "mojo/common/string16.mojom"; import "mojo/common/string16.mojom";
import "mojo/common/time.mojom"; import "mojo/common/time.mojom";
import "storage/public/interfaces/blobs.mojom";
import "url/mojo/origin.mojom"; import "url/mojo/origin.mojom";
enum CursorDirection { enum CursorDirection {
...@@ -137,7 +136,6 @@ struct FileInfo { ...@@ -137,7 +136,6 @@ struct FileInfo {
}; };
struct BlobInfo { struct BlobInfo {
storage.mojom.Blob? blob;
string uuid; string uuid;
mojo.common.mojom.String16 mime_type; mojo.common.mojom.String16 mime_type;
int64 size; int64 size;
......
...@@ -531,11 +531,6 @@ ...@@ -531,11 +531,6 @@
"base": "external/wpt/FileAPI", "base": "external/wpt/FileAPI",
"args": ["--enable-features=MojoBlobs"] "args": ["--enable-features=MojoBlobs"]
}, },
{
"prefix": "mojo-blobs",
"base": "external/wpt/IndexedDB",
"args": ["--enable-features=MojoBlobs"]
},
{ {
"prefix": "mojo-blobs", "prefix": "mojo-blobs",
"base": "external/wpt/fetch", "base": "external/wpt/fetch",
......
...@@ -224,12 +224,8 @@ ScriptWrappable* V8ScriptValueDeserializer::ReadDOMObject( ...@@ -224,12 +224,8 @@ ScriptWrappable* V8ScriptValueDeserializer::ReadDOMObject(
if (!ReadUint32(&index) || index >= blob_info_array_->size()) if (!ReadUint32(&index) || index >= blob_info_array_->size())
return nullptr; return nullptr;
const WebBlobInfo& info = (*blob_info_array_)[index]; const WebBlobInfo& info = (*blob_info_array_)[index];
auto blob_handle = info.GetBlobHandle(); return Blob::Create(
if (!blob_handle) { GetOrCreateBlobDataHandle(info.Uuid(), info.GetType(), info.size()));
blob_handle =
GetOrCreateBlobDataHandle(info.Uuid(), info.GetType(), info.size());
}
return Blob::Create(blob_handle);
} }
case kFileTag: case kFileTag:
return ReadFile(); return ReadFile();
...@@ -526,14 +522,9 @@ File* V8ScriptValueDeserializer::ReadFileIndex() { ...@@ -526,14 +522,9 @@ File* V8ScriptValueDeserializer::ReadFileIndex() {
const WebBlobInfo& info = (*blob_info_array_)[index]; const WebBlobInfo& info = (*blob_info_array_)[index];
// FIXME: transition WebBlobInfo.lastModified to be milliseconds-based also. // FIXME: transition WebBlobInfo.lastModified to be milliseconds-based also.
double last_modified_ms = info.LastModified() * kMsPerSecond; double last_modified_ms = info.LastModified() * kMsPerSecond;
auto blob_handle = info.GetBlobHandle(); return File::CreateFromIndexedSerialization(
if (!blob_handle) { info.FilePath(), info.FileName(), info.size(), last_modified_ms,
blob_handle = GetOrCreateBlobDataHandle(info.Uuid(), info.GetType(), info.size()));
GetOrCreateBlobDataHandle(info.Uuid(), info.GetType(), info.size());
}
return File::CreateFromIndexedSerialization(info.FilePath(), info.FileName(),
info.size(), last_modified_ms,
blob_handle);
} }
RefPtr<BlobDataHandle> V8ScriptValueDeserializer::GetOrCreateBlobDataHandle( RefPtr<BlobDataHandle> V8ScriptValueDeserializer::GetOrCreateBlobDataHandle(
......
...@@ -182,8 +182,7 @@ bool V8ScriptValueSerializer::WriteDOMObject(ScriptWrappable* wrappable, ...@@ -182,8 +182,7 @@ bool V8ScriptValueSerializer::WriteDOMObject(ScriptWrappable* wrappable,
if (blob_info_array_) { if (blob_info_array_) {
size_t index = blob_info_array_->size(); size_t index = blob_info_array_->size();
DCHECK_LE(index, std::numeric_limits<uint32_t>::max()); DCHECK_LE(index, std::numeric_limits<uint32_t>::max());
blob_info_array_->emplace_back(blob->GetBlobDataHandle(), blob->type(), blob_info_array_->emplace_back(blob->Uuid(), blob->type(), blob->size());
blob->size());
WriteTag(kBlobIndexTag); WriteTag(kBlobIndexTag);
WriteUint32(static_cast<uint32_t>(index)); WriteUint32(static_cast<uint32_t>(index));
} else { } else {
...@@ -441,9 +440,8 @@ bool V8ScriptValueSerializer::WriteFile(File* file, ...@@ -441,9 +440,8 @@ bool V8ScriptValueSerializer::WriteFile(File* file,
file->CaptureSnapshot(size, last_modified_ms); file->CaptureSnapshot(size, last_modified_ms);
// FIXME: transition WebBlobInfo.lastModified to be milliseconds-based also. // FIXME: transition WebBlobInfo.lastModified to be milliseconds-based also.
double last_modified = last_modified_ms / kMsPerSecond; double last_modified = last_modified_ms / kMsPerSecond;
blob_info_array_->emplace_back(file->GetBlobDataHandle(), file->GetPath(), blob_info_array_->emplace_back(file->Uuid(), file->GetPath(), file->name(),
file->name(), file->type(), last_modified, file->type(), last_modified, size);
size);
WriteUint32(static_cast<uint32_t>(index)); WriteUint32(static_cast<uint32_t>(index));
} else { } else {
WriteUTF8String(file->HasBackingFile() ? file->GetPath() : g_empty_string); WriteUTF8String(file->HasBackingFile() ? file->GetPath() : g_empty_string);
......
...@@ -580,7 +580,6 @@ jumbo_component("platform") { ...@@ -580,7 +580,6 @@ jumbo_component("platform") {
"exported/WebAudioBus.cpp", "exported/WebAudioBus.cpp",
"exported/WebAudioDevice.cpp", "exported/WebAudioDevice.cpp",
"exported/WebBlobData.cpp", "exported/WebBlobData.cpp",
"exported/WebBlobInfo.cpp",
"exported/WebCORS.cpp", "exported/WebCORS.cpp",
"exported/WebCORSPreflightResultCache.cpp", "exported/WebCORSPreflightResultCache.cpp",
"exported/WebCache.cpp", "exported/WebCache.cpp",
......
// 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.
#include "public/platform/WebBlobInfo.h"
#include "platform/blob/BlobData.h"
namespace blink {
WebBlobInfo::WebBlobInfo(const WebString& uuid,
const WebString& type,
long long size,
mojo::ScopedMessagePipeHandle handle)
: WebBlobInfo(
BlobDataHandle::Create(uuid,
type,
size,
storage::mojom::blink::BlobPtrInfo(
std::move(handle),
storage::mojom::blink::Blob::Version_))) {}
WebBlobInfo::WebBlobInfo(const WebString& uuid,
const WebString& file_path,
const WebString& file_name,
const WebString& type,
double last_modified,
long long size,
mojo::ScopedMessagePipeHandle handle)
: WebBlobInfo(
BlobDataHandle::Create(uuid,
type,
size,
storage::mojom::blink::BlobPtrInfo(
std::move(handle),
storage::mojom::blink::Blob::Version_)),
file_path,
file_name,
last_modified) {}
WebBlobInfo::~WebBlobInfo() {
blob_handle_.Reset();
}
WebBlobInfo::WebBlobInfo(const WebBlobInfo& other) {
*this = other;
}
WebBlobInfo& WebBlobInfo::operator=(const WebBlobInfo& other) = default;
mojo::ScopedMessagePipeHandle WebBlobInfo::CloneBlobHandle() const {
if (!blob_handle_)
return mojo::ScopedMessagePipeHandle();
return blob_handle_->CloneBlobPtr().PassInterface().PassHandle();
}
WebBlobInfo::WebBlobInfo(RefPtr<BlobDataHandle> handle)
: WebBlobInfo(handle, handle->GetType(), handle->size()) {}
WebBlobInfo::WebBlobInfo(RefPtr<BlobDataHandle> handle,
const WebString& file_path,
const WebString& file_name,
double last_modified)
: WebBlobInfo(handle,
file_path,
file_name,
handle->GetType(),
last_modified,
handle->size()) {}
WebBlobInfo::WebBlobInfo(RefPtr<BlobDataHandle> handle,
const WebString& type,
long long size)
: is_file_(false),
uuid_(handle->Uuid()),
type_(type),
size_(size),
blob_handle_(std::move(handle)),
last_modified_(0) {}
WebBlobInfo::WebBlobInfo(RefPtr<BlobDataHandle> handle,
const WebString& file_path,
const WebString& file_name,
const WebString& type,
double last_modified,
long long size)
: is_file_(true),
uuid_(handle->Uuid()),
type_(type),
size_(size),
blob_handle_(std::move(handle)),
file_path_(file_path),
file_name_(file_name),
last_modified_(last_modified) {}
RefPtr<BlobDataHandle> WebBlobInfo::GetBlobHandle() const {
return blob_handle_.Get();
}
} // namespace blink
...@@ -7,16 +7,12 @@ ...@@ -7,16 +7,12 @@
#include "WebCommon.h" #include "WebCommon.h"
#include "WebString.h" #include "WebString.h"
#include "mojo/public/cpp/system/message_pipe.h"
namespace blink { namespace blink {
class BlobDataHandle;
class WebBlobInfo { class WebBlobInfo {
public: public:
WebBlobInfo() : is_file_(false), size_(-1), last_modified_(0) {} WebBlobInfo() : is_file_(false), size_(-1), last_modified_(0) {}
// TODO(mek): Eliminate constructors that don't accept a message pipe.
WebBlobInfo(const WebString& uuid, const WebString& type, long long size) WebBlobInfo(const WebString& uuid, const WebString& type, long long size)
: is_file_(false), : is_file_(false),
uuid_(uuid), uuid_(uuid),
...@@ -47,24 +43,6 @@ class WebBlobInfo { ...@@ -47,24 +43,6 @@ class WebBlobInfo {
file_path_(file_path), file_path_(file_path),
file_name_(file_name), file_name_(file_name),
last_modified_(last_modified) {} last_modified_(last_modified) {}
BLINK_EXPORT WebBlobInfo(const WebString& uuid,
const WebString& type,
long long size,
mojo::ScopedMessagePipeHandle);
BLINK_EXPORT WebBlobInfo(const WebString& uuid,
const WebString& file_path,
const WebString& file_name,
const WebString& type,
double last_modified,
long long size,
mojo::ScopedMessagePipeHandle);
BLINK_EXPORT ~WebBlobInfo();
BLINK_EXPORT WebBlobInfo(const WebBlobInfo& other);
BLINK_EXPORT WebBlobInfo& operator=(const WebBlobInfo& other);
bool IsFile() const { return is_file_; } bool IsFile() const { return is_file_; }
const WebString& Uuid() const { return uuid_; } const WebString& Uuid() const { return uuid_; }
const WebString& GetType() const { return type_; } const WebString& GetType() const { return type_; }
...@@ -72,34 +50,12 @@ class WebBlobInfo { ...@@ -72,34 +50,12 @@ class WebBlobInfo {
const WebString& FilePath() const { return file_path_; } const WebString& FilePath() const { return file_path_; }
const WebString& FileName() const { return file_name_; } const WebString& FileName() const { return file_name_; }
double LastModified() const { return last_modified_; } double LastModified() const { return last_modified_; }
BLINK_EXPORT mojo::ScopedMessagePipeHandle CloneBlobHandle() const;
#if INSIDE_BLINK
BLINK_EXPORT WebBlobInfo(RefPtr<BlobDataHandle>);
BLINK_EXPORT WebBlobInfo(RefPtr<BlobDataHandle>,
const WebString& file_path,
const WebString& file_name,
double last_modified);
// TODO(mek): Get rid of these constructors after ensuring that the
// BlobDataHandle always has the correct type and size.
BLINK_EXPORT WebBlobInfo(RefPtr<BlobDataHandle>,
const WebString& type,
long long size);
BLINK_EXPORT WebBlobInfo(RefPtr<BlobDataHandle>,
const WebString& file_path,
const WebString& file_name,
const WebString& type,
double last_modified,
long long size);
BLINK_EXPORT RefPtr<BlobDataHandle> GetBlobHandle() const;
#endif
private: private:
bool is_file_; bool is_file_;
WebString uuid_; WebString uuid_;
WebString type_; // MIME type WebString type_; // MIME type
long long size_; long long size_;
WebPrivatePtr<BlobDataHandle> blob_handle_;
WebString file_path_; // Only for File WebString file_path_; // Only for File
WebString file_name_; // Only for File WebString file_name_; // Only for File
double last_modified_; // Only for File double last_modified_; // Only for File
......
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