Chromium Code Reviews

Unified Diff: services/native_support/main.cc

Issue 1981513002: ApplicationConnection devolution, part 2.2. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « services/nacl/nonsfi/pnacl_link.cc ('k') | services/native_viewport/app_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/native_support/main.cc
diff --git a/services/native_support/main.cc b/services/native_support/main.cc
index 11e8a7d0521a702fd467f6b67e8cbebed6c7a09d..9fdbfb93a9b31e256572ed9568d9228e7bcc4506 100644
--- a/services/native_support/main.cc
+++ b/services/native_support/main.cc
@@ -10,7 +10,6 @@
#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 "mojo/services/native_support/interfaces/process.mojom.h"
#include "services/native_support/process_impl.h"
@@ -19,8 +18,7 @@ namespace native_support {
// TODO(vtl): Having to manually choose an arbitrary number is dumb.
const size_t kMaxWorkerThreads = 16;
-class NativeSupportApp : public mojo::ApplicationDelegate,
- public mojo::InterfaceFactory<Process> {
+class NativeSupportApp : public mojo::ApplicationDelegate {
public:
NativeSupportApp() {}
~NativeSupportApp() override {
@@ -32,20 +30,18 @@ class NativeSupportApp : public mojo::ApplicationDelegate,
// |mojo::ApplicationDelegate| override:
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override {
- connection->AddService<Process>(this);
+ connection->GetServiceProviderImpl().AddService<Process>([this](
+ const mojo::ConnectionContext& connection_context,
+ mojo::InterfaceRequest<Process> process_request) {
+ if (!worker_pool_) {
+ worker_pool_ = new base::SequencedWorkerPool(kMaxWorkerThreads,
+ "NativeSupportWorker");
+ }
+ new ProcessImpl(worker_pool_, connection_context, process_request.Pass());
+ });
return true;
}
- // |InterfaceFactory<Process>| implementation:
- void Create(const mojo::ConnectionContext& connection_context,
- mojo::InterfaceRequest<Process> request) override {
- if (!worker_pool_) {
- worker_pool_ = new base::SequencedWorkerPool(kMaxWorkerThreads,
- "NativeSupportWorker");
- }
- new ProcessImpl(worker_pool_, connection_context, request.Pass());
- }
-
scoped_refptr<base::SequencedWorkerPool> worker_pool_;
DISALLOW_COPY_AND_ASSIGN(NativeSupportApp);
« no previous file with comments | « services/nacl/nonsfi/pnacl_link.cc ('k') | services/native_viewport/app_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine