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

Side by Side Diff: examples/apptest/example_service_impl.h

Issue 731293003: Use Binding instead of InterfaceImpl for ExampleService. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Address comments. Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_EXAMPLES_TEST_EXAMPLE_SERVICE_IMPL_H_ 5 #ifndef MOJO_EXAMPLES_TEST_EXAMPLE_SERVICE_IMPL_H_
6 #define MOJO_EXAMPLES_TEST_EXAMPLE_SERVICE_IMPL_H_ 6 #define MOJO_EXAMPLES_TEST_EXAMPLE_SERVICE_IMPL_H_
7 7
8 #include "examples/apptest/example_service.mojom.h" 8 #include "examples/apptest/example_service.mojom.h"
9 #include "mojo/public/cpp/bindings/strong_binding.h"
9 #include "mojo/public/cpp/system/macros.h" 10 #include "mojo/public/cpp/system/macros.h"
10 11
11 namespace mojo { 12 namespace mojo {
12 13
13 class ApplicationConnection; 14 class ApplicationConnection;
14 15
15 class ExampleServiceImpl : public InterfaceImpl<ExampleService> { 16 class ExampleServiceImpl : public ExampleService {
16 public: 17 public:
17 ExampleServiceImpl(); 18 explicit ExampleServiceImpl(InterfaceRequest<ExampleService> request);
18 virtual ~ExampleServiceImpl(); 19 ~ExampleServiceImpl() override;
19 20
20 private: 21 private:
21 // InterfaceImpl<ExampleService> overrides. 22 // ExampleService overrides.
22 virtual void Ping(uint16_t ping_value) override; 23 void Ping(uint16_t ping_value) override;
23 virtual void RunCallback(const Callback<void()>& callback) override; 24 void RunCallback(const Callback<void()>& callback) override;
25
26 // ExampleServiceImpl deletes itself on detecting a pipe error.
jamesr 2014/11/17 23:16:14 not technically true (the binding deletes ExampleS
msw 2014/11/17 23:27:03 Sorry; done!
27 StrongBinding<ExampleService> binding_;
24 28
25 MOJO_DISALLOW_COPY_AND_ASSIGN(ExampleServiceImpl); 29 MOJO_DISALLOW_COPY_AND_ASSIGN(ExampleServiceImpl);
26 }; 30 };
27 31
28 } // namespace mojo 32 } // namespace mojo
29 33
30 #endif // MOJO_EXAMPLES_TEST_EXAMPLE_SERVICE_IMPL_H_ 34 #endif // MOJO_EXAMPLES_TEST_EXAMPLE_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « examples/apptest/example_service_application.cc ('k') | examples/apptest/example_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698