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/browser/crash_handler_host_linux.h" | 5 #include "chrome/browser/crash_handler_host_linux.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 BrowserThread::IO, FROM_HERE, | 92 BrowserThread::IO, FROM_HERE, |
93 base::Bind(&CrashHandlerHostLinux::Init, base::Unretained(this))); | 93 base::Bind(&CrashHandlerHostLinux::Init, base::Unretained(this))); |
94 } | 94 } |
95 | 95 |
96 CrashHandlerHostLinux::~CrashHandlerHostLinux() { | 96 CrashHandlerHostLinux::~CrashHandlerHostLinux() { |
97 (void) HANDLE_EINTR(close(process_socket_)); | 97 (void) HANDLE_EINTR(close(process_socket_)); |
98 (void) HANDLE_EINTR(close(browser_socket_)); | 98 (void) HANDLE_EINTR(close(browser_socket_)); |
99 } | 99 } |
100 | 100 |
101 void CrashHandlerHostLinux::Init() { | 101 void CrashHandlerHostLinux::Init() { |
102 MessageLoopForIO* ml = MessageLoopForIO::current(); | 102 base::MessageLoopForIO* ml = base::MessageLoopForIO::current(); |
103 CHECK(ml->WatchFileDescriptor( | 103 CHECK(ml->WatchFileDescriptor(browser_socket_, |
104 browser_socket_, true /* persistent */, | 104 true /* persistent */, |
105 MessageLoopForIO::WATCH_READ, | 105 base::MessageLoopForIO::WATCH_READ, |
106 &file_descriptor_watcher_, this)); | 106 &file_descriptor_watcher_, |
| 107 this)); |
107 ml->AddDestructionObserver(this); | 108 ml->AddDestructionObserver(this); |
108 } | 109 } |
109 | 110 |
110 void CrashHandlerHostLinux::InitCrashUploaderThread() { | 111 void CrashHandlerHostLinux::InitCrashUploaderThread() { |
111 SetProcessType(); | 112 SetProcessType(); |
112 uploader_thread_.reset( | 113 uploader_thread_.reset( |
113 new base::Thread(std::string(process_type_ + "_crash_uploader").c_str())); | 114 new base::Thread(std::string(process_type_ + "_crash_uploader").c_str())); |
114 uploader_thread_->Start(); | 115 uploader_thread_->Start(); |
115 } | 116 } |
116 | 117 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 531 } |
531 | 532 |
532 void RendererCrashHandlerHostLinux::SetProcessType() { | 533 void RendererCrashHandlerHostLinux::SetProcessType() { |
533 process_type_ = "renderer"; | 534 process_type_ = "renderer"; |
534 } | 535 } |
535 | 536 |
536 // static | 537 // static |
537 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { | 538 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { |
538 return Singleton<RendererCrashHandlerHostLinux>::get(); | 539 return Singleton<RendererCrashHandlerHostLinux>::get(); |
539 } | 540 } |
OLD | NEW |