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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 virtual unsigned int ExceptionHandlerServerException( | 57 virtual unsigned int ExceptionHandlerServerException( |
58 HANDLE process, | 58 HANDLE process, |
59 WinVMAddress exception_information_address, | 59 WinVMAddress exception_information_address, |
60 WinVMAddress debug_critical_section_address) = 0; | 60 WinVMAddress debug_critical_section_address) = 0; |
61 }; | 61 }; |
62 | 62 |
63 //! \brief Constructs the exception handling server. | 63 //! \brief Constructs the exception handling server. |
64 //! | 64 //! |
65 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the | 65 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the |
66 //! form "\\.\pipe\<some_name>". | 66 //! form "\\.\pipe\<some_name>". |
67 explicit ExceptionHandlerServer(const std::string& pipe_name); | 67 //! \param[in] persistent `true` if Run() should not return until Stop() is |
| 68 //! called. If `false`, Run() will return when all clients have exited, |
| 69 //! although Run() will always wait for the first client to connect. |
| 70 ExceptionHandlerServer(const std::string& pipe_name, bool persistent); |
68 | 71 |
69 ~ExceptionHandlerServer(); | 72 ~ExceptionHandlerServer(); |
70 | 73 |
71 //! \brief Runs the exception-handling server. | 74 //! \brief Runs the exception-handling server. |
72 //! | 75 //! |
73 //! \param[in] delegate The interface to which the exceptions are delegated | 76 //! \param[in] delegate The interface to which the exceptions are delegated |
74 //! when they are caught in Run(). Ownership is not transferred. | 77 //! when they are caught in Run(). Ownership is not transferred. |
75 void Run(Delegate* delegate); | 78 void Run(Delegate* delegate); |
76 | 79 |
77 //! \brief Stops the exception-handling server. Returns immediately. The | 80 //! \brief Stops the exception-handling server. Returns immediately. The |
78 //! object must not be destroyed until Run() returns. | 81 //! object must not be destroyed until Run() returns. |
79 void Stop(); | 82 void Stop(); |
80 | 83 |
81 private: | 84 private: |
82 static bool ServiceClientConnection( | 85 static bool ServiceClientConnection( |
83 const internal::PipeServiceContext& service_context); | 86 const internal::PipeServiceContext& service_context); |
84 static DWORD __stdcall PipeServiceProc(void* ctx); | 87 static DWORD __stdcall PipeServiceProc(void* ctx); |
85 static void __stdcall OnCrashDumpEvent(void* ctx, BOOLEAN); | 88 static void __stdcall OnCrashDumpEvent(void* ctx, BOOLEAN); |
86 static void __stdcall OnNonCrashDumpEvent(void* ctx, BOOLEAN); | 89 static void __stdcall OnNonCrashDumpEvent(void* ctx, BOOLEAN); |
87 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN); | 90 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN); |
88 | 91 |
89 std::string pipe_name_; | 92 std::string pipe_name_; |
90 ScopedKernelHANDLE port_; | 93 ScopedKernelHANDLE port_; |
91 | 94 |
92 base::Lock clients_lock_; | 95 base::Lock clients_lock_; |
93 std::set<internal::ClientData*> clients_; | 96 std::set<internal::ClientData*> clients_; |
94 | 97 |
| 98 bool persistent_; |
| 99 |
95 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer); | 100 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer); |
96 }; | 101 }; |
97 | 102 |
98 } // namespace crashpad | 103 } // namespace crashpad |
99 | 104 |
100 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ | 105 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ |
OLD | NEW |