Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: services/asset_bundle/main.cc

Issue 1975253002: ApplicationConnection devolution, part 2.1. (Closed) Base URL: https://github.com/domokit/mojo.git@work792-x-work791_service_registry_spimpl
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/ui/view_provider_app.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/asset_bundle/main.cc
diff --git a/services/asset_bundle/main.cc b/services/asset_bundle/main.cc
index 9d06e5203edc8bed0493558a81299e9a5977465e..4ff8f175cbbb68753e209fb460c127892c9c2a78 100644
--- a/services/asset_bundle/main.cc
+++ b/services/asset_bundle/main.cc
@@ -8,14 +8,12 @@
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
-#include "mojo/public/cpp/application/interface_factory.h"
#include "services/asset_bundle/asset_unpacker_impl.h"
namespace mojo {
namespace asset_bundle {
-class AssetBundleApp : public ApplicationDelegate,
- public InterfaceFactory<AssetUnpacker> {
+class AssetBundleApp : public ApplicationDelegate {
public:
AssetBundleApp() {}
~AssetBundleApp() override {}
@@ -23,29 +21,27 @@ class AssetBundleApp : public ApplicationDelegate,
private:
// |ApplicationDelegate| override:
bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
- connection->AddService<AssetUnpacker>(this);
+ connection->GetServiceProviderImpl().AddService<AssetUnpacker>(
+ [this](const ConnectionContext& connection_context,
+ InterfaceRequest<AssetUnpacker> asset_unpacker_request) {
+ // Lazily initialize |sequenced_worker_pool_|. (We can't create it in
+ // the constructor, since AtExitManager is only created in
+ // ApplicationRunnerChromium::Run().)
+ if (!sequenced_worker_pool_) {
+ // TODO(vtl): What's the "right" way to choose the maximum number of
+ // threads?
+ sequenced_worker_pool_ =
+ new base::SequencedWorkerPool(4, "AssetBundleWorker");
+ }
+
+ new AssetUnpackerImpl(
+ asset_unpacker_request.Pass(),
+ sequenced_worker_pool_->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
+ });
return true;
}
- // |InterfaceFactory<AssetUnpacker>| implementation:
- void Create(const ConnectionContext& connection_context,
- InterfaceRequest<AssetUnpacker> request) override {
- // Lazily initialize |sequenced_worker_pool_|. (We can't create it in the
- // constructor, since AtExitManager is only created in
- // ApplicationRunnerChromium::Run().)
- if (!sequenced_worker_pool_) {
- // TODO(vtl): What's the "right" way to choose the maximum number of
- // threads?
- sequenced_worker_pool_ =
- new base::SequencedWorkerPool(4, "AssetBundleWorker");
- }
-
- new AssetUnpackerImpl(
- request.Pass(),
- sequenced_worker_pool_->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
- }
-
// We don't really need the "sequenced" part, but we need to be able to shut
// down our worker pool.
scoped_refptr<base::SequencedWorkerPool> sequenced_worker_pool_;
« no previous file with comments | « mojo/ui/view_provider_app.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698