OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef SERVICES_ASSET_BUNDLE_ASSET_UNPACKER_JOB_H_ | 5 #ifndef SERVICES_ASSET_BUNDLE_ASSET_UNPACKER_JOB_H_ |
6 #define SERVICES_ASSET_BUNDLE_ASSET_UNPACKER_JOB_H_ | 6 #define SERVICES_ASSET_BUNDLE_ASSET_UNPACKER_JOB_H_ |
7 | 7 |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/task_runner.h" | 11 #include "base/task_runner.h" |
12 #include "mojo/data_pipe_utils/data_pipe_utils.h" | 12 #include "mojo/data_pipe_utils/data_pipe_utils.h" |
13 #include "mojo/public/cpp/bindings/interface_request.h" | 13 #include "mojo/public/cpp/bindings/interface_request.h" |
14 #include "mojo/services/asset_bundle/public/interfaces/asset_bundle.mojom.h" | 14 #include "mojo/services/asset_bundle/interfaces/asset_bundle.mojom.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace asset_bundle { | 17 namespace asset_bundle { |
18 | 18 |
19 class AssetUnpackerJob { | 19 class AssetUnpackerJob { |
20 public: | 20 public: |
21 AssetUnpackerJob(InterfaceRequest<AssetBundle> asset_bundle, | 21 AssetUnpackerJob(InterfaceRequest<AssetBundle> asset_bundle, |
22 scoped_refptr<base::TaskRunner> worker_runner); | 22 scoped_refptr<base::TaskRunner> worker_runner); |
23 ~AssetUnpackerJob(); | 23 ~AssetUnpackerJob(); |
24 | 24 |
25 void Unpack(ScopedDataPipeConsumerHandle zipped_assets); | 25 void Unpack(ScopedDataPipeConsumerHandle zipped_assets); |
26 | 26 |
27 private: | 27 private: |
28 void OnZippedAssetsAvailable(const base::FilePath& zip_path, bool success); | 28 void OnZippedAssetsAvailable(const base::FilePath& zip_path, bool success); |
29 void OnUnzippedAssetsAvailable(scoped_ptr<base::ScopedTempDir> temp_dir); | 29 void OnUnzippedAssetsAvailable(scoped_ptr<base::ScopedTempDir> temp_dir); |
30 | 30 |
31 InterfaceRequest<AssetBundle> asset_bundle_; | 31 InterfaceRequest<AssetBundle> asset_bundle_; |
32 scoped_refptr<base::TaskRunner> worker_runner_; | 32 scoped_refptr<base::TaskRunner> worker_runner_; |
33 base::WeakPtrFactory<AssetUnpackerJob> weak_factory_; | 33 base::WeakPtrFactory<AssetUnpackerJob> weak_factory_; |
34 | 34 |
35 DISALLOW_COPY_AND_ASSIGN(AssetUnpackerJob); | 35 DISALLOW_COPY_AND_ASSIGN(AssetUnpackerJob); |
36 }; | 36 }; |
37 | 37 |
38 } // namespace asset_bundle | 38 } // namespace asset_bundle |
39 } // namespace mojo | 39 } // namespace mojo |
40 | 40 |
41 #endif // SERVICES_ASSET_BUNDLE_ASSET_UNPACKER_JOB_H_ | 41 #endif // SERVICES_ASSET_BUNDLE_ASSET_UNPACKER_JOB_H_ |
OLD | NEW |