| 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 "archive.h" | |
| 11 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
| 12 #include "ppapi/cpp/var_array_buffer.h" | 11 #include "ppapi/cpp/var_array_buffer.h" |
| 13 #include "ppapi/cpp/var_dictionary.h" | 12 #include "ppapi/cpp/var_dictionary.h" |
| 14 #include "ppapi/utility/completion_callback_factory.h" | 13 #include "ppapi/utility/completion_callback_factory.h" |
| 15 #include "ppapi/utility/threading/lock.h" | 14 #include "ppapi/utility/threading/lock.h" |
| 16 #include "ppapi/utility/threading/simple_thread.h" | 15 #include "ppapi/utility/threading/simple_thread.h" |
| 17 | 16 |
| 18 #include "javascript_requestor_interface.h" | 17 #include "javascript_requestor_interface.h" |
| 19 #include "javascript_message_sender_interface.h" | 18 #include "javascript_message_sender_interface.h" |
| 20 #include "volume_archive.h" | 19 #include "volume_archive.h" |
| 21 | 20 |
| 22 // A factory that creates VolumeArchive(s). Useful for testing. | 21 // A factory that creates VolumeArchive(s). Useful for testing. |
| 23 class VolumeArchiveFactoryInterface { | 22 class VolumeArchiveFactoryInterface { |
| 24 public: | 23 public: |
| 25 virtual ~VolumeArchiveFactoryInterface() {} | 24 virtual ~VolumeArchiveFactoryInterface() {} |
| 26 | 25 |
| 27 // Creates a new VolumeArchive. | 26 // Creates a new VolumeArchive. |
| 28 virtual VolumeArchive* Create(VolumeReader* reader) = 0; | 27 virtual VolumeArchive* Create(VolumeReader* reader) = 0; |
| 29 }; | 28 }; |
| 30 | 29 |
| 31 // A factory that creates VolumeReader(s). Useful for testing. | 30 // A factory that creates VolumeReader(s). Useful for testing. |
| 32 class VolumeReaderFactoryInterface { | 31 class VolumeReaderFactoryInterface { |
| 33 public: | 32 public: |
| 34 virtual ~VolumeReaderFactoryInterface() {} | 33 virtual ~VolumeReaderFactoryInterface() {} |
| 35 | 34 |
| 36 // Creates a new VolumeReader. Returns NULL if failed. | 35 // Creates a new VolumeReader. Returns nullptr if failed. |
| 37 // Passes VolumeReader ownership to the implementation of | 36 // Passes VolumeReader ownership to the implementation of |
| 38 // VolumeArchiveInterfaceInterface. | 37 // VolumeArchiveInterfaceInterface. |
| 39 virtual VolumeReader* Create(int64_t archive_size) = 0; | 38 virtual VolumeReader* Create(int64_t archive_size) = 0; |
| 40 }; | 39 }; |
| 41 | 40 |
| 42 // Handles all operations like reading metadata and reading files from a single | 41 // Handles all operations like reading metadata and reading files from a single |
| 43 // Volume. | 42 // Volume. |
| 44 class Volume { | 43 class Volume { |
| 45 public: | 44 public: |
| 46 Volume(const pp::InstanceHandle& instance_handle /* Used for workers. */, | 45 Volume(const pp::InstanceHandle& instance_handle /* Used for workers. */, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 pp::Lock job_lock_; // A lock for guarding members related to jobs. | 176 pp::Lock job_lock_; // A lock for guarding members related to jobs. |
| 178 | 177 |
| 179 // A requestor for making calls to JavaScript. | 178 // A requestor for making calls to JavaScript. |
| 180 JavaScriptRequestorInterface* requestor_; | 179 JavaScriptRequestorInterface* requestor_; |
| 181 | 180 |
| 182 // A factory for creating VolumeArchive. | 181 // A factory for creating VolumeArchive. |
| 183 VolumeArchiveFactoryInterface* volume_archive_factory_; | 182 VolumeArchiveFactoryInterface* volume_archive_factory_; |
| 184 | 183 |
| 185 // A factory for creating VolumeReader. | 184 // A factory for creating VolumeReader. |
| 186 VolumeReaderFactoryInterface* volume_reader_factory_; | 185 VolumeReaderFactoryInterface* volume_reader_factory_; |
| 186 |
| 187 // A map that converts index of file in the volume to pathname. |
| 188 std::map<int, std::string> index_to_pathname_; |
| 187 }; | 189 }; |
| 188 | 190 |
| 189 #endif /// VOLUME_H_ | 191 #endif /// VOLUME_H_ |
| OLD | NEW |