Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: components/filesystem/file_impl.cc

Issue 1646673002: mojo filesystem: Simplify full file reading/writing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Take 2 at trying to fix compile. The release version is complaining about duplicate -1s and this is… Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/filesystem/file_impl.cc
diff --git a/components/filesystem/file_impl.cc b/components/filesystem/file_impl.cc
index da156c8618c7a3e0c5e378d8cf554dedec12e11f..8a3682b075e0c20bb1bc26b5edb4054be7b95877 100644
--- a/components/filesystem/file_impl.cc
+++ b/components/filesystem/file_impl.cc
@@ -94,28 +94,6 @@ void FileImpl::Read(uint32_t num_bytes_to_read,
callback.Run(FileError::OK, std::move(bytes_read));
}
-void FileImpl::ReadEntireFile(const ReadEntireFileCallback& callback) {
- if (!file_.IsValid()) {
- callback.Run(GetError(file_), mojo::Array<uint8_t>());
- return;
- }
-
- // Seek to the front of the file.
- if (file_.Seek(base::File::FROM_BEGIN, 0) == -1) {
- callback.Run(FileError::FAILED, mojo::Array<uint8_t>());
- return;
- }
-
- std::string contents;
- const int kBufferSize = 1 << 16;
- scoped_ptr<char[]> buf(new char[kBufferSize]);
- size_t len;
- while ((len = file_.ReadAtCurrentPos(buf.get(), kBufferSize)) > 0)
- contents.append(buf.get(), len);
-
- callback.Run(FileError::OK, mojo::Array<uint8_t>::From(contents));
-}
-
// TODO(vtl): Move the implementation to a thread pool.
void FileImpl::Write(mojo::Array<uint8_t> bytes_to_write,
int64_t offset,
« no previous file with comments | « components/filesystem/file_impl.h ('k') | components/filesystem/public/cpp/prefs/filesystem_json_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698