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

Side by Side Diff: chrome/app/breakpad_linux.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/zygote_manager_unittest.cc ('k') | chrome/app/chrome_dll_main.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <fcntl.h> 5 #include <fcntl.h>
6 #include <sys/socket.h> 6 #include <sys/socket.h>
7 #include <sys/uio.h> 7 #include <sys/uio.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/eintr_wrapper.h" 13 #include "base/eintr_wrapper.h"
14 #include "base/file_version_info_linux.h" 14 #include "base/file_version_info_linux.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/rand_util.h" 16 #include "base/rand_util.h"
17 #include "base/reserved_file_descriptors.h"
17 #include "breakpad/linux/directory_reader.h" 18 #include "breakpad/linux/directory_reader.h"
18 #include "breakpad/linux/exception_handler.h" 19 #include "breakpad/linux/exception_handler.h"
19 #include "breakpad/linux/linux_libc_support.h" 20 #include "breakpad/linux/linux_libc_support.h"
20 #include "breakpad/linux/linux_syscall_support.h" 21 #include "breakpad/linux/linux_syscall_support.h"
21 #include "breakpad/linux/memory.h" 22 #include "breakpad/linux/memory.h"
22 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
23 #include "chrome/installer/util/google_update_settings.h" 24 #include "chrome/installer/util/google_update_settings.h"
24 25
25 static const char kUploadURL[] = 26 static const char kUploadURL[] =
26 "https://clients2.google.com/cr/report"; 27 "https://clients2.google.com/cr/report";
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 sys_close(fds[1]); 495 sys_close(fds[1]);
495 496
496 char b; 497 char b;
497 HANDLE_EINTR(sys_read(fds[0], &b, 1)); 498 HANDLE_EINTR(sys_read(fds[0], &b, 1));
498 499
499 return true; 500 return true;
500 } 501 }
501 502
502 void EnableRendererCrashDumping() { 503 void EnableRendererCrashDumping() {
503 // When the browser forks off our process, it installs the crash signal file 504 // When the browser forks off our process, it installs the crash signal file
504 // descriptor in this slot: 505 // descriptor in slot kMagicCrashSignalFd.
505 static const int kMagicCrashSignalFd = 4;
506 506
507 // We deliberately leak this object. 507 // We deliberately leak this object.
508 google_breakpad::ExceptionHandler* handler = 508 google_breakpad::ExceptionHandler* handler =
509 new google_breakpad::ExceptionHandler("" /* unused */, NULL, NULL, 509 new google_breakpad::ExceptionHandler("" /* unused */, NULL, NULL,
510 (void*) kMagicCrashSignalFd, true); 510 (void*) kMagicCrashSignalFd, true);
511 handler->set_crash_handler(RendererCrashHandler); 511 handler->set_crash_handler(RendererCrashHandler);
512 } 512 }
513 513
514 void InitCrashReporter() { 514 void InitCrashReporter() {
515 if (!GoogleUpdateSettings::GetCollectStatsConsent()) 515 if (!GoogleUpdateSettings::GetCollectStatsConsent())
516 return; 516 return;
517 517
518 // Determine the process type and take appropriate action. 518 // Determine the process type and take appropriate action.
519 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 519 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
520 const std::wstring process_type = 520 const std::wstring process_type =
521 parsed_command_line.GetSwitchValue(switches::kProcessType); 521 parsed_command_line.GetSwitchValue(switches::kProcessType);
522 if (process_type.empty()) 522 if (process_type.empty())
523 EnableCrashDumping(); 523 EnableCrashDumping();
524 else if (process_type == switches::kRendererProcess) 524 else if (process_type == switches::kRendererProcess)
525 EnableRendererCrashDumping(); 525 EnableRendererCrashDumping();
526 } 526 }
OLDNEW
« no previous file with comments | « base/zygote_manager_unittest.cc ('k') | chrome/app/chrome_dll_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698