Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: handler/win/registration_server.h

Issue 1126783004: Introduce RegistrationServer. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: One extra comment. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « handler/win/registration_pipe_state_test.cc ('k') | handler/win/registration_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/strings/string16.h"
22 #include "util/win/address_types.h"
23 #include "util/win/scoped_handle.h"
24
25 namespace crashpad {
26
27 //! \brief Implements the server side of the Crashpad client registration
28 //! protocol for Windows.
29 class RegistrationServer {
30 public:
31 //! \brief Handles registration requests.
32 class Delegate {
33 public:
34 virtual ~Delegate() {}
35
36 //! \brief Receives notification that clients may now connect to the named
37 //! pipe.
38 virtual void OnStarted() = 0;
39
40 //! \brief Responds to a request to register a client process for crash
41 //! handling.
42 //!
43 //! \param[in] client_process The client that is making the request.
44 //! \param[in] crashpad_info_address The address of a CrashpadInfo structure
45 //! in the client's address space.
46 //! \param[out] request_dump_event A `HANDLE`, valid in the client process,
47 //! to an event that, when signaled, triggers a crash report.
48 //! \param[out] dump_complete_event A `HANDLE`, valid in the client process,
49 //! to an event that will be signaled when the crash report has been
50 //! successfully captured.
51 virtual bool RegisterClient(ScopedKernelHANDLE client_process,
52 WinVMAddress crashpad_info_address,
53 HANDLE* request_dump_event,
54 HANDLE* dump_complete_event) = 0;
55 };
56
57 //! \brief Instantiates a client registration server.
58 RegistrationServer();
59 ~RegistrationServer();
60
61 //! \brief Runs the RegistrationServer, receiving and processing requests and
62 //! sending responses. Blocks until Stop() is invoked.
63 //!
64 //! \param[in] pipe_name The pipe name to be used by the server.
65 //! \param[in] delegate The delegate to be used to handle requests.
66 //!
67 //! \return Returns `true` if it terminates due to invocation of Stop().
68 //! `false` indicates early termination due to a failure.
69 bool Run(const base::string16& pipe_name, Delegate* delegate);
70
71 //! \brief Stops the RegistrationServer. Returns immediately. The instance
72 //! must not be destroyed until the call to Run() completes.
73 void Stop();
74
75 private:
76 ScopedKernelHANDLE stop_event_;
77
78 DISALLOW_COPY_AND_ASSIGN(RegistrationServer);
79 };
80
81 } // namespace crashpad
82
83 #endif // CRASHPAD_HANDLER_WIN_REGISTRATION_SERVER_H_
OLDNEW
« no previous file with comments | « handler/win/registration_pipe_state_test.cc ('k') | handler/win/registration_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698