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

Side by Side Diff: mojo/runner/child_process.cc

Issue 1140553002: Make --wait-for-debugger work for mandoline launcher process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « mojo/runner/android/main.cc ('k') | mojo/runner/child_process_host.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 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 #include "mojo/runner/child_process.h" 5 #include "mojo/runner/child_process.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/debugger.h"
12 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
13 #include "base/location.h" 12 #include "base/location.h"
14 #include "base/logging.h" 13 #include "base/logging.h"
15 #include "base/macros.h" 14 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
18 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
19 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
20 #include "base/synchronization/waitable_event.h" 19 #include "base/synchronization/waitable_event.h"
21 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 273
275 DISALLOW_COPY_AND_ASSIGN(ChildControllerImpl); 274 DISALLOW_COPY_AND_ASSIGN(ChildControllerImpl);
276 }; 275 };
277 276
278 } // namespace 277 } // namespace
279 278
280 int ChildProcessMain() { 279 int ChildProcessMain() {
281 DVLOG(2) << "ChildProcessMain()"; 280 DVLOG(2) << "ChildProcessMain()";
282 const base::CommandLine& command_line = 281 const base::CommandLine& command_line =
283 *base::CommandLine::ForCurrentProcess(); 282 *base::CommandLine::ForCurrentProcess();
284 if (command_line.HasSwitch(switches::kWaitForDebugger)) {
285 std::string app = command_line.GetSwitchValueASCII(switches::kApp);
286 #if defined(OS_WIN)
287 MessageBox(NULL, command_line.GetSwitchValueNative(switches::kApp).c_str(),
288 command_line.GetSwitchValueNative(switches::kApp).c_str(),
289 MB_OK | MB_SETFOREGROUND);
290 #else
291 LOG(ERROR) << command_line.GetSwitchValueASCII(switches::kApp)
292 << " waiting for GDB. pid: " << getpid();
293 base::debug::WaitForDebugger(60, true);
294 #endif
295 }
296
297 embedder::ScopedPlatformHandle platform_channel = 283 embedder::ScopedPlatformHandle platform_channel =
298 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( 284 embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
299 command_line); 285 command_line);
300 CHECK(platform_channel.is_valid()); 286 CHECK(platform_channel.is_valid());
301 287
302 DCHECK(!base::MessageLoop::current()); 288 DCHECK(!base::MessageLoop::current());
303 289
304 AppContext app_context; 290 AppContext app_context;
305 app_context.Init(); 291 app_context.Init();
306 292
307 Blocker blocker; 293 Blocker blocker;
308 app_context.controller_runner()->PostTask( 294 app_context.controller_runner()->PostTask(
309 FROM_HERE, 295 FROM_HERE,
310 base::Bind(&ChildControllerImpl::Init, base::Unretained(&app_context), 296 base::Bind(&ChildControllerImpl::Init, base::Unretained(&app_context),
311 base::Passed(&platform_channel), blocker.GetUnblocker())); 297 base::Passed(&platform_channel), blocker.GetUnblocker()));
312 // This will block, then run whatever the controller wants. 298 // This will block, then run whatever the controller wants.
313 blocker.Block(); 299 blocker.Block();
314 300
315 app_context.Shutdown(); 301 app_context.Shutdown();
316 302
317 return 0; 303 return 0;
318 } 304 }
319 305
320 } // namespace runner 306 } // namespace runner
321 } // namespace mojo 307 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/android/main.cc ('k') | mojo/runner/child_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698