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

Side by Side Diff: handler/mac/exception_handler_server.h

Issue 1414533006: mac: Add a mode to crashpad_handler to run from launchd (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Rebase Created 5 years, 1 month 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 | « handler/crashpad_handler.ad ('k') | handler/mac/exception_handler_server.cc » ('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 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 14 matching lines...) Expand all
25 namespace crashpad { 25 namespace crashpad {
26 26
27 //! \brief Runs the main exception-handling server in Crashpad’s handler 27 //! \brief Runs the main exception-handling server in Crashpad’s handler
28 //! process. 28 //! process.
29 class ExceptionHandlerServer { 29 class ExceptionHandlerServer {
30 public: 30 public:
31 //! \brief Constructs an ExceptionHandlerServer object. 31 //! \brief Constructs an ExceptionHandlerServer object.
32 //! 32 //!
33 //! \param[in] receive_port The port that exception messages and no-senders 33 //! \param[in] receive_port The port that exception messages and no-senders
34 //! notifications will be received on. 34 //! notifications will be received on.
35 explicit ExceptionHandlerServer( 35 //! \param[in] launchd If `true`, the exception handler is being run from
36 base::mac::ScopedMachReceiveRight receive_port); 36 //! launchd. \a receive_port is not monitored for no-senders
37 //! notifications, and instead, the expected “quit” signal is receipt of
38 //! `SIGTERM`.
39 ExceptionHandlerServer(base::mac::ScopedMachReceiveRight receive_port,
40 bool launchd);
37 ~ExceptionHandlerServer(); 41 ~ExceptionHandlerServer();
38 42
39 //! \brief Runs the exception-handling server. 43 //! \brief Runs the exception-handling server.
40 //! 44 //!
41 //! \param[in] exception_interface An object to send exception messages to. 45 //! \param[in] exception_interface An object to send exception messages to.
42 //! 46 //!
43 //! This method monitors the receive port for exception messages and 47 //! This method monitors the receive port for exception messages and, if
44 //! no-senders notifications. It continues running until it has no more 48 //! not being run by launchd, no-senders notifications. It continues running
45 //! clients, indicated by the receipt of a no-senders notification. It is 49 //! until it has no more clients, indicated by the receipt of a no-senders
46 //! important to assure that a send right exists in a client (or has been 50 //! notification, or if being run by launchd, receipt of `SIGTERM`. When not
47 //! queued by `mach_msg()` to be sent to a client) prior to calling this 51 //! being run by launchd, it is important to assure that a send right exists
48 //! method, or it will detect that it is sender-less and return immediately. 52 //! in a client (or has been queued by `mach_msg()` to be sent to a client)
53 //! prior to calling this method, or it will detect that it is sender-less and
54 //! return immediately.
49 //! 55 //!
50 //! All exception messages will be passed to \a exception_interface. 56 //! All exception messages will be passed to \a exception_interface.
51 //! 57 //!
52 //! This method must only be called once on an ExceptionHandlerServer object. 58 //! This method must only be called once on an ExceptionHandlerServer object.
53 //! 59 //!
54 //! If an unexpected condition that prevents this method from functioning is 60 //! If an unexpected condition that prevents this method from functioning is
55 //! encountered, it will log a message and terminate execution. Receipt of an 61 //! encountered, it will log a message and terminate execution. Receipt of an
56 //! invalid message on the receive port will cause a message to be logged, but 62 //! invalid message on the receive port will cause a message to be logged, but
57 //! this method will continue running normally. 63 //! this method will continue running normally.
58 void Run(UniversalMachExcServer::Interface* exception_interface); 64 void Run(UniversalMachExcServer::Interface* exception_interface);
59 65
60 private: 66 private:
61 base::mac::ScopedMachReceiveRight receive_port_; 67 base::mac::ScopedMachReceiveRight receive_port_;
68 bool launchd_;
62 69
63 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer); 70 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer);
64 }; 71 };
65 72
66 } // namespace crashpad 73 } // namespace crashpad
67 74
68 #endif // CRASHPAD_HANDLER_MAC_EXCEPTION_HANDLER_SERVER_H_ 75 #endif // CRASHPAD_HANDLER_MAC_EXCEPTION_HANDLER_SERVER_H_
OLDNEW
« no previous file with comments | « handler/crashpad_handler.ad ('k') | handler/mac/exception_handler_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698