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

Side by Side Diff: chrome/app/breakpad_win.cc

Issue 10422019: Rename some chrome.exe exports: SetCommandLine --> SetCommandLine2, SetExperimentList --> SetExperi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments on why the new name Created 8 years, 7 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 | « chrome/app/breakpad_field_trial_win.cc ('k') | chrome/common/child_process_logging_win.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) 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/app/breakpad_win.h" 5 #include "chrome/app/breakpad_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <tchar.h> 9 #include <tchar.h>
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 // These surround the flags that were added by about:flags, it lets 145 // These surround the flags that were added by about:flags, it lets
146 // you distinguish which flags were added manually via the command 146 // you distinguish which flags were added manually via the command
147 // line versus those added through about:flags. For the most part 147 // line versus those added through about:flags. For the most part
148 // we don't care how an option was enabled, so we strip these. 148 // we don't care how an option was enabled, so we strip these.
149 // (If you need to know can always look at the PEB). 149 // (If you need to know can always look at the PEB).
150 flag == L"--flag-switches-begin" || 150 flag == L"--flag-switches-begin" ||
151 flag == L"--flag-switches-end"; 151 flag == L"--flag-switches-end";
152 } 152 }
153 153
154 extern "C" void __declspec(dllexport) __cdecl SetCommandLine( 154 // Note that this is suffixed with "2" due to a parameter change that was made
155 // to the predecessor "SetCommandLine()". If the signature changes again, use
156 // a new name.
157 extern "C" void __declspec(dllexport) __cdecl SetCommandLine2(
155 const wchar_t** argv, size_t argc) { 158 const wchar_t** argv, size_t argc) {
156 if (!g_custom_entries) 159 if (!g_custom_entries)
157 return; 160 return;
158 161
159 // Copy up to the kMaxSwitches arguments into the custom entries array. Skip 162 // Copy up to the kMaxSwitches arguments into the custom entries array. Skip
160 // past the first argument, as it is just the executable path. 163 // past the first argument, as it is just the executable path.
161 size_t argv_i = 1; 164 size_t argv_i = 1;
162 size_t num_added = 0; 165 size_t num_added = 0;
163 166
164 for (; argv_i < argc && num_added < kMaxSwitches; ++argv_i) { 167 for (; argv_i < argc && num_added < kMaxSwitches; ++argv_i) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Read the id from registry. If reporting has never been enabled 298 // Read the id from registry. If reporting has never been enabled
296 // the result will be empty string. Its OK since when user enables reporting 299 // the result will be empty string. Its OK since when user enables reporting
297 // we will insert the new value at this location. 300 // we will insert the new value at this location.
298 std::wstring guid; 301 std::wstring guid;
299 GoogleUpdateSettings::GetMetricsId(&guid); 302 GoogleUpdateSettings::GetMetricsId(&guid);
300 g_client_id_offset = g_custom_entries->size(); 303 g_client_id_offset = g_custom_entries->size();
301 g_custom_entries->push_back( 304 g_custom_entries->push_back(
302 google_breakpad::CustomInfoEntry(L"guid", guid.c_str())); 305 google_breakpad::CustomInfoEntry(L"guid", guid.c_str()));
303 306
304 // Add empty values for the command line switches. We will fill them with 307 // Add empty values for the command line switches. We will fill them with
305 // actual values as part of SetCommandLine(). 308 // actual values as part of SetCommandLine2().
306 g_num_switches_offset = g_custom_entries->size(); 309 g_num_switches_offset = g_custom_entries->size();
307 g_custom_entries->push_back( 310 g_custom_entries->push_back(
308 google_breakpad::CustomInfoEntry(L"num-switches", L"")); 311 google_breakpad::CustomInfoEntry(L"num-switches", L""));
309 312
310 g_switches_offset = g_custom_entries->size(); 313 g_switches_offset = g_custom_entries->size();
311 // one-based index for the name suffix. 314 // one-based index for the name suffix.
312 for (int i = 1; i <= kMaxSwitches; ++i) { 315 for (int i = 1; i <= kMaxSwitches; ++i) {
313 g_custom_entries->push_back(google_breakpad::CustomInfoEntry( 316 g_custom_entries->push_back(google_breakpad::CustomInfoEntry(
314 base::StringPrintf(L"switch-%i", i).c_str(), L"")); 317 base::StringPrintf(L"switch-%i", i).c_str(), L""));
315 } 318 }
316 319
317 // Fill in the command line arguments using CommandLine::ForCurrentProcess(). 320 // Fill in the command line arguments using CommandLine::ForCurrentProcess().
318 // The browser process may call SetCommandLine() again later on with a command 321 // The browser process may call SetCommandLine2() again later on with a
319 // line that has been augmented with the about:flags experiments. 322 // command line that has been augmented with the about:flags experiments.
320 std::vector<const wchar_t*> switches; 323 std::vector<const wchar_t*> switches;
321 StringVectorToCStringVector( 324 StringVectorToCStringVector(
322 CommandLine::ForCurrentProcess()->argv(), &switches); 325 CommandLine::ForCurrentProcess()->argv(), &switches);
323 SetCommandLine(&switches[0], switches.size()); 326 SetCommandLine2(&switches[0], switches.size());
324 327
325 if (type == L"renderer" || type == L"plugin" || type == L"gpu-process") { 328 if (type == L"renderer" || type == L"plugin" || type == L"gpu-process") {
326 g_num_of_views_offset = g_custom_entries->size(); 329 g_num_of_views_offset = g_custom_entries->size();
327 g_custom_entries->push_back( 330 g_custom_entries->push_back(
328 google_breakpad::CustomInfoEntry(L"num-views", L"")); 331 google_breakpad::CustomInfoEntry(L"num-views", L""));
329 // Create entries for the URL. Currently we only allow each chunk to be 64 332 // Create entries for the URL. Currently we only allow each chunk to be 64
330 // characters, which isn't enough for a URL. As a hack we create 8 entries 333 // characters, which isn't enough for a URL. As a hack we create 8 entries
331 // and split the URL across the g_custom_entries. 334 // and split the URL across the g_custom_entries.
332 g_url_chunks_offset = g_custom_entries->size(); 335 g_url_chunks_offset = g_custom_entries->size();
333 // one-based index for the name suffix. 336 // one-based index for the name suffix.
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) { 827 void InitDefaultCrashCallback(LPTOP_LEVEL_EXCEPTION_FILTER filter) {
825 previous_filter = SetUnhandledExceptionFilter(filter); 828 previous_filter = SetUnhandledExceptionFilter(filter);
826 } 829 }
827 830
828 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, 831 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings,
829 std::vector<const wchar_t*>* cstrings) { 832 std::vector<const wchar_t*>* cstrings) {
830 cstrings->clear(); 833 cstrings->clear();
831 cstrings->reserve(wstrings.size()); 834 cstrings->reserve(wstrings.size());
832 for (size_t i = 0; i < wstrings.size(); ++i) 835 for (size_t i = 0; i < wstrings.size(); ++i)
833 cstrings->push_back(wstrings[i].c_str()); 836 cstrings->push_back(wstrings[i].c_str());
834 } 837 }
OLDNEW
« no previous file with comments | « chrome/app/breakpad_field_trial_win.cc ('k') | chrome/common/child_process_logging_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698