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

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

Issue 637023002: Misc. cleanup, primarily removing unused locals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove macros.h change Created 6 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/devtools_ui.cc » ('j') | net/disk_cache/cache_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chrome_crash_reporter_client.h" 5 #include "chrome/app/chrome_crash_reporter_client.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 KEY_ALL_ACCESS) != ERROR_SUCCESS) { 209 KEY_ALL_ACCESS) != ERROR_SUCCESS) {
210 return; 210 return;
211 } 211 }
212 212
213 // We use the current process id and the current tick count as a (hopefully) 213 // We use the current process id and the current tick count as a (hopefully)
214 // unique combination for the crash dump value. There's a small chance that 214 // unique combination for the crash dump value. There's a small chance that
215 // across a reboot we might have a crash dump signal written, and the next 215 // across a reboot we might have a crash dump signal written, and the next
216 // browser process might have the same process id and tick count, but crash 216 // browser process might have the same process id and tick count, but crash
217 // before consuming the signal (overwriting the signal with an identical one). 217 // before consuming the signal (overwriting the signal with an identical one).
218 // For now, we're willing to live with that risk. 218 // For now, we're willing to live with that risk.
219 int length = base::strings::SafeSPrintf(g_browser_crash_dump_prefix, 219 if (base::strings::SafeSPrintf(g_browser_crash_dump_prefix,
220 kBrowserCrashDumpPrefixTemplate, 220 kBrowserCrashDumpPrefixTemplate,
221 chrome::kChromeVersion, 221 chrome::kChromeVersion,
222 ::GetCurrentProcessId(), 222 ::GetCurrentProcessId(),
223 ::GetTickCount()); 223 ::GetTickCount()) <= 0) {
224 if (length <= 0) {
225 NOTREACHED(); 224 NOTREACHED();
226 g_browser_crash_dump_prefix[0] = '\0'; 225 g_browser_crash_dump_prefix[0] = '\0';
227 return; 226 return;
228 } 227 }
229 228
230 // Hold the registry key in a global for update on crash dump. 229 // Hold the registry key in a global for update on crash dump.
231 g_browser_crash_dump_regkey = regkey.Take(); 230 g_browser_crash_dump_regkey = regkey.Take();
232 } 231 }
233 232
234 void ChromeCrashReporterClient::RecordCrashDumpAttempt(bool is_real_crash) { 233 void ChromeCrashReporterClient::RecordCrashDumpAttempt(bool is_real_crash) {
235 // If we're not a browser (or the registry is unavailable to us for some 234 // If we're not a browser (or the registry is unavailable to us for some
236 // reason) then there's nothing to do. 235 // reason) then there's nothing to do.
237 if (g_browser_crash_dump_regkey == NULL) 236 if (g_browser_crash_dump_regkey == NULL)
238 return; 237 return;
239 238
240 // Generate the final value name we'll use (appends the crash number to the 239 // Generate the final value name we'll use (appends the crash number to the
241 // base value name). 240 // base value name).
242 const size_t kMaxValueSize = 2 * kBrowserCrashDumpPrefixLength; 241 const size_t kMaxValueSize = 2 * kBrowserCrashDumpPrefixLength;
243 char value_name[kMaxValueSize + 1] = {}; 242 char value_name[kMaxValueSize + 1] = {};
244 int length = base::strings::SafeSPrintf( 243 if (base::strings::SafeSPrintf(
245 value_name, 244 value_name, "%s-%x", g_browser_crash_dump_prefix,
246 "%s-%x", 245 base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count,
247 g_browser_crash_dump_prefix, 246 1)) > 0) {
248 base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, 1));
249
250 if (length > 0) {
251 DWORD value_dword = is_real_crash ? 1 : 0; 247 DWORD value_dword = is_real_crash ? 1 : 0;
252 ::RegSetValueExA(g_browser_crash_dump_regkey, value_name, 0, REG_DWORD, 248 ::RegSetValueExA(g_browser_crash_dump_regkey, value_name, 0, REG_DWORD,
253 reinterpret_cast<BYTE*>(&value_dword), 249 reinterpret_cast<BYTE*>(&value_dword),
254 sizeof(value_dword)); 250 sizeof(value_dword));
255 } 251 }
256 } 252 }
257 253
258 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( 254 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy(
259 bool* breakpad_enabled) { 255 bool* breakpad_enabled) {
260 // Determine whether configuration management allows loading the crash reporter. 256 // Determine whether configuration management allows loading the crash reporter.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 bool ChromeCrashReporterClient::EnableBreakpadForProcess( 369 bool ChromeCrashReporterClient::EnableBreakpadForProcess(
374 const std::string& process_type) { 370 const std::string& process_type) {
375 return process_type == switches::kRendererProcess || 371 return process_type == switches::kRendererProcess ||
376 process_type == switches::kPluginProcess || 372 process_type == switches::kPluginProcess ||
377 process_type == switches::kPpapiPluginProcess || 373 process_type == switches::kPpapiPluginProcess ||
378 process_type == switches::kZygoteProcess || 374 process_type == switches::kZygoteProcess ||
379 process_type == switches::kGpuProcess; 375 process_type == switches::kGpuProcess;
380 } 376 }
381 377
382 } // namespace chrome 378 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/devtools_ui.cc » ('j') | net/disk_cache/cache_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698