| 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, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #include <getopt.h> | 15 #include <getopt.h> |
| 16 #include <stdlib.h> | 16 #include <stdlib.h> |
| 17 | 17 |
| 18 #include <map> | 18 #include <map> |
| 19 #include <string> | 19 #include <string> |
| 20 | 20 |
| 21 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
| 24 #include "base/strings/utf_string_conversions.h" | |
| 25 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 26 #include "client/crash_report_database.h" | 25 #include "client/crash_report_database.h" |
| 27 #include "client/crashpad_client.h" | 26 #include "client/crashpad_client.h" |
| 28 #include "tools/tool_support.h" | 27 #include "tools/tool_support.h" |
| 29 #include "handler/crash_report_upload_thread.h" | 28 #include "handler/crash_report_upload_thread.h" |
| 30 #include "util/stdlib/map_insert.h" | 29 #include "util/stdlib/map_insert.h" |
| 31 #include "util/stdlib/string_number_conversion.h" | 30 #include "util/stdlib/string_number_conversion.h" |
| 32 #include "util/string/split_string.h" | 31 #include "util/string/split_string.h" |
| 33 #include "util/synchronization/semaphore.h" | 32 #include "util/synchronization/semaphore.h" |
| 34 | 33 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 217 |
| 219 ExceptionHandlerServer exception_handler_server; | 218 ExceptionHandlerServer exception_handler_server; |
| 220 | 219 |
| 221 #if defined(OS_MACOSX) | 220 #if defined(OS_MACOSX) |
| 222 CloseStdinAndStdout(); | 221 CloseStdinAndStdout(); |
| 223 ChildPortHandshake::RunClient(options.handshake_fd, | 222 ChildPortHandshake::RunClient(options.handshake_fd, |
| 224 exception_handler_server.receive_port(), | 223 exception_handler_server.receive_port(), |
| 225 MACH_MSG_TYPE_MAKE_SEND); | 224 MACH_MSG_TYPE_MAKE_SEND); |
| 226 #endif // OS_MACOSX | 225 #endif // OS_MACOSX |
| 227 | 226 |
| 228 scoped_ptr<CrashReportDatabase> database( | 227 scoped_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize( |
| 229 CrashReportDatabase::Initialize(base::FilePath( | 228 base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType( |
| 230 #if defined(OS_MACOSX) | 229 options.database)))); |
| 231 options.database | |
| 232 #elif defined(OS_WIN) | |
| 233 base::UTF8ToUTF16(options.database) | |
| 234 #endif | |
| 235 ))); | |
| 236 if (!database) { | 230 if (!database) { |
| 237 return EXIT_FAILURE; | 231 return EXIT_FAILURE; |
| 238 } | 232 } |
| 239 | 233 |
| 240 CrashReportUploadThread upload_thread(database.get(), options.url); | 234 CrashReportUploadThread upload_thread(database.get(), options.url); |
| 241 upload_thread.Start(); | 235 upload_thread.Start(); |
| 242 | 236 |
| 243 CrashReportExceptionHandler exception_handler( | 237 CrashReportExceptionHandler exception_handler( |
| 244 database.get(), &upload_thread, &options.annotations); | 238 database.get(), &upload_thread, &options.annotations); |
| 245 | 239 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 259 | 253 |
| 260 #if defined(OS_MACOSX) | 254 #if defined(OS_MACOSX) |
| 261 int main(int argc, char* argv[]) { | 255 int main(int argc, char* argv[]) { |
| 262 return crashpad::HandlerMain(argc, argv); | 256 return crashpad::HandlerMain(argc, argv); |
| 263 } | 257 } |
| 264 #elif defined(OS_WIN) | 258 #elif defined(OS_WIN) |
| 265 int wmain(int argc, wchar_t* argv[]) { | 259 int wmain(int argc, wchar_t* argv[]) { |
| 266 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); | 260 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); |
| 267 } | 261 } |
| 268 #endif // OS_MACOSX | 262 #endif // OS_MACOSX |
| OLD | NEW |