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

Unified Diff: third_party/zlib/google/zip.cc

Issue 204983012: Stop using net::FileStream synchronously in third_party/zlib (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « third_party/zlib/google/DEPS ('k') | third_party/zlib/google/zip_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/zlib/google/zip.cc
diff --git a/third_party/zlib/google/zip.cc b/third_party/zlib/google/zip.cc
index 52fc6948bb6aa38a68c5dec74284786d3faca707..5fbfca979b681a112fe573bde16eaedcc7ba7e26 100644
--- a/third_party/zlib/google/zip.cc
+++ b/third_party/zlib/google/zip.cc
@@ -8,12 +8,11 @@
#include <vector>
#include "base/bind.h"
-#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/file_enumerator.h"
#include "base/logging.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
-#include "net/base/file_stream.h"
#include "third_party/zlib/google/zip_internal.h"
#include "third_party/zlib/google/zip_reader.h"
@@ -60,18 +59,16 @@ zip_fileinfo GetFileInfoForZipping(const base::FilePath& path) {
}
bool AddFileToZip(zipFile zip_file, const base::FilePath& src_dir) {
- net::FileStream stream(NULL);
- int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
- if (stream.OpenSync(src_dir, flags) != 0) {
- DLOG(ERROR) << "Could not open stream for path "
- << src_dir.value();
+ base::File file(src_dir, base::File::FLAG_OPEN | base::File::FLAG_READ);
+ if (!file.IsValid()) {
+ DLOG(ERROR) << "Could not open file for path " << src_dir.value();
return false;
}
int num_bytes;
char buf[zip::internal::kZipBufSize];
do {
- num_bytes = stream.ReadSync(buf, zip::internal::kZipBufSize);
+ num_bytes = file.ReadAtCurrentPos(buf, zip::internal::kZipBufSize);
if (num_bytes > 0) {
if (ZIP_OK != zipWriteInFileInZip(zip_file, buf, num_bytes)) {
DLOG(ERROR) << "Could not write data to zip for path "
« no previous file with comments | « third_party/zlib/google/DEPS ('k') | third_party/zlib/google/zip_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698