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

Side by Side Diff: base/command_line.cc

Issue 115773: Prototype implementation of zygotes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « base/command_line.h ('k') | base/file_descriptor_shuffle.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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/command_line.h" 5 #include "base/command_line.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif 10 #endif
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void CommandLine::Init(int argc, const char* const* argv) { 171 void CommandLine::Init(int argc, const char* const* argv) {
172 DCHECK(current_process_commandline_ == NULL); 172 DCHECK(current_process_commandline_ == NULL);
173 #if defined(OS_WIN) 173 #if defined(OS_WIN)
174 current_process_commandline_ = new CommandLine; 174 current_process_commandline_ = new CommandLine;
175 current_process_commandline_->ParseFromString(::GetCommandLineW()); 175 current_process_commandline_->ParseFromString(::GetCommandLineW());
176 #elif defined(OS_POSIX) 176 #elif defined(OS_POSIX)
177 current_process_commandline_ = new CommandLine(argc, argv); 177 current_process_commandline_ = new CommandLine(argc, argv);
178 #endif 178 #endif
179 } 179 }
180 180
181 // static
182 void CommandLine::Init(const std::vector<std::string>& argv) {
183 DCHECK(current_process_commandline_ == NULL);
184 #if defined(OS_WIN)
185 current_process_commandline_ = new CommandLine;
186 current_process_commandline_->ParseFromString(::GetCommandLineW());
187 #elif defined(OS_POSIX)
188 current_process_commandline_ = new CommandLine(argv);
189 #endif
190 }
191
181 void CommandLine::Terminate() { 192 void CommandLine::Terminate() {
182 DCHECK(current_process_commandline_ != NULL); 193 DCHECK(current_process_commandline_ != NULL);
183 delete current_process_commandline_; 194 delete current_process_commandline_;
184 current_process_commandline_ = NULL; 195 current_process_commandline_ = NULL;
185 } 196 }
186 197
187 bool CommandLine::HasSwitch(const std::wstring& switch_string) const { 198 bool CommandLine::HasSwitch(const std::wstring& switch_string) const {
188 std::wstring lowercased_switch(switch_string); 199 std::wstring lowercased_switch(switch_string);
189 #if defined(OS_WIN) 200 #if defined(OS_WIN)
190 Lowercase(&lowercased_switch); 201 Lowercase(&lowercased_switch);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { 364 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) {
354 // The wrapper may have embedded arguments (like "gdb --args"). In this case, 365 // The wrapper may have embedded arguments (like "gdb --args"). In this case,
355 // we don't pretend to do anything fancy, we just split on spaces. 366 // we don't pretend to do anything fancy, we just split on spaces.
356 const std::string wrapper = WideToASCII(wrapper_wide); 367 const std::string wrapper = WideToASCII(wrapper_wide);
357 std::vector<std::string> wrapper_and_args; 368 std::vector<std::string> wrapper_and_args;
358 SplitString(wrapper, ' ', &wrapper_and_args); 369 SplitString(wrapper, ' ', &wrapper_and_args);
359 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); 370 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end());
360 } 371 }
361 372
362 #endif 373 #endif
OLDNEW
« no previous file with comments | « base/command_line.h ('k') | base/file_descriptor_shuffle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698