OLD | NEW |
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 "chrome/browser/renderer_host/render_crash_handler_host_linux.h" | 5 #include "chrome/browser/renderer_host/render_crash_handler_host_linux.h" |
6 | 6 |
7 #include <dirent.h> | 7 #include <dirent.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // SOCK_SEQPACKET, this is prevented. | 167 // SOCK_SEQPACKET, this is prevented. |
168 CHECK(socketpair(AF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); | 168 CHECK(socketpair(AF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); |
169 static const int on = 1; | 169 static const int on = 1; |
170 | 170 |
171 // Enable passcred on the server end of the socket | 171 // Enable passcred on the server end of the socket |
172 CHECK(setsockopt(fds[1], SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) == 0); | 172 CHECK(setsockopt(fds[1], SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) == 0); |
173 | 173 |
174 renderer_socket_ = fds[0]; | 174 renderer_socket_ = fds[0]; |
175 browser_socket_ = fds[1]; | 175 browser_socket_ = fds[1]; |
176 | 176 |
177 MessageLoop* ml = ChromeThread::GetMessageLoop(ChromeThread::IO); | 177 ChromeThread::PostTask( |
178 ml->PostTask(FROM_HERE, NewRunnableMethod( | 178 ChromeThread::IO, FROM_HERE, |
179 this, &RenderCrashHandlerHostLinux::Init)); | 179 NewRunnableMethod(this, &RenderCrashHandlerHostLinux::Init)); |
180 } | 180 } |
181 | 181 |
182 RenderCrashHandlerHostLinux::~RenderCrashHandlerHostLinux() { | 182 RenderCrashHandlerHostLinux::~RenderCrashHandlerHostLinux() { |
183 HANDLE_EINTR(close(renderer_socket_)); | 183 HANDLE_EINTR(close(renderer_socket_)); |
184 HANDLE_EINTR(close(browser_socket_)); | 184 HANDLE_EINTR(close(browser_socket_)); |
185 } | 185 } |
186 | 186 |
187 void RenderCrashHandlerHostLinux::Init() { | 187 void RenderCrashHandlerHostLinux::Init() { |
188 MessageLoopForIO* ml = MessageLoopForIO::current(); | 188 MessageLoopForIO* ml = MessageLoopForIO::current(); |
189 CHECK(ml->WatchFileDescriptor( | 189 CHECK(ml->WatchFileDescriptor( |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 info.guid_length = strlen(guid); | 354 info.guid_length = strlen(guid); |
355 info.distro = distro; | 355 info.distro = distro; |
356 info.distro_length = strlen(distro); | 356 info.distro_length = strlen(distro); |
357 info.upload = upload; | 357 info.upload = upload; |
358 HandleCrashDump(info); | 358 HandleCrashDump(info); |
359 } | 359 } |
360 | 360 |
361 void RenderCrashHandlerHostLinux::WillDestroyCurrentMessageLoop() { | 361 void RenderCrashHandlerHostLinux::WillDestroyCurrentMessageLoop() { |
362 file_descriptor_watcher_.StopWatchingFileDescriptor(); | 362 file_descriptor_watcher_.StopWatchingFileDescriptor(); |
363 } | 363 } |
OLD | NEW |