| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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 10 matching lines...) Expand all Loading... |
| 21 #include "base/rand_util.h" | 21 #include "base/rand_util.h" |
| 22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "minidump/minidump_file_writer.h" | 24 #include "minidump/minidump_file_writer.h" |
| 25 #include "snapshot/crashpad_info_client_options.h" | 25 #include "snapshot/crashpad_info_client_options.h" |
| 26 #include "snapshot/win/process_snapshot_win.h" | 26 #include "snapshot/win/process_snapshot_win.h" |
| 27 #include "util/file/file_writer.h" | 27 #include "util/file/file_writer.h" |
| 28 #include "util/misc/tri_state.h" | 28 #include "util/misc/tri_state.h" |
| 29 #include "util/misc/uuid.h" | 29 #include "util/misc/uuid.h" |
| 30 #include "util/win/get_function.h" | 30 #include "util/win/get_function.h" |
| 31 #include "util/win/handle.h" |
| 31 #include "util/win/registration_protocol_win.h" | 32 #include "util/win/registration_protocol_win.h" |
| 32 #include "util/win/xp_compat.h" | 33 #include "util/win/xp_compat.h" |
| 33 | 34 |
| 34 namespace crashpad { | 35 namespace crashpad { |
| 35 | 36 |
| 36 namespace { | 37 namespace { |
| 37 | 38 |
| 38 // We create two pipe instances, so that there's one listening while the | 39 // We create two pipe instances, so that there's one listening while the |
| 39 // PipeServiceProc is processing a registration. | 40 // PipeServiceProc is processing a registration. |
| 40 const size_t kPipeInstances = 2; | 41 const size_t kPipeInstances = 2; |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 message.registration.critical_section_address, | 483 message.registration.critical_section_address, |
| 483 &OnCrashDumpEvent, | 484 &OnCrashDumpEvent, |
| 484 &OnNonCrashDumpEvent, | 485 &OnNonCrashDumpEvent, |
| 485 &OnProcessEnd); | 486 &OnProcessEnd); |
| 486 service_context.clients()->insert(client); | 487 service_context.clients()->insert(client); |
| 487 } | 488 } |
| 488 | 489 |
| 489 // Duplicate the events back to the client so they can request a dump. | 490 // Duplicate the events back to the client so they can request a dump. |
| 490 ServerToClientMessage response; | 491 ServerToClientMessage response; |
| 491 response.registration.request_crash_dump_event = | 492 response.registration.request_crash_dump_event = |
| 492 base::checked_cast<uint32_t>(reinterpret_cast<uintptr_t>(DuplicateEvent( | 493 HandleToInt(DuplicateEvent( |
| 493 client->process(), client->crash_dump_requested_event()))); | 494 client->process(), client->crash_dump_requested_event())); |
| 494 response.registration.request_non_crash_dump_event = | 495 response.registration.request_non_crash_dump_event = |
| 495 base::checked_cast<uint32_t>(reinterpret_cast<uintptr_t>(DuplicateEvent( | 496 HandleToInt(DuplicateEvent( |
| 496 client->process(), client->non_crash_dump_requested_event()))); | 497 client->process(), client->non_crash_dump_requested_event())); |
| 497 response.registration.non_crash_dump_completed_event = | 498 response.registration.non_crash_dump_completed_event = |
| 498 base::checked_cast<uint32_t>(reinterpret_cast<uintptr_t>(DuplicateEvent( | 499 HandleToInt(DuplicateEvent( |
| 499 client->process(), client->non_crash_dump_completed_event()))); | 500 client->process(), client->non_crash_dump_completed_event())); |
| 500 | 501 |
| 501 if (!LoggingWriteFile(service_context.pipe(), &response, sizeof(response))) | 502 if (!LoggingWriteFile(service_context.pipe(), &response, sizeof(response))) |
| 502 return false; | 503 return false; |
| 503 | 504 |
| 504 return false; | 505 return false; |
| 505 } | 506 } |
| 506 | 507 |
| 507 // static | 508 // static |
| 508 DWORD __stdcall ExceptionHandlerServer::PipeServiceProc(void* ctx) { | 509 DWORD __stdcall ExceptionHandlerServer::PipeServiceProc(void* ctx) { |
| 509 internal::PipeServiceContext* service_context = | 510 internal::PipeServiceContext* service_context = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 void __stdcall ExceptionHandlerServer::OnProcessEnd(void* ctx, BOOLEAN) { | 561 void __stdcall ExceptionHandlerServer::OnProcessEnd(void* ctx, BOOLEAN) { |
| 561 // This function is executed on the thread pool. | 562 // This function is executed on the thread pool. |
| 562 internal::ClientData* client = reinterpret_cast<internal::ClientData*>(ctx); | 563 internal::ClientData* client = reinterpret_cast<internal::ClientData*>(ctx); |
| 563 base::AutoLock lock(*client->lock()); | 564 base::AutoLock lock(*client->lock()); |
| 564 | 565 |
| 565 // Post back to the main thread to have it delete this client record. | 566 // Post back to the main thread to have it delete this client record. |
| 566 PostQueuedCompletionStatus(client->port(), 0, ULONG_PTR(client), nullptr); | 567 PostQueuedCompletionStatus(client->port(), 0, ULONG_PTR(client), nullptr); |
| 567 } | 568 } |
| 568 | 569 |
| 569 } // namespace crashpad | 570 } // namespace crashpad |
| OLD | NEW |