| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 ToolSupport::UsageHint(me, nullptr); | 209 ToolSupport::UsageHint(me, nullptr); |
| 210 return EXIT_FAILURE; | 210 return EXIT_FAILURE; |
| 211 } | 211 } |
| 212 | 212 |
| 213 #if defined(OS_MACOSX) | 213 #if defined(OS_MACOSX) |
| 214 if (options.reset_own_crash_exception_port_to_system_default) { | 214 if (options.reset_own_crash_exception_port_to_system_default) { |
| 215 CrashpadClient::UseSystemDefaultHandler(); | 215 CrashpadClient::UseSystemDefaultHandler(); |
| 216 } | 216 } |
| 217 #endif | 217 #endif |
| 218 | 218 |
| 219 #if defined(OS_MACOSX) |
| 219 ExceptionHandlerServer exception_handler_server; | 220 ExceptionHandlerServer exception_handler_server; |
| 220 | 221 |
| 221 #if defined(OS_MACOSX) | |
| 222 CloseStdinAndStdout(); | 222 CloseStdinAndStdout(); |
| 223 if (!ChildPortHandshake::RunClientForFD( | 223 if (!ChildPortHandshake::RunClientForFD( |
| 224 base::ScopedFD(options.handshake_fd), | 224 base::ScopedFD(options.handshake_fd), |
| 225 exception_handler_server.receive_port(), | 225 exception_handler_server.receive_port(), |
| 226 MACH_MSG_TYPE_MAKE_SEND)) { | 226 MACH_MSG_TYPE_MAKE_SEND)) { |
| 227 return EXIT_FAILURE; | 227 return EXIT_FAILURE; |
| 228 } | 228 } |
| 229 #elif defined(OS_WIN) |
| 230 ExceptionHandlerServer exception_handler_server(options.pipe_name); |
| 229 #endif // OS_MACOSX | 231 #endif // OS_MACOSX |
| 230 | 232 |
| 231 scoped_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize( | 233 scoped_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize( |
| 232 base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType( | 234 base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType( |
| 233 options.database)))); | 235 options.database)))); |
| 234 if (!database) { | 236 if (!database) { |
| 235 return EXIT_FAILURE; | 237 return EXIT_FAILURE; |
| 236 } | 238 } |
| 237 | 239 |
| 238 CrashReportUploadThread upload_thread(database.get(), options.url); | 240 CrashReportUploadThread upload_thread(database.get(), options.url); |
| 239 upload_thread.Start(); | 241 upload_thread.Start(); |
| 240 | 242 |
| 241 CrashReportExceptionHandler exception_handler( | 243 CrashReportExceptionHandler exception_handler( |
| 242 database.get(), &upload_thread, &options.annotations); | 244 database.get(), &upload_thread, &options.annotations); |
| 243 | 245 |
| 244 #if defined(OS_MACOSX) | |
| 245 exception_handler_server.Run(&exception_handler); | 246 exception_handler_server.Run(&exception_handler); |
| 246 #elif defined(OS_WIN) | |
| 247 exception_handler_server.Run(&exception_handler, options.pipe_name); | |
| 248 #endif // OS_MACOSX | |
| 249 | 247 |
| 250 upload_thread.Stop(); | 248 upload_thread.Stop(); |
| 251 | 249 |
| 252 return EXIT_SUCCESS; | 250 return EXIT_SUCCESS; |
| 253 } | 251 } |
| 254 | 252 |
| 255 } // namespace | 253 } // namespace |
| 256 } // namespace crashpad | 254 } // namespace crashpad |
| 257 | 255 |
| 258 #if defined(OS_MACOSX) | 256 #if defined(OS_MACOSX) |
| 259 int main(int argc, char* argv[]) { | 257 int main(int argc, char* argv[]) { |
| 260 return crashpad::HandlerMain(argc, argv); | 258 return crashpad::HandlerMain(argc, argv); |
| 261 } | 259 } |
| 262 #elif defined(OS_WIN) | 260 #elif defined(OS_WIN) |
| 263 int wmain(int argc, wchar_t* argv[]) { | 261 int wmain(int argc, wchar_t* argv[]) { |
| 264 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); | 262 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); |
| 265 } | 263 } |
| 266 #endif // OS_MACOSX | 264 #endif // OS_MACOSX |
| OLD | NEW |