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

Side by Side Diff: chrome/common/zip_reader.cc

Issue 10701050: net: Implement canceling of all async operations in FileStream. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Correct fix for UploadFileElementReader Created 8 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/zip_reader.h" 5 #include "chrome/common/zip_reader.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 break; 210 break;
211 } else if (num_bytes_read > 0) { 211 } else if (num_bytes_read > 0) {
212 // Some data is read. Write it to the output file. 212 // Some data is read. Write it to the output file.
213 if (num_bytes_read != stream.WriteSync(buf, num_bytes_read)) { 213 if (num_bytes_read != stream.WriteSync(buf, num_bytes_read)) {
214 success = false; 214 success = false;
215 break; 215 break;
216 } 216 }
217 } 217 }
218 } 218 }
219 219
220 stream.CloseSync();
221 unzCloseCurrentFile(zip_file_); 220 unzCloseCurrentFile(zip_file_);
222 return success; 221 return success;
223 } 222 }
224 223
225 bool ZipReader::ExtractCurrentEntryIntoDirectory( 224 bool ZipReader::ExtractCurrentEntryIntoDirectory(
226 const FilePath& output_directory_path) { 225 const FilePath& output_directory_path) {
227 DCHECK(current_entry_info_.get()); 226 DCHECK(current_entry_info_.get());
228 227
229 FilePath output_file_path = output_directory_path.Append( 228 FilePath output_file_path = output_directory_path.Append(
230 current_entry_info()->file_path()); 229 current_entry_info()->file_path());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 287 }
289 288
290 void ZipReader::Reset() { 289 void ZipReader::Reset() {
291 zip_file_ = NULL; 290 zip_file_ = NULL;
292 num_entries_ = 0; 291 num_entries_ = 0;
293 reached_end_ = false; 292 reached_end_ = false;
294 current_entry_info_.reset(); 293 current_entry_info_.reset();
295 } 294 }
296 295
297 } // namespace zip 296 } // namespace zip
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698