| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/common/child_process_logging.h" | 5 #include "chrome/common/child_process_logging.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 gpu_info.vertex_shader_version.c_str(), | 101 gpu_info.vertex_shader_version.c_str(), |
| 102 kGpuStringSize - 1); | 102 kGpuStringSize - 1); |
| 103 g_gpu_vs_ver[kGpuStringSize - 1] = '\0'; | 103 g_gpu_vs_ver[kGpuStringSize - 1] = '\0'; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SetNumberOfViews(int number_of_views) { | 106 void SetNumberOfViews(int number_of_views) { |
| 107 snprintf(g_num_views, kNumSize - 1, "%d", number_of_views); | 107 snprintf(g_num_views, kNumSize - 1, "%d", number_of_views); |
| 108 g_num_views[kNumSize - 1] = '\0'; | 108 g_num_views[kNumSize - 1] = '\0'; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void SetCrashOnExit(bool crash_on_exit) { |
| 112 // TODO(eroman): Implement. See http://crbug.com/118665 |
| 113 } |
| 114 |
| 111 void SetCommandLine(const CommandLine* command_line) { | 115 void SetCommandLine(const CommandLine* command_line) { |
| 112 const CommandLine::StringVector& argv = command_line->argv(); | 116 const CommandLine::StringVector& argv = command_line->argv(); |
| 113 | 117 |
| 114 snprintf(g_num_switches, kNumSize - 1, "%" PRIuS, argv.size() - 1); | 118 snprintf(g_num_switches, kNumSize - 1, "%" PRIuS, argv.size() - 1); |
| 115 g_num_switches[kNumSize - 1] = '\0'; | 119 g_num_switches[kNumSize - 1] = '\0'; |
| 116 | 120 |
| 117 std::string command_line_str; | 121 std::string command_line_str; |
| 118 for (size_t argv_i = 1; | 122 for (size_t argv_i = 1; |
| 119 argv_i < argv.size() && argv_i <= kMaxSwitches; | 123 argv_i < argv.size() && argv_i <= kMaxSwitches; |
| 120 ++argv_i) { | 124 ++argv_i) { |
| 121 command_line_str += argv[argv_i]; | 125 command_line_str += argv[argv_i]; |
| 122 // Truncate long switches, align short ones with spaces to be trimmed later. | 126 // Truncate long switches, align short ones with spaces to be trimmed later. |
| 123 command_line_str.resize(argv_i * kSwitchLen, ' '); | 127 command_line_str.resize(argv_i * kSwitchLen, ' '); |
| 124 } | 128 } |
| 125 strncpy(g_switches, command_line_str.c_str(), kMaxSwitchesSize - 1); | 129 strncpy(g_switches, command_line_str.c_str(), kMaxSwitchesSize - 1); |
| 126 g_switches[kMaxSwitchesSize - 1] = '\0'; | 130 g_switches[kMaxSwitchesSize - 1] = '\0'; |
| 127 } | 131 } |
| 128 | 132 |
| 129 void SetChannel(const std::string& channel) { | 133 void SetChannel(const std::string& channel) { |
| 130 strncpy(g_channel, channel.c_str(), kChannelSize - 1); | 134 strncpy(g_channel, channel.c_str(), kChannelSize - 1); |
| 131 g_channel[kChannelSize - 1] = '\0'; | 135 g_channel[kChannelSize - 1] = '\0'; |
| 132 } | 136 } |
| 133 | 137 |
| 134 } // namespace child_process_logging | 138 } // namespace child_process_logging |
| OLD | NEW |