| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 //! \param[in] exception_information_address The address in the client's | 50 //! \param[in] exception_information_address The address in the client's |
| 51 //! address space of an ExceptionInformation structure. | 51 //! address space of an ExceptionInformation structure. |
| 52 //! \return The exit code that should be used when terminating the client | 52 //! \return The exit code that should be used when terminating the client |
| 53 //! process. | 53 //! process. |
| 54 virtual unsigned int ExceptionHandlerServerException( | 54 virtual unsigned int ExceptionHandlerServerException( |
| 55 HANDLE process, | 55 HANDLE process, |
| 56 WinVMAddress exception_information_address) = 0; | 56 WinVMAddress exception_information_address) = 0; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 //! \brief Constructs the exception handling server. | 59 //! \brief Constructs the exception handling server. |
| 60 //! | 60 ExceptionHandlerServer(); |
| 61 //! \param[in] delegate The interface to which the exceptions are delegated | |
| 62 //! when they are caught in Run(). Ownership is not transferred and it | |
| 63 //! must outlive this object. | |
| 64 explicit ExceptionHandlerServer(Delegate* delegate); | |
| 65 ~ExceptionHandlerServer(); | 61 ~ExceptionHandlerServer(); |
| 66 | 62 |
| 67 //! \brief Runs the exception-handling server. | 63 //! \brief Runs the exception-handling server. |
| 68 //! | 64 //! |
| 65 //! \param[in] delegate The interface to which the exceptions are delegated |
| 66 //! when they are caught in Run(). Ownership is not transferred. |
| 69 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the | 67 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the |
| 70 //! form "\\.\pipe\<some_name>". | 68 //! form "\\.\pipe\<some_name>". |
| 71 void Run(const std::string& pipe_name); | 69 void Run(Delegate* delegate, const std::string& pipe_name); |
| 72 | 70 |
| 73 //! \brief Stops the exception-handling server. Returns immediately. The | 71 //! \brief Stops the exception-handling server. Returns immediately. The |
| 74 //! object must not be destroyed until Run() returns. | 72 //! object must not be destroyed until Run() returns. |
| 75 void Stop(); | 73 void Stop(); |
| 76 | 74 |
| 77 private: | 75 private: |
| 78 static bool ServiceClientConnection( | 76 static bool ServiceClientConnection( |
| 79 const internal::PipeServiceContext& service_context); | 77 const internal::PipeServiceContext& service_context); |
| 80 static DWORD __stdcall PipeServiceProc(void* ctx); | 78 static DWORD __stdcall PipeServiceProc(void* ctx); |
| 81 static void __stdcall OnDumpEvent(void* ctx, BOOLEAN); | 79 static void __stdcall OnDumpEvent(void* ctx, BOOLEAN); |
| 82 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN); | 80 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN); |
| 83 | 81 |
| 84 Delegate* delegate_; // Weak. | |
| 85 ScopedKernelHANDLE port_; | 82 ScopedKernelHANDLE port_; |
| 86 | 83 |
| 87 base::Lock clients_lock_; | 84 base::Lock clients_lock_; |
| 88 std::set<internal::ClientData*> clients_; | 85 std::set<internal::ClientData*> clients_; |
| 89 | 86 |
| 90 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer); | 87 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer); |
| 91 }; | 88 }; |
| 92 | 89 |
| 93 } // namespace crashpad | 90 } // namespace crashpad |
| 94 | 91 |
| 95 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ | 92 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ |
| OLD | NEW |