OLD | NEW |
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 // For linux_syscall_support.h. This makes it safe to call embedded system | 5 // For linux_syscall_support.h. This makes it safe to call embedded system |
6 // calls when in seccomp mode. | 6 // calls when in seccomp mode. |
7 | 7 |
8 #include "components/crash/app/breakpad_linux.h" | 8 #include "components/crash/app/breakpad_linux.h" |
9 | 9 |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 } | 392 } |
393 | 393 |
394 #if defined(OS_CHROMEOS) | 394 #if defined(OS_CHROMEOS) |
395 // This subclass is used on Chromium OS to report crashes in a format easy for | 395 // This subclass is used on Chromium OS to report crashes in a format easy for |
396 // the central crash reporting facility to understand. | 396 // the central crash reporting facility to understand. |
397 // Format is <name>:<data length in decimal>:<data> | 397 // Format is <name>:<data length in decimal>:<data> |
398 class CrashReporterWriter : public MimeWriter { | 398 class CrashReporterWriter : public MimeWriter { |
399 public: | 399 public: |
400 explicit CrashReporterWriter(int fd); | 400 explicit CrashReporterWriter(int fd); |
401 | 401 |
402 virtual void AddBoundary() OVERRIDE; | 402 virtual void AddBoundary() override; |
403 | 403 |
404 virtual void AddEnd() OVERRIDE; | 404 virtual void AddEnd() override; |
405 | 405 |
406 virtual void AddPairData(const char* msg_type, | 406 virtual void AddPairData(const char* msg_type, |
407 size_t msg_type_size, | 407 size_t msg_type_size, |
408 const char* msg_data, | 408 const char* msg_data, |
409 size_t msg_data_size) OVERRIDE; | 409 size_t msg_data_size) override; |
410 | 410 |
411 virtual void AddPairDataInChunks(const char* msg_type, | 411 virtual void AddPairDataInChunks(const char* msg_type, |
412 size_t msg_type_size, | 412 size_t msg_type_size, |
413 const char* msg_data, | 413 const char* msg_data, |
414 size_t msg_data_size, | 414 size_t msg_data_size, |
415 size_t chunk_size, | 415 size_t chunk_size, |
416 bool strip_trailing_spaces) OVERRIDE; | 416 bool strip_trailing_spaces) override; |
417 | 417 |
418 virtual void AddFileContents(const char* filename_msg, | 418 virtual void AddFileContents(const char* filename_msg, |
419 uint8_t* file_data, | 419 uint8_t* file_data, |
420 size_t file_size) OVERRIDE; | 420 size_t file_size) override; |
421 | 421 |
422 private: | 422 private: |
423 DISALLOW_COPY_AND_ASSIGN(CrashReporterWriter); | 423 DISALLOW_COPY_AND_ASSIGN(CrashReporterWriter); |
424 }; | 424 }; |
425 | 425 |
426 | 426 |
427 CrashReporterWriter::CrashReporterWriter(int fd) : MimeWriter(fd, "") {} | 427 CrashReporterWriter::CrashReporterWriter(int fd) : MimeWriter(fd, "") {} |
428 | 428 |
429 // No-ops. | 429 // No-ops. |
430 void CrashReporterWriter::AddBoundary() {} | 430 void CrashReporterWriter::AddBoundary() {} |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 class NonBrowserCrashHandler : public google_breakpad::CrashGenerationClient { | 753 class NonBrowserCrashHandler : public google_breakpad::CrashGenerationClient { |
754 public: | 754 public: |
755 NonBrowserCrashHandler() | 755 NonBrowserCrashHandler() |
756 : server_fd_(base::GlobalDescriptors::GetInstance()->Get( | 756 : server_fd_(base::GlobalDescriptors::GetInstance()->Get( |
757 kCrashDumpSignal)) { | 757 kCrashDumpSignal)) { |
758 } | 758 } |
759 | 759 |
760 virtual ~NonBrowserCrashHandler() {} | 760 virtual ~NonBrowserCrashHandler() {} |
761 | 761 |
762 virtual bool RequestDump(const void* crash_context, | 762 virtual bool RequestDump(const void* crash_context, |
763 size_t crash_context_size) OVERRIDE { | 763 size_t crash_context_size) override { |
764 int fds[2] = { -1, -1 }; | 764 int fds[2] = { -1, -1 }; |
765 if (sys_socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { | 765 if (sys_socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { |
766 static const char msg[] = "Failed to create socket for crash dumping.\n"; | 766 static const char msg[] = "Failed to create socket for crash dumping.\n"; |
767 WriteLog(msg, sizeof(msg) - 1); | 767 WriteLog(msg, sizeof(msg) - 1); |
768 return false; | 768 return false; |
769 } | 769 } |
770 | 770 |
771 // Start constructing the message to send to the browser. | 771 // Start constructing the message to send to the browser. |
772 char b; // Dummy variable for sys_read below. | 772 char b; // Dummy variable for sys_read below. |
773 const char* b_addr = &b; // Get the address of |b| so we can create the | 773 const char* b_addr = &b; // Get the address of |b| so we can create the |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 } | 1614 } |
1615 } | 1615 } |
1616 } | 1616 } |
1617 #endif // OS_ANDROID | 1617 #endif // OS_ANDROID |
1618 | 1618 |
1619 bool IsCrashReporterEnabled() { | 1619 bool IsCrashReporterEnabled() { |
1620 return g_is_crash_reporter_enabled; | 1620 return g_is_crash_reporter_enabled; |
1621 } | 1621 } |
1622 | 1622 |
1623 } // namespace breakpad | 1623 } // namespace breakpad |
OLD | NEW |