| OLD | NEW |
| 1 // Copyright 2014 The Chromium OS Authors. All rights reserved. | 1 // Copyright 2014 The Chromium OS 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 #ifndef VOLUME_H_ | 5 #ifndef VOLUME_H_ |
| 6 #define VOLUME_H_ | 6 #define VOLUME_H_ |
| 7 | 7 |
| 8 #include <pthread.h> | 8 #include <pthread.h> |
| 9 | 9 |
| 10 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const std::string& file_system_id, | 53 const std::string& file_system_id, |
| 54 JavaScriptMessageSenderInterface* message_sender, | 54 JavaScriptMessageSenderInterface* message_sender, |
| 55 VolumeArchiveFactoryInterface* volume_archive_factory, | 55 VolumeArchiveFactoryInterface* volume_archive_factory, |
| 56 VolumeReaderFactoryInterface* volume_reader_factory); | 56 VolumeReaderFactoryInterface* volume_reader_factory); |
| 57 | 57 |
| 58 virtual ~Volume(); | 58 virtual ~Volume(); |
| 59 | 59 |
| 60 // Initializes the volume. | 60 // Initializes the volume. |
| 61 bool Init(); | 61 bool Init(); |
| 62 | 62 |
| 63 // Reads archive metadata using libarchive. | 63 // Reads archive metadata using minizip. |
| 64 void ReadMetadata(const std::string& request_id, | 64 void ReadMetadata(const std::string& request_id, |
| 65 const std::string& encoding, | 65 const std::string& encoding, |
| 66 int64_t archive_size); | 66 int64_t archive_size); |
| 67 | 67 |
| 68 // Processes a successful archive chunk read from JavaScript. Read offset | 68 // Processes a successful archive chunk read from JavaScript. Read offset |
| 69 // represents the offset from where the data contained in array_buffer starts. | 69 // represents the offset from where the data contained in array_buffer starts. |
| 70 void ReadChunkDone(const std::string& nacl_request_id, | 70 void ReadChunkDone(const std::string& nacl_request_id, |
| 71 const pp::VarArrayBuffer& array_buffer, | 71 const pp::VarArrayBuffer& array_buffer, |
| 72 int64_t read_offset); | 72 int64_t read_offset); |
| 73 | 73 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const pp::VarDictionary& dictionary); | 130 const pp::VarDictionary& dictionary); |
| 131 | 131 |
| 132 // Creates a new archive object for this volume. | 132 // Creates a new archive object for this volume. |
| 133 VolumeArchive* CreateVolumeArchive(const std::string& request_id, | 133 VolumeArchive* CreateVolumeArchive(const std::string& request_id, |
| 134 const std::string& encoding, | 134 const std::string& encoding, |
| 135 int64_t archive_size); | 135 int64_t archive_size); |
| 136 | 136 |
| 137 // Clears job. | 137 // Clears job. |
| 138 void ClearJob(); | 138 void ClearJob(); |
| 139 | 139 |
| 140 // Libarchive wrapper instance per volume, shared across all operations. | 140 // Minizip wrapper instance per volume, shared across all operations. |
| 141 VolumeArchive* volume_archive_; | 141 VolumeArchive* volume_archive_; |
| 142 | 142 |
| 143 // The file system id for this volume. | 143 // The file system id for this volume. |
| 144 std::string file_system_id_; | 144 std::string file_system_id_; |
| 145 | 145 |
| 146 // An object that sends messages to JavaScript. | 146 // An object that sends messages to JavaScript. |
| 147 JavaScriptMessageSenderInterface* message_sender_; | 147 JavaScriptMessageSenderInterface* message_sender_; |
| 148 | 148 |
| 149 // A worker for jobs that require blocking operations or a lot of processing | 149 // A worker for jobs that require blocking operations or a lot of processing |
| 150 // time. Those shouldn't be done on the main thread. The jobs submitted to | 150 // time. Those shouldn't be done on the main thread. The jobs submitted to |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 VolumeArchiveFactoryInterface* volume_archive_factory_; | 182 VolumeArchiveFactoryInterface* volume_archive_factory_; |
| 183 | 183 |
| 184 // A factory for creating VolumeReader. | 184 // A factory for creating VolumeReader. |
| 185 VolumeReaderFactoryInterface* volume_reader_factory_; | 185 VolumeReaderFactoryInterface* volume_reader_factory_; |
| 186 | 186 |
| 187 // A map that converts index of file in the volume to pathname. | 187 // A map that converts index of file in the volume to pathname. |
| 188 std::map<int, std::string> index_to_pathname_; | 188 std::map<int, std::string> index_to_pathname_; |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 #endif /// VOLUME_H_ | 191 #endif /// VOLUME_H_ |
| OLD | NEW |