Commit 7cb2c679 authored by thestig@chromium.org's avatar thestig@chromium.org

Cleanup: Use base::CommandLine in mojo/

Review URL: https://codereview.chromium.org/292743017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272712 0039d316-1c4b-4281-b951-d872f2087c98
parent f95da62f
......@@ -33,7 +33,8 @@ void MultiprocessTestHelper::StartChild(const std::string& test_child_name) {
std::string test_child_main = test_child_name + "TestChildMain";
CommandLine command_line(base::GetMultiProcessTestChildBaseCommandLine());
base::CommandLine command_line(
base::GetMultiProcessTestChildBaseCommandLine());
embedder::HandlePassingInformation handle_passing_info;
platform_channel_pair_->PrepareToPassClientHandleToChildProcess(
&command_line, &handle_passing_info);
......@@ -72,10 +73,10 @@ bool MultiprocessTestHelper::WaitForChildTestShutdown() {
// static
void MultiprocessTestHelper::ChildSetup() {
CHECK(CommandLine::InitializedForCurrentProcess());
CHECK(base::CommandLine::InitializedForCurrentProcess());
client_platform_handle =
embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
*CommandLine::ForCurrentProcess());
*base::CommandLine::ForCurrentProcess());
}
// static
......
......@@ -60,7 +60,7 @@ PlatformChannelPair::PlatformChannelPair() {
// static
ScopedPlatformHandle PlatformChannelPair::PassClientHandleFromParentProcess(
const CommandLine& command_line) {
const base::CommandLine& command_line) {
std::string client_fd_string =
command_line.GetSwitchValueASCII(kMojoPlatformChannelHandleSwitch);
int client_fd = -1;
......@@ -75,7 +75,7 @@ ScopedPlatformHandle PlatformChannelPair::PassClientHandleFromParentProcess(
}
void PlatformChannelPair::PrepareToPassClientHandleToChildProcess(
CommandLine* command_line,
base::CommandLine* command_line,
base::FileHandleMappingVector* handle_passing_info) const {
DCHECK(command_line);
DCHECK(handle_passing_info);
......
......@@ -73,7 +73,7 @@ PlatformChannelPair::PlatformChannelPair() {
// static
ScopedPlatformHandle PlatformChannelPair::PassClientHandleFromParentProcess(
const CommandLine& command_line) {
const base::CommandLine& command_line) {
std::string client_handle_string =
command_line.GetSwitchValueASCII(kMojoPlatformChannelHandleSwitch);
......@@ -89,7 +89,7 @@ ScopedPlatformHandle PlatformChannelPair::PassClientHandleFromParentProcess(
}
void PlatformChannelPair::PrepareToPassClientHandleToChildProcess(
CommandLine* command_line,
base::CommandLine* command_line,
base::HandlesToInheritVector* handle_passing_info) const {
DCHECK(command_line);
DCHECK(handle_passing_info);
......
......@@ -177,7 +177,7 @@ class AuraDemo : public Application {
extern "C" AURA_DEMO_EXPORT MojoResult CDECL MojoMain(
MojoHandle shell_handle) {
CommandLine::Init(0, NULL);
base::CommandLine::Init(0, NULL);
base::AtExitManager at_exit;
base::MessageLoop loop;
mojo::GLES2Initializer gles2;
......
......@@ -267,7 +267,7 @@ class LauncherImpl : public InterfaceImpl<Launcher>,
extern "C" LAUNCHER_EXPORT MojoResult CDECL MojoMain(
MojoHandle shell_handle) {
CommandLine::Init(0, NULL);
base::CommandLine::Init(0, NULL);
base::AtExitManager at_exit;
base::i18n::InitializeICU();
......
......@@ -35,7 +35,7 @@ const char kServiceName[] = "org.chromium.EchoService";
int main(int argc, char** argv) {
base::AtExitManager exit_manager;
CommandLine::Init(argc, argv);
base::CommandLine::Init(argc, argv);
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
......
......@@ -21,7 +21,7 @@
extern "C" VIEW_MANAGER_EXPORT MojoResult CDECL MojoMain(
MojoHandle shell_handle) {
CommandLine::Init(0, NULL);
base::CommandLine::Init(0, NULL);
base::AtExitManager at_exit;
base::MessageLoop loop;
mojo::Application app(shell_handle);
......
......@@ -38,14 +38,14 @@ LazyInstance<scoped_ptr<shell::Context> > g_context =
LazyInstance<scoped_ptr<mojo::Environment> > g_env =
LAZY_INSTANCE_INITIALIZER;
} // namspace
} // namespace
static void Init(JNIEnv* env, jclass clazz, jobject context) {
base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context);
base::android::InitApplicationContext(env, scoped_context);
CommandLine::Init(0, 0);
base::CommandLine::Init(0, 0);
mojo::shell::InitializeLogging();
g_java_message_loop.Get().reset(new base::MessageLoopForUI);
......@@ -71,7 +71,7 @@ static void Start(JNIEnv* env, jclass clazz, jobject context, jstring jurl) {
std::vector<std::string> argv;
argv.push_back("mojo_shell");
argv.push_back(app_url);
CommandLine::ForCurrentProcess()->InitFromArgv(argv);
base::CommandLine::ForCurrentProcess()->InitFromArgv(argv);
}
g_env.Get().reset(new Environment);
......
......@@ -19,7 +19,8 @@ ChildProcess::~ChildProcess() {
}
// static
scoped_ptr<ChildProcess> ChildProcess::Create(const CommandLine& command_line) {
scoped_ptr<ChildProcess> ChildProcess::Create(
const base::CommandLine& command_line) {
if (!command_line.HasSwitch(switches::kChildProcessType))
return scoped_ptr<ChildProcess>();
......
......@@ -70,8 +70,9 @@ bool ChildProcessHost::DoLaunch() {
switches::kVModule,
};
const CommandLine* parent_command_line = CommandLine::ForCurrentProcess();
CommandLine child_command_line(parent_command_line->GetProgram());
const base::CommandLine* parent_command_line =
base::CommandLine::ForCurrentProcess();
base::CommandLine child_command_line(parent_command_line->GetProgram());
child_command_line.CopySwitchesFrom(*parent_command_line, kForwardSwitches,
arraysize(kForwardSwitches));
child_command_line.AppendSwitchASCII(
......
......@@ -83,7 +83,7 @@ Context::Context()
scoped_ptr<net::NetworkDelegate>(new NetworkDelegate()),
storage_.profile_path()) {
setup.Get();
CommandLine* cmdline = CommandLine::ForCurrentProcess();
base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
scoped_ptr<DynamicServiceRunnerFactory> runner_factory;
if (cmdline->HasSwitch(switches::kEnableMultiprocess))
runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory());
......
......@@ -38,11 +38,11 @@ class TestChildProcessHostDelegate
int main(int argc, char** argv) {
base::AtExitManager at_exit;
mojo::Environment env;
CommandLine::Init(argc, argv);
base::CommandLine::Init(argc, argv);
mojo::shell::InitializeLogging();
// TODO(vtl): Move this a proper test (and remove includes marked "remove").
if (CommandLine::ForCurrentProcess()->HasSwitch("run-test-child")) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch("run-test-child")) {
base::MessageLoop message_loop(
scoped_ptr<base::MessagePump>(new mojo::common::MessagePumpMojo()));
......@@ -61,7 +61,7 @@ int main(int argc, char** argv) {
// TODO(vtl): Unify parent and child process cases to the extent possible.
if (scoped_ptr<mojo::shell::ChildProcess> child_process =
mojo::shell::ChildProcess::Create(
*CommandLine::ForCurrentProcess())) {
*base::CommandLine::ForCurrentProcess())) {
child_process->Main();
} else {
gfx::GLSurface::InitializeOneOff();
......
......@@ -45,7 +45,7 @@ class DynamicServiceLoader::LoadContext : public mojo::shell::Loader::Delegate {
if (url.SchemeIs("mojo")) {
std::string origin =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kOrigin);
std::string lib = MakeSharedLibraryName(url.ExtractFileName());
url_to_load = GURL(origin + "/" + lib);
......
......@@ -77,7 +77,8 @@ scoped_ptr<Loader::Job> Loader::Load(const GURL& app_url, Delegate* delegate) {
#else
job->fetcher_->SaveResponseToTemporaryFile(file_runner_.get());
#endif
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableCache))
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableCache))
job->fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
job->fetcher_->Start();
return job.Pass();
......
......@@ -19,15 +19,16 @@ namespace shell {
void Run(Context* context) {
KeepAlive keep_alive(context);
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
CommandLine::StringVector args = command_line.GetArgs();
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
base::CommandLine::StringVector args = command_line.GetArgs();
if (args.empty()) {
LOG(ERROR) << "No app path specified.";
return;
}
for (CommandLine::StringVector::const_iterator it = args.begin();
for (base::CommandLine::StringVector::const_iterator it = args.begin();
it != args.end(); ++it) {
GURL url(*it);
if (url.scheme() == "mojo" && !command_line.HasSwitch(switches::kOrigin)) {
......
......@@ -51,7 +51,7 @@ class ShellTestHelper::TestShellClient : public ShellClient {
ShellTestHelper::ShellTestHelper()
: shell_thread_("shell_test_helper"),
state_(NULL) {
CommandLine::Init(0, NULL);
base::CommandLine::Init(0, NULL);
mojo::shell::InitializeLogging();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment