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

Side by Side Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/nacl_host/nacl_process_host.h" 5 #include "chrome/browser/nacl_host/nacl_process_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 cmd_line->AppendArg("--args"); 398 cmd_line->AppendArg("--args");
399 const CommandLine::StringVector& argv = line->argv(); 399 const CommandLine::StringVector& argv = line->argv();
400 for (size_t i = 0; i < argv.size(); i++) { 400 for (size_t i = 0; i < argv.size(); i++) {
401 cmd_line->AppendArgNative(argv[i]); 401 cmd_line->AppendArgNative(argv[i]);
402 } 402 }
403 return scoped_ptr<CommandLine>(cmd_line); 403 return scoped_ptr<CommandLine>(cmd_line);
404 } 404 }
405 #elif defined(OS_LINUX) 405 #elif defined(OS_LINUX)
406 class NaClProcessHost::NaClGdbWatchDelegate 406 class NaClProcessHost::NaClGdbWatchDelegate
407 : public MessageLoopForIO::Watcher { 407 : public base::MessageLoopForIO::Watcher {
408 public: 408 public:
409 // fd_write_ is used by nacl-gdb via /proc/browser_PID/fd/fd_write_ 409 // fd_write_ is used by nacl-gdb via /proc/browser_PID/fd/fd_write_
410 NaClGdbWatchDelegate(int fd_read, int fd_write, 410 NaClGdbWatchDelegate(int fd_read, int fd_write,
411 const base::Closure& reply) 411 const base::Closure& reply)
412 : fd_read_(fd_read), 412 : fd_read_(fd_read),
413 fd_write_(fd_write), 413 fd_write_(fd_write),
414 reply_(reply) {} 414 reply_(reply) {}
415 415
416 virtual ~NaClGdbWatchDelegate() { 416 virtual ~NaClGdbWatchDelegate() {
417 if (HANDLE_EINTR(close(fd_read_)) != 0) 417 if (HANDLE_EINTR(close(fd_read_)) != 0)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 cmd_line.AppendArgNative(script.value()); 475 cmd_line.AppendArgNative(script.value());
476 } 476 }
477 // wait on fds[0] 477 // wait on fds[0]
478 // If the debugger crashes before attaching to the NaCl process, the user can 478 // If the debugger crashes before attaching to the NaCl process, the user can
479 // release resources by terminating the NaCl loader in Chrome Task Manager. 479 // release resources by terminating the NaCl loader in Chrome Task Manager.
480 nacl_gdb_watcher_delegate_.reset( 480 nacl_gdb_watcher_delegate_.reset(
481 new NaClGdbWatchDelegate( 481 new NaClGdbWatchDelegate(
482 fds[0], fds[1], 482 fds[0], fds[1],
483 base::Bind(&NaClProcessHost::OnNaClGdbAttached, 483 base::Bind(&NaClProcessHost::OnNaClGdbAttached,
484 weak_factory_.GetWeakPtr()))); 484 weak_factory_.GetWeakPtr())));
485 MessageLoopForIO::current()->WatchFileDescriptor( 485 base::MessageLoopForIO::current()->WatchFileDescriptor(
486 fds[0], 486 fds[0],
487 true, 487 true,
488 MessageLoopForIO::WATCH_READ, 488 base::MessageLoopForIO::WATCH_READ,
489 &nacl_gdb_watcher_, 489 &nacl_gdb_watcher_,
490 nacl_gdb_watcher_delegate_.get()); 490 nacl_gdb_watcher_delegate_.get());
491 return base::LaunchProcess(cmd_line, base::LaunchOptions(), NULL); 491 return base::LaunchProcess(cmd_line, base::LaunchOptions(), NULL);
492 } 492 }
493 493
494 void NaClProcessHost::OnNaClGdbAttached() { 494 void NaClProcessHost::OnNaClGdbAttached() {
495 wait_for_nacl_gdb_ = false; 495 wait_for_nacl_gdb_ = false;
496 nacl_gdb_watcher_.StopWatchingFileDescriptor(); 496 nacl_gdb_watcher_.StopWatchingFileDescriptor();
497 nacl_gdb_watcher_delegate_.reset(); 497 nacl_gdb_watcher_delegate_.reset();
498 OnProcessLaunched(); 498 OnProcessLaunched();
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 } else { 987 } else {
988 NaClStartDebugExceptionHandlerThread( 988 NaClStartDebugExceptionHandlerThread(
989 process_handle.Take(), info, 989 process_handle.Take(), info,
990 base::MessageLoopProxy::current(), 990 base::MessageLoopProxy::current(),
991 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 991 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
992 weak_factory_.GetWeakPtr())); 992 weak_factory_.GetWeakPtr()));
993 return true; 993 return true;
994 } 994 }
995 } 995 }
996 #endif 996 #endif
OLDNEW
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.h ('k') | chrome/browser/net/chrome_fraudulent_certificate_reporter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698