Index: services/debugger/debugger.cc |
diff --git a/services/debugger/debugger.cc b/services/debugger/debugger.cc |
index 5d1f63038df94226aa76b10851818f167814ca2b..5654cdb2cf7434034bfad9d8e11f63f035a721e7 100644 |
--- a/services/debugger/debugger.cc |
+++ b/services/debugger/debugger.cc |
@@ -39,7 +39,6 @@ class Debugger : public mojo::ApplicationDelegate, |
// mojo::ApplicationDelegate: |
void Initialize(mojo::ApplicationImpl* app) override { |
app_ = app; |
- app->ConnectToService("mojo:window_manager", &window_manager_); |
// Format: --args-for="app_url command_port" |
if (app->args().size() < 2) { |
@@ -47,6 +46,11 @@ class Debugger : public mojo::ApplicationDelegate, |
mojo::ApplicationImpl::Terminate(); |
return; |
} |
+ if (app->args().size() == 3 && app->args()[2] == "--wm") { |
+ // Connect to window manager only if requested, as the user might want to |
+ // run the debugger without spawning one. |
+ app_->ConnectToService("mojo:window_manager", &window_manager_); |
+ } |
base::StringToUint(app->args()[1], &command_port_); |
http_server::HttpServerFactoryPtr http_server_factory; |
app->ConnectToService("mojo:http_server", &http_server_factory); |
@@ -129,6 +133,9 @@ class Debugger : public mojo::ApplicationDelegate, |
} |
void Reload() { |
+ if (!window_manager_) |
+ return; |
+ |
// SimpleWindowManager will wire up necessary services on our behalf. |
window_manager_->Embed(url_, nullptr, nullptr); |
} |