OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" |
| 7 #include "components/nacl/common/nacl_delegate.h" |
| 8 |
| 9 namespace nacl { |
| 10 |
| 11 void CopyNaClCommandLineArguments(CommandLine* cmd_line) { |
| 12 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 13 |
| 14 // Propagate the following switches to the NaCl loader command line (along |
| 15 // with any associated values) if present in the browser command line. |
| 16 // TODO(gregoryd): check which flags of those below can be supported. |
| 17 |
| 18 static const NaClDelegate::NaClSwitch kSwitchIds[] = { |
| 19 NaClDelegate::kNoSandbox, |
| 20 NaClDelegate::kTestNaClSandbox, |
| 21 NaClDelegate::kDisableBreakpad, |
| 22 NaClDelegate::kFullMemoryCrashReport, |
| 23 NaClDelegate::kEnableLogging, |
| 24 NaClDelegate::kDisableLogging, |
| 25 NaClDelegate::kLoggingLevel, |
| 26 NaClDelegate::kEnableDCHECK, |
| 27 NaClDelegate::kSilentDumpOnDCHECK, |
| 28 NaClDelegate::kMemoryProfiling, |
| 29 NaClDelegate::kNoErrorDialogs, |
| 30 #if defined(OS_MACOSX) |
| 31 NaClDelegate::kEnableSandboxLogging, |
| 32 #endif |
| 33 }; |
| 34 |
| 35 static const char** kSwitchNames = NULL; |
| 36 int listLength = sizeof(kSwitchIds) / sizeof(int); |
| 37 if (kSwitchNames == NULL) { |
| 38 kSwitchNames = new const char* [listLength]; |
| 39 for (int i = 0; i < listLength; i++) { |
| 40 kSwitchNames[i] = GetNaClDelegate()->GetSwitch(kSwitchIds[i]); |
| 41 } |
| 42 } |
| 43 |
| 44 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, listLength); |
| 45 } |
| 46 |
| 47 } // namespace nacl |
OLD | NEW |