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

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

Issue 394903005: mojo: terminate apps if the shell goes away (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
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_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ 5 #ifndef MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_
6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ 6 #define MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_
7 #include <vector> 7 #include <vector>
8 8
9 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/lib/service_connector.h" 10 #include "mojo/public/cpp/application/lib/service_connector.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // }; 51 // };
52 // 52 //
53 // or 53 // or
54 // 54 //
55 // class BarImpl : public InterfaceImpl<Bar> { 55 // class BarImpl : public InterfaceImpl<Bar> {
56 // public: 56 // public:
57 // // contexts will remain valid for the lifetime of BarImpl. 57 // // contexts will remain valid for the lifetime of BarImpl.
58 // BarImpl(ApplicationContext* app_context, BarContext* service_context) 58 // BarImpl(ApplicationContext* app_context, BarContext* service_context)
59 // : app_context_(app_context), servicecontext_(context) {} 59 // : app_context_(app_context), servicecontext_(context) {}
60 // 60 //
61 // Create an ApplicationDele instance that collects any service implementations. 61 // Create an ApplicationImpl instance that collects any service implementations.
62 // 62 //
63 // ApplicationImpl app(service_provider_handle); 63 // ApplicationImpl app(service_provider_handle);
64 // app.AddService<FooImpl>(); 64 // app.AddService<FooImpl>();
65 // 65 //
66 // BarContext context; 66 // BarContext context;
67 // app.AddService<BarImpl>(&context); 67 // app.AddService<BarImpl>(&context);
68 // 68 //
69 // 69 //
70 class ApplicationImpl : public InterfaceImpl<Application> { 70 class ApplicationImpl : public InterfaceImpl<Application> {
71 public: 71 public:
(...skipping 13 matching lines...) Expand all
85 void ConnectToService(const std::string& application_url, 85 void ConnectToService(const std::string& application_url,
86 InterfacePtr<Interface>* ptr) { 86 InterfacePtr<Interface>* ptr) {
87 ConnectToApplication(application_url)->ConnectToService(ptr); 87 ConnectToApplication(application_url)->ConnectToService(ptr);
88 } 88 }
89 89
90 private: 90 private:
91 friend MojoResult (::MojoMain)(MojoHandle); 91 friend MojoResult (::MojoMain)(MojoHandle);
92 92
93 void BindShell(ScopedMessagePipeHandle shell_handle); 93 void BindShell(ScopedMessagePipeHandle shell_handle);
94 void BindShell(MojoHandle shell_handle); 94 void BindShell(MojoHandle shell_handle);
95 void ClearConnections();
96
97 // Quits the main run loop for this application.
98 void TerminateImpl();
95 99
96 // Application implementation. 100 // Application implementation.
97 virtual void AcceptConnection(const String& requestor_url, 101 virtual void AcceptConnection(const String& requestor_url,
98 ServiceProviderPtr provider) MOJO_OVERRIDE; 102 ServiceProviderPtr provider) MOJO_OVERRIDE;
103 virtual void Terminate() MOJO_OVERRIDE;
99 104
100 typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList; 105 typedef std::vector<internal::ServiceRegistry*> ServiceRegistryList;
101 ServiceRegistryList incoming_service_registries_; 106 ServiceRegistryList incoming_service_registries_;
102 ServiceRegistryList outgoing_service_registries_; 107 ServiceRegistryList outgoing_service_registries_;
103 ApplicationDelegate* delegate_; 108 ApplicationDelegate* delegate_;
104 ShellPtr shell_; 109 ShellPtr shell_;
105 110
106 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); 111 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
107 }; 112 };
108 113
109 } // namespace mojo 114 } // namespace mojo
110 115
111 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_ 116 #endif // MOJO_PUBLIC_APPLICATION_APPLICATION_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698