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

Side by Side Diff: shell/context.cc

Issue 782013002: Android: decouple mojo shell from the network service. (Closed) Base URL: https://github.com/domokit/mojo.git@build-rule-for-the-network-service
Patch Set: Rebase. Created 6 years 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 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 "shell/context.h" 5 #include "shell/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 20 matching lines...) Expand all
31 #include "shell/in_process_dynamic_service_runner.h" 31 #include "shell/in_process_dynamic_service_runner.h"
32 #include "shell/out_of_process_dynamic_service_runner.h" 32 #include "shell/out_of_process_dynamic_service_runner.h"
33 #include "shell/switches.h" 33 #include "shell/switches.h"
34 #include "shell/ui_application_loader_android.h" 34 #include "shell/ui_application_loader_android.h"
35 #include "url/gurl.h" 35 #include "url/gurl.h"
36 36
37 #if defined(OS_ANDROID) 37 #if defined(OS_ANDROID)
38 #include "services/gles2/gpu_impl.h" 38 #include "services/gles2/gpu_impl.h"
39 #include "services/native_viewport/native_viewport_impl.h" 39 #include "services/native_viewport/native_viewport_impl.h"
40 #include "shell/android/android_handler_loader.h" 40 #include "shell/android/android_handler_loader.h"
41 #include "shell/network_application_loader.h"
42 #endif // defined(OS_ANDROID) 41 #endif // defined(OS_ANDROID)
43 42
44 namespace mojo { 43 namespace mojo {
45 namespace shell { 44 namespace shell {
46 namespace { 45 namespace {
47 46
48 // These mojo: URLs are loaded directly from the local filesystem. They 47 // These mojo: URLs are loaded directly from the local filesystem. They
49 // correspond to shared libraries bundled alongside the mojo_shell. 48 // correspond to shared libraries bundled alongside the mojo_shell.
50 const char* kLocalMojoURLs[] = { 49 const char* kLocalMojoURLs[] = {
51 "mojo:network_service", 50 "mojo:network_service",
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (command_line->HasSwitch(switches::kSpy)) { 244 if (command_line->HasSwitch(switches::kSpy)) {
246 spy_.reset( 245 spy_.reset(
247 new mojo::Spy(&application_manager_, 246 new mojo::Spy(&application_manager_,
248 command_line->GetSwitchValueASCII(switches::kSpy))); 247 command_line->GetSwitchValueASCII(switches::kSpy)));
249 // TODO(cpu): the spy can snoop, but can't tell anybody until 248 // TODO(cpu): the spy can snoop, but can't tell anybody until
250 // the Spy::WebSocketDelegate is implemented. In the original repo this 249 // the Spy::WebSocketDelegate is implemented. In the original repo this
251 // was implemented by src\mojo\spy\websocket_server.h and .cc. 250 // was implemented by src\mojo\spy\websocket_server.h and .cc.
252 } 251 }
253 252
254 #if defined(OS_ANDROID) 253 #if defined(OS_ANDROID)
255 // On android, the network service is bundled with the shell because the
256 // network stack depends on the android runtime.
257 { 254 {
258 scoped_ptr<BackgroundShellApplicationLoader> loader( 255 // Android handler is bundled with the Mojo shell, because it uses the
259 new BackgroundShellApplicationLoader( 256 // MojoShell application as the JNI bridge to bootstrap execution of other
260 scoped_ptr<ApplicationLoader>(new NetworkApplicationLoader()), 257 // Android Mojo apps that need JNI.
261 "network_service", base::MessageLoop::TYPE_IO));
262 application_manager_.SetLoaderForURL(loader.Pass(),
263 GURL("mojo:network_service"));
264 }
265 {
266 scoped_ptr<BackgroundShellApplicationLoader> loader( 258 scoped_ptr<BackgroundShellApplicationLoader> loader(
267 new BackgroundShellApplicationLoader( 259 new BackgroundShellApplicationLoader(
268 scoped_ptr<ApplicationLoader>(new AndroidHandlerLoader()), 260 scoped_ptr<ApplicationLoader>(new AndroidHandlerLoader()),
269 "android_handler", base::MessageLoop::TYPE_DEFAULT)); 261 "android_handler", base::MessageLoop::TYPE_DEFAULT));
270 application_manager_.SetLoaderForURL(loader.Pass(), 262 application_manager_.SetLoaderForURL(loader.Pass(),
271 GURL("mojo:android_handler")); 263 GURL("mojo:android_handler"));
272 } 264 }
273 #endif 265 #endif
274 266
275 tracing::TraceDataCollectorPtr trace_data_collector_ptr; 267 tracing::TraceDataCollectorPtr trace_data_collector_ptr;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 ScopedMessagePipeHandle Context::ConnectToServiceByName( 299 ScopedMessagePipeHandle Context::ConnectToServiceByName(
308 const GURL& application_url, 300 const GURL& application_url,
309 const std::string& service_name) { 301 const std::string& service_name) {
310 app_urls_.insert(application_url); 302 app_urls_.insert(application_url);
311 return application_manager_.ConnectToServiceByName(application_url, 303 return application_manager_.ConnectToServiceByName(application_url,
312 service_name).Pass(); 304 service_name).Pass();
313 } 305 }
314 306
315 } // namespace shell 307 } // namespace shell
316 } // namespace mojo 308 } // namespace mojo
OLDNEW
« shell/BUILD.gn ('K') | « shell/android/mojo_main.cc ('k') | shell/mojo_url_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698