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

Unified Diff: chrome/app/mash/mash_runner.cc

Issue 2571603002: Makes wait-for-debugger=content_browser work for mash (Closed)
Patch Set: merge Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/mash/mash_runner.h ('k') | services/service_manager/runner/common/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/mash/mash_runner.cc
diff --git a/chrome/app/mash/mash_runner.cc b/chrome/app/mash/mash_runner.cc
index 68f7dace0ccd84f36d356f8f969b0f5e1213b26a..acd09ca52d763e878905b85e04ce9668141560f2 100644
--- a/chrome/app/mash/mash_runner.cc
+++ b/chrome/app/mash/mash_runner.cc
@@ -6,6 +6,7 @@
#include "base/at_exit.h"
#include "base/base_paths.h"
+#include "base/base_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/debugger.h"
@@ -16,6 +17,7 @@
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/process/launch.h"
+#include "base/process/process.h"
#include "base/run_loop.h"
#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/sequenced_worker_pool.h"
@@ -36,6 +38,7 @@
#include "services/service_manager/public/cpp/service_context.h"
#include "services/service_manager/public/cpp/standalone_service/standalone_service.h"
#include "services/service_manager/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/runner/common/client_util.h"
#include "services/service_manager/runner/common/switches.h"
#include "services/service_manager/runner/init.h"
#include "services/service_manager/standalone/context.h"
@@ -242,3 +245,23 @@ int MashMain() {
MashRunner mash_runner;
return mash_runner.Run();
}
+
+void WaitForMashDebuggerIfNecessary() {
+ if (!service_manager::ServiceManagerIsRemote())
+ return;
+
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
+ const std::string service_name =
+ command_line->GetSwitchValueASCII(switches::kProcessServiceName);
+ if (service_name !=
+ command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) {
+ return;
+ }
+
+ // Include the pid as logging may not have been initialized yet (the pid
+ // printed out by logging is wrong).
+ LOG(WARNING) << "waiting for debugger to attach for service " << service_name
+ << " pid=" << base::Process::Current().Pid();
+ base::debug::WaitForDebugger(120, true);
+}
« no previous file with comments | « chrome/app/mash/mash_runner.h ('k') | services/service_manager/runner/common/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698