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

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: Created 8 years, 1 month 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 break; 222 break;
223 } else if (num_bytes_read > 0) { 223 } else if (num_bytes_read > 0) {
224 // Some data is read. Write it to the output file. 224 // Some data is read. Write it to the output file.
225 if (num_bytes_read != stream.WriteSync(buf, num_bytes_read)) { 225 if (num_bytes_read != stream.WriteSync(buf, num_bytes_read)) {
226 success = false; 226 success = false;
227 break; 227 break;
228 } 228 }
229 } 229 }
230 } 230 }
231 231
232 stream.CloseSync();
233 unzCloseCurrentFile(zip_file_); 232 unzCloseCurrentFile(zip_file_);
234 return success; 233 return success;
235 } 234 }
236 235
237 bool ZipReader::ExtractCurrentEntryIntoDirectory( 236 bool ZipReader::ExtractCurrentEntryIntoDirectory(
238 const FilePath& output_directory_path) { 237 const FilePath& output_directory_path) {
239 DCHECK(current_entry_info_.get()); 238 DCHECK(current_entry_info_.get());
240 239
241 FilePath output_file_path = output_directory_path.Append( 240 FilePath output_file_path = output_directory_path.Append(
242 current_entry_info()->file_path()); 241 current_entry_info()->file_path());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 299 }
301 300
302 void ZipReader::Reset() { 301 void ZipReader::Reset() {
303 zip_file_ = NULL; 302 zip_file_ = NULL;
304 num_entries_ = 0; 303 num_entries_ = 0;
305 reached_end_ = false; 304 reached_end_ = false;
306 current_entry_info_.reset(); 305 current_entry_info_.reset();
307 } 306 }
308 307
309 } // namespace zip 308 } // namespace zip
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698