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

Side by Side Diff: mojo/shell/context.cc

Issue 394903005: mojo: terminate apps if the shell goes away (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable tests that touch nss for now 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
« no previous file with comments | « mojo/shell/context.h ('k') | mojo/shell/shell_test_base_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "mojo/shell/context.h" 5 #include "mojo/shell/context.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 scoped_ptr<ServiceLoader>(new NativeViewportServiceLoader()), 115 scoped_ptr<ServiceLoader>(new NativeViewportServiceLoader()),
116 this)), 116 this)),
117 GURL("mojo:mojo_native_viewport_service")); 117 GURL("mojo:mojo_native_viewport_service"));
118 #else 118 #else
119 { 119 {
120 scoped_ptr<BackgroundShellServiceLoader> loader( 120 scoped_ptr<BackgroundShellServiceLoader> loader(
121 new BackgroundShellServiceLoader( 121 new BackgroundShellServiceLoader(
122 scoped_ptr<ServiceLoader>(new NativeViewportServiceLoader()), 122 scoped_ptr<ServiceLoader>(new NativeViewportServiceLoader()),
123 "native_viewport", 123 "native_viewport",
124 base::MessageLoop::TYPE_UI)); 124 base::MessageLoop::TYPE_UI));
125 // TODO(tim): NativeViewportService doesn't quit itself yet.
126 loader->set_quit_on_shutdown();
127 service_manager_.SetLoaderForURL( 125 service_manager_.SetLoaderForURL(
128 loader.PassAs<ServiceLoader>(), 126 loader.PassAs<ServiceLoader>(),
129 GURL("mojo:mojo_native_viewport_service")); 127 GURL("mojo:mojo_native_viewport_service"));
130 } 128 }
131 #endif 129 #endif
132 #if defined(USE_AURA) 130 #if defined(USE_AURA)
133 // TODO(sky): need a better way to find this. It shouldn't be linked in. 131 // TODO(sky): need a better way to find this. It shouldn't be linked in.
134 service_manager_.SetLoaderForURL( 132 service_manager_.SetLoaderForURL(
135 scoped_ptr<ServiceLoader>(new ViewManagerLoader()), 133 scoped_ptr<ServiceLoader>(new ViewManagerLoader()),
136 GURL("mojo:mojo_view_manager")); 134 GURL("mojo:mojo_view_manager"));
(...skipping 12 matching lines...) Expand all
149 147
150 #if defined(OS_ANDROID) 148 #if defined(OS_ANDROID)
151 // On android, the network service is bundled with the shell because the 149 // On android, the network service is bundled with the shell because the
152 // network stack depends on the android runtime. 150 // network stack depends on the android runtime.
153 { 151 {
154 scoped_ptr<BackgroundShellServiceLoader> loader( 152 scoped_ptr<BackgroundShellServiceLoader> loader(
155 new BackgroundShellServiceLoader( 153 new BackgroundShellServiceLoader(
156 scoped_ptr<ServiceLoader>(new NetworkServiceLoader()), 154 scoped_ptr<ServiceLoader>(new NetworkServiceLoader()),
157 "network_service", 155 "network_service",
158 base::MessageLoop::TYPE_IO)); 156 base::MessageLoop::TYPE_IO));
159 // TODO(tim): NetworkService doesn't quit itself yet.
160 loader->set_quit_on_shutdown();
161 service_manager_.SetLoaderForURL(loader.PassAs<ServiceLoader>(), 157 service_manager_.SetLoaderForURL(loader.PassAs<ServiceLoader>(),
162 GURL("mojo:mojo_network_service")); 158 GURL("mojo:mojo_network_service"));
163 } 159 }
164 #endif 160 #endif
165 } 161 }
166 162
167 void Context::Shutdown() {
168 // mojo_view_manager uses native_viewport. Destroy mojo_view_manager first so
169 // that there aren't shutdown ordering issues. Once native viewport service is
170 // moved into its own process this can likely be nuked.
171 #if defined(USE_AURA)
172 service_manager_.SetLoaderForURL(
173 scoped_ptr<ServiceLoader>(),
174 GURL("mojo:mojo_view_manager"));
175 #endif
176 service_manager_.set_default_loader(scoped_ptr<ServiceLoader>());
177 service_manager_.TerminateShellConnections();
178 }
179
180 Context::~Context() { 163 Context::~Context() {
181 DCHECK(!base::MessageLoop::current()); 164 DCHECK(!base::MessageLoop::current());
182 Shutdown();
183 } 165 }
184 166
185 } // namespace shell 167 } // namespace shell
186 } // namespace mojo 168 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/context.h ('k') | mojo/shell/shell_test_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698