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