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

Side by Side Diff: handler/handler_main.cc

Issue 1505423002: win: Set shutdown order to make the handler shutdown as late as possible (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: plog Created 5 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // Set up a SIGTERM handler that will call exception_handler_server.Stop(). 330 // Set up a SIGTERM handler that will call exception_handler_server.Stop().
331 struct sigaction sa = {}; 331 struct sigaction sa = {};
332 sigemptyset(&sa.sa_mask); 332 sigemptyset(&sa.sa_mask);
333 sa.sa_flags = SA_SIGINFO; 333 sa.sa_flags = SA_SIGINFO;
334 sa.sa_sigaction = HandleSIGTERM; 334 sa.sa_sigaction = HandleSIGTERM;
335 int rv = sigaction(SIGTERM, &sa, &old_sa); 335 int rv = sigaction(SIGTERM, &sa, &old_sa);
336 PCHECK(rv == 0) << "sigaction"; 336 PCHECK(rv == 0) << "sigaction";
337 reset_sigterm.reset(&old_sa); 337 reset_sigterm.reset(&old_sa);
338 } 338 }
339 #elif defined(OS_WIN) 339 #elif defined(OS_WIN)
340 // Shut down as late as possible relative to programs we're watching.
341 if (!SetProcessShutdownParameters(0x100, SHUTDOWN_NORETRY))
342 PLOG(ERROR) << "SetProcessShutdownParameters";
343
340 ExceptionHandlerServer exception_handler_server(!options.pipe_name.empty()); 344 ExceptionHandlerServer exception_handler_server(!options.pipe_name.empty());
341 345
342 if (!options.pipe_name.empty()) { 346 if (!options.pipe_name.empty()) {
343 exception_handler_server.SetPipeName(base::UTF8ToUTF16(options.pipe_name)); 347 exception_handler_server.SetPipeName(base::UTF8ToUTF16(options.pipe_name));
344 } else if (options.handshake_handle != INVALID_HANDLE_VALUE) { 348 } else if (options.handshake_handle != INVALID_HANDLE_VALUE) {
345 std::wstring pipe_name = exception_handler_server.CreatePipe(); 349 std::wstring pipe_name = exception_handler_server.CreatePipe();
346 350
347 uint32_t pipe_name_length = static_cast<uint32_t>(pipe_name.size()); 351 uint32_t pipe_name_length = static_cast<uint32_t>(pipe_name.size());
348 if (!LoggingWriteFile(options.handshake_handle, 352 if (!LoggingWriteFile(options.handshake_handle,
349 &pipe_name_length, 353 &pipe_name_length,
(...skipping 22 matching lines...) Expand all
372 database.get(), &upload_thread, &options.annotations); 376 database.get(), &upload_thread, &options.annotations);
373 377
374 exception_handler_server.Run(&exception_handler); 378 exception_handler_server.Run(&exception_handler);
375 379
376 upload_thread.Stop(); 380 upload_thread.Stop();
377 381
378 return EXIT_SUCCESS; 382 return EXIT_SUCCESS;
379 } 383 }
380 384
381 } // namespace crashpad 385 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698