OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (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 | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 #ifndef CRASHPAD_HANDLER_WIN_REGISTRATION_SERVER_H_ | |
16 #define CRASHPAD_HANDLER_WIN_REGISTRATION_SERVER_H_ | |
17 | |
18 #include <windows.h> | |
19 | |
20 #include "base/basictypes.h" | |
21 #include "base/memory/scoped_ptr.h" | |
scottmg
2015/05/21 02:32:36
unused
erikwright (departed)
2015/05/21 15:12:38
Done.
| |
22 #include "base/strings/string16.h" | |
23 #include "util/win/address_types.h" | |
24 #include "util/win/scoped_handle.h" | |
25 | |
26 namespace crashpad { | |
27 | |
28 //! \brief Implements the server side of the Crashpad client registration | |
29 //! protocol for Windows. | |
30 class RegistrationServer { | |
31 public: | |
32 //! \brief Handles registration requests. | |
33 class Delegate { | |
34 public: | |
35 virtual ~Delegate() {} | |
36 | |
37 //! \brief Receives notification that clients may now connect to the named | |
38 //! pipe. | |
39 virtual void OnStarted() = 0; | |
40 | |
41 //! \brief Responds to a request to register a client process for crash | |
42 //! handling. | |
43 //! | |
44 //! \param[in] client_process The client that is making the request. | |
45 //! \param[in] crashpad_info_address The address of a CrashpadInfo structure | |
46 //! in the client's address space. | |
47 //! \param[out] request_dump_event A `HANDLE`, valid in the client process, | |
48 //! to an event that, when signaled, triggers a crash report. | |
49 //! \param[out] dump_complete_event A `HANDLE`, valid in the client process, | |
50 //! to an event that will be signaled when the crash report has been | |
51 //! successfully captured. | |
52 virtual bool RegisterClient(ScopedKernelHANDLE client_process, | |
53 WinVMAddress crashpad_info_address, | |
54 HANDLE* request_dump_event, | |
55 HANDLE* dump_complete_event) = 0; | |
56 }; | |
57 | |
58 //! \brief Instantiates a client registration server. | |
59 RegistrationServer(); | |
60 ~RegistrationServer(); | |
61 | |
62 //! \brief Runs the RegistrationServer, receiving and processing requests and | |
63 //! sending responses. Blocks until Stop() is invoked. | |
64 //! | |
65 //! \param[in] pipe_name The pipe name to be used by the server. | |
66 //! \param[in] delegate The delegate to be used to handle requests. | |
67 void Run(const base::string16& pipe_name, Delegate* delegate); | |
68 | |
69 //! \brief Stops the RegistrationServer. Returns immediately. The instance | |
70 //! must not be destroyed until the call to Run() completes. | |
71 void Stop(); | |
72 | |
73 private: | |
74 ScopedKernelHANDLE stop_event_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(RegistrationServer); | |
77 }; | |
78 | |
79 } // namespace crashpad | |
80 | |
81 #endif // CRASHPAD_HANDLER_WIN_REGISTRATION_SERVER_H_ | |
OLD | NEW |