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

Unified Diff: examples/hello_mojo/hello_mojo_server.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 | « examples/echo_terminal/main.cc ('k') | examples/indirect_service/indirect_integer_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/hello_mojo/hello_mojo_server.cc
diff --git a/examples/hello_mojo/hello_mojo_server.cc b/examples/hello_mojo/hello_mojo_server.cc
index 6d0060a10806b9635dc6f6ecf194255c9e853414..61a3c2eec8e74ced33969e722fb9607b409f0ae1 100644
--- a/examples/hello_mojo/hello_mojo_server.cc
+++ b/examples/hello_mojo/hello_mojo_server.cc
@@ -11,7 +11,6 @@
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_runner.h"
-#include "mojo/public/cpp/application/interface_factory.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/system/macros.h"
@@ -38,8 +37,7 @@ class HelloMojoImpl : public HelloMojo {
MOJO_DISALLOW_COPY_AND_ASSIGN(HelloMojoImpl);
};
-class HelloMojoServerApp : public mojo::ApplicationDelegate,
- public mojo::InterfaceFactory<HelloMojo> {
+class HelloMojoServerApp : public mojo::ApplicationDelegate {
public:
HelloMojoServerApp() {}
~HelloMojoServerApp() override {}
@@ -47,16 +45,14 @@ class HelloMojoServerApp : public mojo::ApplicationDelegate,
// |mojo::ApplicationDelegate| implementation:
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* application_connection) override {
- application_connection->AddService<HelloMojo>(this);
+ application_connection->GetServiceProviderImpl().AddService<HelloMojo>(
+ [](const mojo::ConnectionContext& connection_context,
+ mojo::InterfaceRequest<HelloMojo> hello_mojo_request) {
+ new HelloMojoImpl(std::move(hello_mojo_request)); // Owns itself.
+ });
return true;
}
- // |mojo::InterfaceFactory<HelloMojo>| implementation:
- void Create(const mojo::ConnectionContext& connection_context,
- mojo::InterfaceRequest<HelloMojo> hello_mojo_request) override {
- new HelloMojoImpl(std::move(hello_mojo_request)); // Owns itself.
- }
-
private:
MOJO_DISALLOW_COPY_AND_ASSIGN(HelloMojoServerApp);
};
« no previous file with comments | « examples/echo_terminal/main.cc ('k') | examples/indirect_service/indirect_integer_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698