Chromium Code Reviews| Index: third_party/zlib/google/zip_reader.h |
| diff --git a/third_party/zlib/google/zip_reader.h b/third_party/zlib/google/zip_reader.h |
| index a1f470421525197a68b04bc3bd10a2d8257f467c..c2ae8924dec59e559661362cc06f61cd7f74bed8 100644 |
| --- a/third_party/zlib/google/zip_reader.h |
| +++ b/third_party/zlib/google/zip_reader.h |
| @@ -1,7 +1,6 @@ |
| // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| - |
| #ifndef THIRD_PARTY_ZLIB_GOOGLE_ZIP_READER_H_ |
| #define THIRD_PARTY_ZLIB_GOOGLE_ZIP_READER_H_ |
| @@ -11,6 +10,7 @@ |
| #include "base/file_util.h" |
| #include "base/files/file_path.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/platform_file.h" |
| #include "base/time/time.h" |
| @@ -130,6 +130,15 @@ class ZipReader { |
| // This function does not preserve the timestamp of the original entry. |
| bool ExtractCurrentEntryToFilePath(const base::FilePath& output_file_path); |
| + // Asynchronously extracts the current entry to the given output file path. |
| + // If the current entry is a directory it just creates the directory |
| + // synchronously instead. OpenCurrentEntryInZip() must be called beforehand. |
|
satorux1
2013/12/11 06:45:11
Please document callback parameters.
Drew Haven
2013/12/11 18:20:53
I ended up with split documentation between the ty
|
| + void ExtractCurrentEntryToFilePathAsync( |
| + const base::FilePath& output_file_path, |
| + base::Closure success_callback, |
| + base::Closure failure_Callback, |
|
satorux1
2013/12/11 06:45:11
failure_callback
Drew Haven
2013/12/11 18:20:53
Done.
|
| + base::Callback<void(int64)> progress_callback); |
|
satorux1
2013/12/11 06:45:11
Let's typedef this:
typedef base::Callback<void(i
Drew Haven
2013/12/11 18:20:53
Done.
|
| + |
| // Extracts the current entry to the given output directory path using |
| // ExtractCurrentEntryToFilePath(). Sub directories are created as needed |
| // based on the file path of the current entry. For example, if the file |
| @@ -164,11 +173,20 @@ class ZipReader { |
| // Resets the internal state. |
| void Reset(); |
| + // Unzip loop for asynchronous code. |
|
satorux1
2013/12/11 06:45:11
Function comments should usually start from a verb
Drew Haven
2013/12/11 18:20:53
Done.
|
| + void ExtractChunk(base::PlatformFile target_file, |
| + base::Closure success_callback, |
| + base::Closure failure_callback, |
| + base::Callback<void(int64)> progress_callback, |
| + const int64 offset); |
| + |
| unzFile zip_file_; |
| int num_entries_; |
| bool reached_end_; |
| scoped_ptr<EntryInfo> current_entry_info_; |
| + base::WeakPtrFactory<ZipReader> weak_factory_; |
|
satorux1
2013/12/11 06:45:11
nit: weak_ptr_factory_
Drew Haven
2013/12/11 18:20:53
I thought that was weird too. But it happens to b
|
| + |
| DISALLOW_COPY_AND_ASSIGN(ZipReader); |
| }; |