Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: util/win/exception_handler_server.cc

Issue 1405323003: win: Add and use GET_FUNCTION() and GET_FUNCTION_REQUIRED() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/win/critical_section_with_debug_info.cc ('k') | util/win/get_function.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
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 "util/win/exception_handler_server.h" 15 #include "util/win/exception_handler_server.h"
16 16
17 #include <string.h> 17 #include <string.h>
18 18
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/numerics/safe_conversions.h" 20 #include "base/numerics/safe_conversions.h"
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/registration_protocol_win.h" 31 #include "util/win/registration_protocol_win.h"
31 #include "util/win/xp_compat.h" 32 #include "util/win/xp_compat.h"
32 33
33 namespace crashpad { 34 namespace crashpad {
34 35
35 namespace { 36 namespace {
36 37
37 decltype(GetNamedPipeClientProcessId)* GetNamedPipeClientProcessIdFunction() { 38 decltype(GetNamedPipeClientProcessId)* GetNamedPipeClientProcessIdFunction() {
38 static decltype(GetNamedPipeClientProcessId)* func = 39 static const auto get_named_pipe_client_process_id =
39 reinterpret_cast<decltype(GetNamedPipeClientProcessId)*>(GetProcAddress( 40 GET_FUNCTION(L"kernel32.dll", ::GetNamedPipeClientProcessId);
40 GetModuleHandle(L"kernel32.dll"), "GetNamedPipeClientProcessId")); 41 return get_named_pipe_client_process_id;
41 return func;
42 } 42 }
43 43
44 HANDLE DuplicateEvent(HANDLE process, HANDLE event) { 44 HANDLE DuplicateEvent(HANDLE process, HANDLE event) {
45 HANDLE handle; 45 HANDLE handle;
46 if (DuplicateHandle(GetCurrentProcess(), 46 if (DuplicateHandle(GetCurrentProcess(),
47 event, 47 event,
48 process, 48 process,
49 &handle, 49 &handle,
50 SYNCHRONIZE | EVENT_MODIFY_STATE, 50 SYNCHRONIZE | EVENT_MODIFY_STATE,
51 false, 51 false,
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 void __stdcall ExceptionHandlerServer::OnProcessEnd(void* ctx, BOOLEAN) { 499 void __stdcall ExceptionHandlerServer::OnProcessEnd(void* ctx, BOOLEAN) {
500 // This function is executed on the thread pool. 500 // This function is executed on the thread pool.
501 internal::ClientData* client = reinterpret_cast<internal::ClientData*>(ctx); 501 internal::ClientData* client = reinterpret_cast<internal::ClientData*>(ctx);
502 base::AutoLock lock(*client->lock()); 502 base::AutoLock lock(*client->lock());
503 503
504 // Post back to the main thread to have it delete this client record. 504 // Post back to the main thread to have it delete this client record.
505 PostQueuedCompletionStatus(client->port(), 0, ULONG_PTR(client), nullptr); 505 PostQueuedCompletionStatus(client->port(), 0, ULONG_PTR(client), nullptr);
506 } 506 }
507 507
508 } // namespace crashpad 508 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/win/critical_section_with_debug_info.cc ('k') | util/win/get_function.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698