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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 //! `.DebugInfo` field, or `0` if unavailable. | 54 //! `.DebugInfo` field, or `0` if unavailable. |
55 //! \return The exit code that should be used when terminating the client | 55 //! \return The exit code that should be used when terminating the client |
56 //! process. | 56 //! process. |
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 ExceptionHandlerServer(); |
65 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the | |
66 //! form "\\.\pipe\<some_name>". | |
67 explicit ExceptionHandlerServer(const std::string& pipe_name); | |
68 | |
69 ~ExceptionHandlerServer(); | 65 ~ExceptionHandlerServer(); |
70 | 66 |
71 //! \brief Runs the exception-handling server. | 67 //! \brief Runs the exception-handling server. |
72 //! | 68 //! |
73 //! \param[in] delegate The interface to which the exceptions are delegated | 69 //! \param[in] delegate The interface to which the exceptions are delegated |
74 //! when they are caught in Run(). Ownership is not transferred. | 70 //! when they are caught in Run(). Ownership is not transferred. |
75 void Run(Delegate* delegate); | 71 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the |
| 72 //! form "\\.\pipe\<some_name>". |
| 73 void Run(Delegate* delegate, const std::string& pipe_name); |
76 | 74 |
77 //! \brief Stops the exception-handling server. Returns immediately. The | 75 //! \brief Stops the exception-handling server. Returns immediately. The |
78 //! object must not be destroyed until Run() returns. | 76 //! object must not be destroyed until Run() returns. |
79 void Stop(); | 77 void Stop(); |
80 | 78 |
81 private: | 79 private: |
82 static bool ServiceClientConnection( | 80 static bool ServiceClientConnection( |
83 const internal::PipeServiceContext& service_context); | 81 const internal::PipeServiceContext& service_context); |
84 static DWORD __stdcall PipeServiceProc(void* ctx); | 82 static DWORD __stdcall PipeServiceProc(void* ctx); |
85 static void __stdcall OnCrashDumpEvent(void* ctx, BOOLEAN); | 83 static void __stdcall OnCrashDumpEvent(void* ctx, BOOLEAN); |
86 static void __stdcall OnNonCrashDumpEvent(void* ctx, BOOLEAN); | 84 static void __stdcall OnNonCrashDumpEvent(void* ctx, BOOLEAN); |
87 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN); | 85 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN); |
88 | 86 |
89 std::string pipe_name_; | |
90 ScopedKernelHANDLE port_; | 87 ScopedKernelHANDLE port_; |
91 | 88 |
92 base::Lock clients_lock_; | 89 base::Lock clients_lock_; |
93 std::set<internal::ClientData*> clients_; | 90 std::set<internal::ClientData*> clients_; |
94 | 91 |
95 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer); | 92 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer); |
96 }; | 93 }; |
97 | 94 |
98 } // namespace crashpad | 95 } // namespace crashpad |
99 | 96 |
100 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ | 97 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ |
OLD | NEW |