diff options
author | sky <sky@chromium.org> | 2016-02-19 15:17:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-19 23:18:47 +0000 |
commit | 730034908c8b53bdcb6faaeb50b234bb23825091 (patch) | |
tree | f805353138348a1f9a4f6ed459889b4ae6e5bf4a /mojo/shell/background | |
parent | c286900cc4499a48baab0d86dd96edbbe5fb1eff (diff) | |
download | chromium_src-730034908c8b53bdcb6faaeb50b234bb23825091.zip chromium_src-730034908c8b53bdcb6faaeb50b234bb23825091.tar.gz chromium_src-730034908c8b53bdcb6faaeb50b234bb23825091.tar.bz2 |
Adds back qualifier support to the shell
This also adds the ability to add command line switches to child
processes.
BUG=581539
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/1714183003
Cr-Commit-Position: refs/heads/master@{#376567}
Diffstat (limited to 'mojo/shell/background')
-rw-r--r-- | mojo/shell/background/background_shell.cc | 13 | ||||
-rw-r--r-- | mojo/shell/background/background_shell.h | 8 |
2 files changed, 17 insertions, 4 deletions
diff --git a/mojo/shell/background/background_shell.cc b/mojo/shell/background/background_shell.cc index 381fad5..50eef9c 100644 --- a/mojo/shell/background/background_shell.cc +++ b/mojo/shell/background/background_shell.cc @@ -72,7 +72,10 @@ class MojoMessageLoop : public base::MessageLoop { // Manages the thread to startup mojo. class BackgroundShell::MojoThread : public base::SimpleThread { public: - MojoThread() : SimpleThread("mojo-background-shell") {} + explicit MojoThread( + const std::vector<CommandLineSwitch>& command_line_switches) + : SimpleThread("mojo-background-shell"), + command_line_switches_(command_line_switches) {} ~MojoThread() override {} void CreateShellClientRequest(base::WaitableEvent* signal, @@ -123,6 +126,7 @@ class BackgroundShell::MojoThread : public base::SimpleThread { scoped_ptr<Context> context(new Context); context_ = context.get(); + context_->set_command_line_switches(command_line_switches_); context_->Init(shell_dir); message_loop_->Run(); @@ -152,6 +156,8 @@ class BackgroundShell::MojoThread : public base::SimpleThread { // Created in Run() on the background thread. Context* context_ = nullptr; + const std::vector<CommandLineSwitch> command_line_switches_; + DISALLOW_COPY_AND_ASSIGN(MojoThread); }; @@ -161,9 +167,10 @@ BackgroundShell::~BackgroundShell() { thread_->Stop(); } -void BackgroundShell::Init() { +void BackgroundShell::Init( + const std::vector<CommandLineSwitch>& command_line_switches) { DCHECK(!thread_); - thread_.reset(new MojoThread); + thread_.reset(new MojoThread(command_line_switches)); thread_->Start(); } diff --git a/mojo/shell/background/background_shell.h b/mojo/shell/background/background_shell.h index e2163f4..d1e9c41 100644 --- a/mojo/shell/background/background_shell.h +++ b/mojo/shell/background/background_shell.h @@ -5,6 +5,8 @@ #ifndef MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ #define MOJO_SHELL_BACKGROUND_BACKGROUND_SHELL_H_ +#include <vector> + #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "mojo/public/cpp/bindings/interface_request.h" @@ -15,6 +17,8 @@ class GURL; namespace mojo { namespace shell { +struct CommandLineSwitch; + // BackgroundShell starts up the mojo shell on a background thread, and // destroys the thread in the destructor. Once created use CreateApplication() // to obtain an InterfaceRequest for the Application. The InterfaceRequest can @@ -24,7 +28,9 @@ class BackgroundShell { BackgroundShell(); ~BackgroundShell(); - void Init(); + // Starts the background shell. |command_line_switches| are additional + // switches applied to any processes spawned by this call. + void Init(const std::vector<CommandLineSwitch>& command_line_switches); // Obtains an InterfaceRequest for the specified url. InterfaceRequest<mojom::ShellClient> CreateShellClientRequest( |