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

Side by Side Diff: mojo/application/public/cpp/application_connection.h

Issue 1195003002: Mandoline: Introduce ApplicationConnection::CloseConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 5 years, 5 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 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_APPLICATION_PUBLIC_CPP_APPLICATION_CONNECTION_H_ 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_CONNECTION_H_
6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_CONNECTION_H_ 6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_CONNECTION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "mojo/application/public/cpp/lib/interface_factory_connector.h" 10 #include "mojo/application/public/cpp/lib/interface_factory_connector.h"
(...skipping 22 matching lines...) Expand all
33 // connection->AddService<Bar>(&my_foo_and_bar_factory_); 33 // connection->AddService<Bar>(&my_foo_and_bar_factory_);
34 // 34 //
35 // The InterfaceFactory must outlive the ApplicationConnection. 35 // The InterfaceFactory must outlive the ApplicationConnection.
36 // 36 //
37 // Additionally you specify a ServiceConnector. If a ServiceConnector has 37 // Additionally you specify a ServiceConnector. If a ServiceConnector has
38 // been set and an InterfaceFactory has not been registered for the interface 38 // been set and an InterfaceFactory has not been registered for the interface
39 // request, than the interface request is sent to the ServiceConnector. 39 // request, than the interface request is sent to the ServiceConnector.
40 // 40 //
41 // Just as with InterfaceFactory, ServiceConnector must outlive 41 // Just as with InterfaceFactory, ServiceConnector must outlive
42 // ApplicationConnection. 42 // ApplicationConnection.
43 //
44 // An ApplicationConnection's lifetime is managed by an ApplicationImpl. To
45 // close a connection, call CloseConnection which will destroy this object.
43 class ApplicationConnection { 46 class ApplicationConnection {
44 public: 47 public:
45 virtual ~ApplicationConnection(); 48 virtual ~ApplicationConnection();
sky 2015/06/29 16:56:02 Can the destructor be made protected to prevent ac
Fady Samuel 2015/06/29 20:32:36 I took the following approach. 1. I made ~Applica
46 49
50 // Closes the connection.
51 virtual void CloseConnection() = 0;
52
47 // See class description for details. 53 // See class description for details.
48 virtual void SetServiceConnector(ServiceConnector* connector) = 0; 54 virtual void SetServiceConnector(ServiceConnector* connector) = 0;
49 55
50 // Makes Interface available as a service to the remote application. 56 // Makes Interface available as a service to the remote application.
51 // |factory| will create implementations of Interface on demand. 57 // |factory| will create implementations of Interface on demand.
52 template <typename Interface> 58 template <typename Interface>
53 void AddService(InterfaceFactory<Interface>* factory) { 59 void AddService(InterfaceFactory<Interface>* factory) {
54 SetServiceConnectorForName( 60 SetServiceConnectorForName(
55 new internal::InterfaceFactoryConnector<Interface>(factory), 61 new internal::InterfaceFactoryConnector<Interface>(factory),
56 Interface::Name_); 62 Interface::Name_);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 virtual ServiceProvider* GetServiceProvider() = 0; 95 virtual ServiceProvider* GetServiceProvider() = 0;
90 96
91 private: 97 private:
92 virtual void SetServiceConnectorForName(ServiceConnector* service_connector, 98 virtual void SetServiceConnectorForName(ServiceConnector* service_connector,
93 const std::string& name) = 0; 99 const std::string& name) = 0;
94 }; 100 };
95 101
96 } // namespace mojo 102 } // namespace mojo
97 103
98 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_CONNECTION_H_ 104 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698