| 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 #include "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/threading/sequenced_worker_pool.h" | 6 #include "base/threading/sequenced_worker_pool.h" |
| 7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
| 8 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
| 9 #include "mojo/public/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 ~AssetBundleApp() override {} | 21 ~AssetBundleApp() override {} |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 // |ApplicationDelegate| override: | 24 // |ApplicationDelegate| override: |
| 25 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 25 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
| 26 connection->AddService<AssetUnpacker>(this); | 26 connection->AddService<AssetUnpacker>(this); |
| 27 return true; | 27 return true; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // |InterfaceFactory<AssetUnpacker>| implementation: | 30 // |InterfaceFactory<AssetUnpacker>| implementation: |
| 31 void Create(ApplicationConnection* connection, | 31 void Create(const ConnectionContext& connection_context, |
| 32 InterfaceRequest<AssetUnpacker> request) override { | 32 InterfaceRequest<AssetUnpacker> request) override { |
| 33 // Lazily initialize |sequenced_worker_pool_|. (We can't create it in the | 33 // Lazily initialize |sequenced_worker_pool_|. (We can't create it in the |
| 34 // constructor, since AtExitManager is only created in | 34 // constructor, since AtExitManager is only created in |
| 35 // ApplicationRunnerChromium::Run().) | 35 // ApplicationRunnerChromium::Run().) |
| 36 if (!sequenced_worker_pool_) { | 36 if (!sequenced_worker_pool_) { |
| 37 // TODO(vtl): What's the "right" way to choose the maximum number of | 37 // TODO(vtl): What's the "right" way to choose the maximum number of |
| 38 // threads? | 38 // threads? |
| 39 sequenced_worker_pool_ = | 39 sequenced_worker_pool_ = |
| 40 new base::SequencedWorkerPool(4, "AssetBundleWorker"); | 40 new base::SequencedWorkerPool(4, "AssetBundleWorker"); |
| 41 } | 41 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace asset_bundle | 56 } // namespace asset_bundle |
| 57 } // namespace mojo | 57 } // namespace mojo |
| 58 | 58 |
| 59 MojoResult MojoMain(MojoHandle application_request) { | 59 MojoResult MojoMain(MojoHandle application_request) { |
| 60 mojo::ApplicationRunnerChromium runner( | 60 mojo::ApplicationRunnerChromium runner( |
| 61 new mojo::asset_bundle::AssetBundleApp()); | 61 new mojo::asset_bundle::AssetBundleApp()); |
| 62 return runner.Run(application_request); | 62 return runner.Run(application_request); |
| 63 } | 63 } |
| OLD | NEW |