diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 01:00:22 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 01:00:22 +0000 |
commit | bb97536b768ac68fcbc4605c35461a798ef6e5ff (patch) | |
tree | 479bde96cd05a9e1f9d2746dd82313e2eb715e8e /net | |
parent | 8731a63268015f4e5d684833c11a1b44bd9ae468 (diff) | |
download | chromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.zip chromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.tar.gz chromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.tar.bz2 |
Make CommandLine into a normal object, with some statics for getting at the current process's command line.
One explicit goal of this change is to *not* deal with the string/wstring issues at the API on POSIX; the functions are the same as before, which means they remain as broken as before. (I did try to fix the internals, though, so migrating the callers is now possible by adding platform-appropriate hooks.)
Review URL: http://codereview.chromium.org/18248
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/disk_cache/stress_cache.cc | 10 | ||||
-rw-r--r-- | net/tools/crash_cache/crash_cache.cc | 10 | ||||
-rw-r--r-- | net/tools/tld_cleanup/tld_cleanup.cc | 4 | ||||
-rw-r--r-- | net/url_request/url_request_http_job.cc | 5 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.h | 4 |
5 files changed, 11 insertions, 22 deletions
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index 03fb4c1..8ad94e2 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -36,14 +36,8 @@ int RunSlave(int iteration) { std::wstring exe; PathService::Get(base::FILE_EXE, &exe); -#if defined(OS_WIN) - CommandLine cmdline(StringPrintf(L"%ls %d", exe.c_str(), iteration)); -#elif defined(OS_POSIX) - std::vector<std::string> cmd_argv; - cmd_argv.push_back(WideToUTF8(exe)); - cmd_argv.push_back(IntToString(iteration)); - CommandLine cmdline(cmd_argv); -#endif + CommandLine cmdline(exe); + cmdline.AppendLooseValue(ASCIIToWide(IntToString(iteration))); base::ProcessHandle handle; if (!base::LaunchApp(cmdline, false, false, &handle)) { diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index df641a2..9d6f3d6 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc @@ -40,14 +40,8 @@ int RunSlave(RankCrashes action) { std::wstring exe; PathService::Get(base::FILE_EXE, &exe); -#if defined(OS_WIN) - CommandLine cmdline(StringPrintf(L"%ls %d", exe.c_str(), action)); -#elif defined(OS_POSIX) - std::vector<std::string> cmd_argv; - cmd_argv.push_back(WideToUTF8(exe)); - cmd_argv.push_back(IntToString(action)); - CommandLine cmdline(cmd_argv); -#endif + CommandLine cmdline(exe); + cmdline.AppendLooseValue(ASCIIToWide(IntToString(action))); base::ProcessHandle handle; if (!base::LaunchApp(cmdline, false, false, &handle)) { diff --git a/net/tools/tld_cleanup/tld_cleanup.cc b/net/tools/tld_cleanup/tld_cleanup.cc index 797a669..792faad 100644 --- a/net/tools/tld_cleanup/tld_cleanup.cc +++ b/net/tools/tld_cleanup/tld_cleanup.cc @@ -208,9 +208,7 @@ int main(int argc, const char* argv[]) { logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG; #endif -#if defined(OS_LINUX) - CommandLine::SetArgcArgv(argc, argv); -#endif + CommandLine::Init(argc, argv); FilePath log_filename; PathService::Get(base::DIR_EXE, &log_filename); diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 2689064..7728f6c 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -42,7 +42,7 @@ URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, // We cache the value of the switch because this code path is hit on every // network request. static const bool kForceHTTPS = - CommandLine().HasSwitch(switches::kForceHTTPS); + CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceHTTPS); if (kForceHTTPS && scheme != "https") return new URLRequestErrorJob(request, net::ERR_DISALLOWED_URL_SCHEME); @@ -385,7 +385,8 @@ void URLRequestHttpJob::OnStartCompleted(int result) { if (result == net::OK) { NotifyHeadersComplete(); } else if (net::IsCertificateError(result) && - !CommandLine().HasSwitch(switches::kForceHTTPS)) { + !CommandLine::ForCurrentProcess()->HasSwitch( + switches::kForceHTTPS)) { // We encountered an SSL certificate error. Ask our delegate to decide // what we should do. // TODO(wtc): also pass ssl_info.cert_status, or just pass the whole diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h index c2158aa..58a0218 100644 --- a/net/url_request/url_request_unittest.h +++ b/net/url_request/url_request_unittest.h @@ -349,7 +349,9 @@ class BaseTestServer : public base::ProcessFilter, } #elif defined(OS_POSIX) void LaunchApp(const std::vector<std::string>& command_line) { - ASSERT_TRUE(base::LaunchApp(command_line, false, true, &process_handle_)) << + base::file_handle_mapping_vector fds_empty; + ASSERT_TRUE(base::LaunchApp(command_line, fds_empty, false, + &process_handle_)) << "Failed to launch " << command_line[0] << " ..."; } #endif |