Commit bd4c113d authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Remove more unused code related to filesystem API.

BUG=761117

Change-Id: I50bc0758b8e5afbba18f95b814b8341f0dcbc400
Reviewed-on: https://chromium-review.googlesource.com/742326
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513141}
parent b94e4009
...@@ -377,14 +377,6 @@ WebHTTPBody GetWebHTTPBodyForRequestBody( ...@@ -377,14 +377,6 @@ WebHTTPBody GetWebHTTPBodyForRequestBody(
: -1, : -1,
element.expected_modification_time().ToDoubleT()); element.expected_modification_time().ToDoubleT());
break; break;
case ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM:
http_body.AppendFileSystemURLRange(
element.filesystem_url(), element.offset(),
(element.length() != std::numeric_limits<uint64_t>::max())
? element.length()
: -1,
element.expected_modification_time().ToDoubleT());
break;
case ResourceRequestBody::Element::TYPE_BLOB: case ResourceRequestBody::Element::TYPE_BLOB:
http_body.AppendBlob(WebString::FromASCII(element.blob_uuid())); http_body.AppendBlob(WebString::FromASCII(element.blob_uuid()));
break; break;
......
...@@ -138,17 +138,6 @@ class ComplexFormDataBytesConsumer final : public BytesConsumer { ...@@ -138,17 +138,6 @@ class ComplexFormDataBytesConsumer final : public BytesConsumer {
blob_data->AppendBlob(element.optional_blob_data_handle_, 0, blob_data->AppendBlob(element.optional_blob_data_handle_, 0,
element.optional_blob_data_handle_->size()); element.optional_blob_data_handle_->size());
break; break;
case FormDataElement::kEncodedFileSystemURL:
if (element.file_length_ < 0) {
form_data_ = nullptr;
blob_bytes_consumer_ = BytesConsumer::CreateErrored(
Error("Cannot determine a file size"));
return;
}
blob_data->AppendFileSystemURL(
element.file_system_url_, element.file_start_,
element.file_length_, element.expected_file_modification_time_);
break;
} }
} }
// Here we handle m_formData->boundary() as a C-style string. See // Here we handle m_formData->boundary() as a C-style string. See
......
...@@ -33,8 +33,6 @@ scoped_refptr<EncodedFormData> ComplexFormData() { ...@@ -33,8 +33,6 @@ scoped_refptr<EncodedFormData> ComplexFormData() {
data->AppendData("foo", 3); data->AppendData("foo", 3);
data->AppendFileRange("/foo/bar/baz", 3, 4, 5); data->AppendFileRange("/foo/bar/baz", 3, 4, 5);
data->AppendFileSystemURLRange(KURL(NullURL(), "file:///foo/bar/baz"), 6, 7,
8);
std::unique_ptr<BlobData> blob_data = BlobData::Create(); std::unique_ptr<BlobData> blob_data = BlobData::Create();
blob_data->AppendText("hello", false); blob_data->AppendText("hello", false);
auto size = blob_data->length(); auto size = blob_data->length();
......
...@@ -84,13 +84,6 @@ bool WebHTTPBody::ElementAt(size_t index, Element& result) const { ...@@ -84,13 +84,6 @@ bool WebHTTPBody::ElementAt(size_t index, Element& result) const {
result.type = Element::kTypeBlob; result.type = Element::kTypeBlob;
result.blob_uuid = element.blob_uuid_; result.blob_uuid = element.blob_uuid_;
break; break;
case FormDataElement::kEncodedFileSystemURL:
result.type = Element::kTypeFileSystemURL;
result.file_system_url = element.file_system_url_;
result.file_start = element.file_start_;
result.file_length = element.file_length_;
result.modification_time = element.expected_file_modification_time_;
break;
default: default:
NOTREACHED(); NOTREACHED();
return false; return false;
...@@ -124,16 +117,6 @@ void WebHTTPBody::AppendFileRange(const WebString& file_path, ...@@ -124,16 +117,6 @@ void WebHTTPBody::AppendFileRange(const WebString& file_path,
modification_time); modification_time);
} }
void WebHTTPBody::AppendFileSystemURLRange(const WebURL& url,
long long start,
long long length,
double modification_time) {
// Currently we only support filesystem URL.
DCHECK(KURL(url).ProtocolIs("filesystem"));
EnsureMutable();
private_->AppendFileSystemURLRange(url, start, length, modification_time);
}
void WebHTTPBody::AppendBlob(const WebString& uuid) { void WebHTTPBody::AppendBlob(const WebString& uuid) {
EnsureMutable(); EnsureMutable();
private_->AppendBlob(uuid, nullptr); private_->AppendBlob(uuid, nullptr);
......
...@@ -30,8 +30,7 @@ namespace blink { ...@@ -30,8 +30,7 @@ namespace blink {
bool FormDataElement::IsSafeToSendToAnotherThread() const { bool FormDataElement::IsSafeToSendToAnotherThread() const {
return filename_.IsSafeToSendToAnotherThread() && return filename_.IsSafeToSendToAnotherThread() &&
blob_uuid_.IsSafeToSendToAnotherThread() && blob_uuid_.IsSafeToSendToAnotherThread();
file_system_url_.IsSafeToSendToAnotherThread();
} }
inline EncodedFormData::EncodedFormData() inline EncodedFormData::EncodedFormData()
...@@ -97,11 +96,6 @@ scoped_refptr<EncodedFormData> EncodedFormData::DeepCopy() const { ...@@ -97,11 +96,6 @@ scoped_refptr<EncodedFormData> EncodedFormData::DeepCopy() const {
form_data->elements_.UncheckedAppend(FormDataElement( form_data->elements_.UncheckedAppend(FormDataElement(
e.blob_uuid_.IsolatedCopy(), e.optional_blob_data_handle_)); e.blob_uuid_.IsolatedCopy(), e.optional_blob_data_handle_));
break; break;
case FormDataElement::kEncodedFileSystemURL:
form_data->elements_.UncheckedAppend(FormDataElement(
e.file_system_url_.Copy(), e.file_start_, e.file_length_,
e.expected_file_modification_time_));
break;
} }
} }
return form_data; return form_data;
...@@ -135,20 +129,6 @@ void EncodedFormData::AppendBlob( ...@@ -135,20 +129,6 @@ void EncodedFormData::AppendBlob(
elements_.push_back(FormDataElement(uuid, std::move(optional_handle))); elements_.push_back(FormDataElement(uuid, std::move(optional_handle)));
} }
void EncodedFormData::AppendFileSystemURL(const KURL& url) {
elements_.push_back(
FormDataElement(url, 0, BlobDataItem::kToEndOfFile, InvalidFileTime()));
}
void EncodedFormData::AppendFileSystemURLRange(
const KURL& url,
long long start,
long long length,
double expected_modification_time) {
elements_.push_back(
FormDataElement(url, start, length, expected_modification_time));
}
void EncodedFormData::Flatten(Vector<char>& data) const { void EncodedFormData::Flatten(Vector<char>& data) const {
// Concatenate all the byte arrays, but omit any files. // Concatenate all the byte arrays, but omit any files.
data.clear(); data.clear();
...@@ -183,9 +163,6 @@ unsigned long long EncodedFormData::SizeInBytes() const { ...@@ -183,9 +163,6 @@ unsigned long long EncodedFormData::SizeInBytes() const {
if (e.optional_blob_data_handle_) if (e.optional_blob_data_handle_)
size += e.optional_blob_data_handle_->size(); size += e.optional_blob_data_handle_->size();
break; break;
case FormDataElement::kEncodedFileSystemURL:
size += e.file_length_ - e.file_start_;
break;
} }
} }
return size; return size;
......
...@@ -54,24 +54,14 @@ class PLATFORM_EXPORT FormDataElement final { ...@@ -54,24 +54,14 @@ class PLATFORM_EXPORT FormDataElement final {
: type_(kEncodedBlob), : type_(kEncodedBlob),
blob_uuid_(blob_uuid), blob_uuid_(blob_uuid),
optional_blob_data_handle_(std::move(optional_handle)) {} optional_blob_data_handle_(std::move(optional_handle)) {}
FormDataElement(const KURL& file_system_url,
long long start,
long long length,
double expected_file_modification_time)
: type_(kEncodedFileSystemURL),
file_system_url_(file_system_url),
file_start_(start),
file_length_(length),
expected_file_modification_time_(expected_file_modification_time) {}
bool IsSafeToSendToAnotherThread() const; bool IsSafeToSendToAnotherThread() const;
enum Type { kData, kEncodedFile, kEncodedBlob, kEncodedFileSystemURL } type_; enum Type { kData, kEncodedFile, kEncodedBlob } type_;
Vector<char> data_; Vector<char> data_;
String filename_; String filename_;
String blob_uuid_; String blob_uuid_;
scoped_refptr<BlobDataHandle> optional_blob_data_handle_; scoped_refptr<BlobDataHandle> optional_blob_data_handle_;
KURL file_system_url_;
long long file_start_; long long file_start_;
long long file_length_; long long file_length_;
double expected_file_modification_time_; double expected_file_modification_time_;
...@@ -92,8 +82,6 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b) { ...@@ -92,8 +82,6 @@ inline bool operator==(const FormDataElement& a, const FormDataElement& b) {
b.expected_file_modification_time_; b.expected_file_modification_time_;
if (a.type_ == FormDataElement::kEncodedBlob) if (a.type_ == FormDataElement::kEncodedBlob)
return a.blob_uuid_ == b.blob_uuid_; return a.blob_uuid_ == b.blob_uuid_;
if (a.type_ == FormDataElement::kEncodedFileSystemURL)
return a.file_system_url_ == b.file_system_url_;
return true; return true;
} }
...@@ -126,11 +114,6 @@ class PLATFORM_EXPORT EncodedFormData : public RefCounted<EncodedFormData> { ...@@ -126,11 +114,6 @@ class PLATFORM_EXPORT EncodedFormData : public RefCounted<EncodedFormData> {
double expected_modification_time); double expected_modification_time);
void AppendBlob(const String& blob_uuid, void AppendBlob(const String& blob_uuid,
scoped_refptr<BlobDataHandle> optional_handle); scoped_refptr<BlobDataHandle> optional_handle);
void AppendFileSystemURL(const KURL&);
void AppendFileSystemURLRange(const KURL&,
long long start,
long long length,
double expected_modification_time);
void Flatten(Vector<char>&) const; // omits files void Flatten(Vector<char>&) const; // omits files
String FlattenToString() const; // omits files String FlattenToString() const; // omits files
......
...@@ -29,7 +29,6 @@ class EncodedFormDataTest : public ::testing::Test { ...@@ -29,7 +29,6 @@ class EncodedFormDataTest : public ::testing::Test {
EXPECT_EQ(a, b); EXPECT_EQ(a, b);
CheckDeepCopied(a.filename_, b.filename_); CheckDeepCopied(a.filename_, b.filename_);
CheckDeepCopied(a.blob_uuid_, b.blob_uuid_); CheckDeepCopied(a.blob_uuid_, b.blob_uuid_);
CheckDeepCopied(a.file_system_url_, b.file_system_url_);
} }
}; };
...@@ -38,8 +37,6 @@ TEST_F(EncodedFormDataTest, DeepCopy) { ...@@ -38,8 +37,6 @@ TEST_F(EncodedFormDataTest, DeepCopy) {
original->AppendData("Foo", 3); original->AppendData("Foo", 3);
original->AppendFileRange("example.txt", 12345, 56789, 9999.0); original->AppendFileRange("example.txt", 12345, 56789, 9999.0);
original->AppendBlob("originalUUID", nullptr); original->AppendBlob("originalUUID", nullptr);
original->AppendFileSystemURLRange(KURL(NullURL(), "ws://localhost/"), 23456,
34567, 1111.0);
Vector<char> boundary_vector; Vector<char> boundary_vector;
boundary_vector.Append("----boundaryForTest", 19); boundary_vector.Append("----boundaryForTest", 19);
...@@ -52,7 +49,7 @@ TEST_F(EncodedFormDataTest, DeepCopy) { ...@@ -52,7 +49,7 @@ TEST_F(EncodedFormDataTest, DeepCopy) {
// Check that contents are copied (compare the copy with expected values). // Check that contents are copied (compare the copy with expected values).
const Vector<FormDataElement>& original_elements = original->Elements(); const Vector<FormDataElement>& original_elements = original->Elements();
const Vector<FormDataElement>& copy_elements = copy->Elements(); const Vector<FormDataElement>& copy_elements = copy->Elements();
ASSERT_EQ(4ul, copy_elements.size()); ASSERT_EQ(3ul, copy_elements.size());
Vector<char> foo_vector; Vector<char> foo_vector;
foo_vector.Append("Foo", 3); foo_vector.Append("Foo", 3);
...@@ -69,13 +66,6 @@ TEST_F(EncodedFormDataTest, DeepCopy) { ...@@ -69,13 +66,6 @@ TEST_F(EncodedFormDataTest, DeepCopy) {
EXPECT_EQ(FormDataElement::kEncodedBlob, copy_elements[2].type_); EXPECT_EQ(FormDataElement::kEncodedBlob, copy_elements[2].type_);
EXPECT_EQ(String("originalUUID"), copy_elements[2].blob_uuid_); EXPECT_EQ(String("originalUUID"), copy_elements[2].blob_uuid_);
EXPECT_EQ(FormDataElement::kEncodedFileSystemURL, copy_elements[3].type_);
EXPECT_EQ(KURL(NullURL(), String("ws://localhost/")),
copy_elements[3].file_system_url_);
EXPECT_EQ(23456ll, copy_elements[3].file_start_);
EXPECT_EQ(34567ll, copy_elements[3].file_length_);
EXPECT_EQ(1111.0, copy_elements[3].expected_file_modification_time_);
EXPECT_EQ(45678, copy->Identifier()); EXPECT_EQ(45678, copy->Identifier());
EXPECT_EQ(boundary_vector, copy->Boundary()); EXPECT_EQ(boundary_vector, copy->Boundary());
EXPECT_EQ(true, copy->ContainsPasswordData()); EXPECT_EQ(true, copy->ContainsPasswordData());
...@@ -86,7 +76,7 @@ TEST_F(EncodedFormDataTest, DeepCopy) { ...@@ -86,7 +76,7 @@ TEST_F(EncodedFormDataTest, DeepCopy) {
// Check pointers are different, i.e. deep-copied. // Check pointers are different, i.e. deep-copied.
ASSERT_NE(original.get(), copy.get()); ASSERT_NE(original.get(), copy.get());
for (size_t i = 0; i < 4; ++i) { for (size_t i = 0; i < 3; ++i) {
if (copy_elements[i].filename_.Impl()) { if (copy_elements[i].filename_.Impl()) {
EXPECT_NE(original_elements[i].filename_.Impl(), EXPECT_NE(original_elements[i].filename_.Impl(),
copy_elements[i].filename_.Impl()); copy_elements[i].filename_.Impl());
...@@ -99,15 +89,6 @@ TEST_F(EncodedFormDataTest, DeepCopy) { ...@@ -99,15 +89,6 @@ TEST_F(EncodedFormDataTest, DeepCopy) {
EXPECT_TRUE(copy_elements[i].blob_uuid_.Impl()->HasOneRef()); EXPECT_TRUE(copy_elements[i].blob_uuid_.Impl()->HasOneRef());
} }
if (copy_elements[i].file_system_url_.GetString().Impl()) {
EXPECT_NE(original_elements[i].file_system_url_.GetString().Impl(),
copy_elements[i].file_system_url_.GetString().Impl());
EXPECT_TRUE(
copy_elements[i].file_system_url_.GetString().Impl()->HasOneRef());
}
EXPECT_EQ(nullptr, copy_elements[i].file_system_url_.InnerURL());
// m_optionalBlobDataHandle is not checked, because BlobDataHandle is // m_optionalBlobDataHandle is not checked, because BlobDataHandle is
// ThreadSafeRefCounted. // ThreadSafeRefCounted.
} }
......
...@@ -90,12 +90,6 @@ class WebHTTPBody { ...@@ -90,12 +90,6 @@ class WebHTTPBody {
double modification_time); double modification_time);
BLINK_PLATFORM_EXPORT void AppendBlob(const WebString& uuid); BLINK_PLATFORM_EXPORT void AppendBlob(const WebString& uuid);
// Append a resource which is identified by the FileSystem URL.
BLINK_PLATFORM_EXPORT void AppendFileSystemURLRange(const WebURL&,
long long start,
long long length,
double modification_time);
// Identifies a particular form submission instance. A value of 0 is // Identifies a particular form submission instance. A value of 0 is
// used to indicate an unspecified identifier. // used to indicate an unspecified identifier.
BLINK_PLATFORM_EXPORT long long Identifier() const; BLINK_PLATFORM_EXPORT long long Identifier() const;
......
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