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

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: Created 5 years, 7 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
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 <vector>
19
20 #include "base/basictypes.h"
21 #include "base/memory/scoped_ptr.h"
22 #include "base/strings/string16.h"
23 #include "test/thread.h"
Mark Mentovai 2015/05/05 20:20:34 Can’t depend on test code from non-test code. Thre
erikwright (departed) 2015/05/20 17:10:16 Done.
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.
Mark Mentovai 2015/05/05 20:20:33 Since this is Windows-specific, the comment should
erikwright (departed) 2015/05/20 17:10:16 Done.
30 class RegistrationServer {
31 public:
32 //! \brief Handles registration requests.
scottmg 2015/05/05 21:12:27 Please add something high level here about to whom
erikwright (departed) 2015/05/20 17:10:16 This allows me to test the registrar without going
33 class Delegate {
34 public:
35 virtual ~Delegate() {}
36
37 //! \brief Responds to a request to register a client process for crash
38 //! handling.
39 //!
40 //! \param[in] client_process The client that is making the request.
41 //! \param[in] crashpad_info_address The address of a CrashpadInfo structure
42 //! in the client's address space.
43 //! \param[out] request_dump_event A HANDLE, valid in the client process, to
Mark Mentovai 2015/05/05 20:20:34 Surround system types in backticks so that they’re
erikwright (departed) 2015/05/20 17:10:16 Done.
44 //! an event that, when signaled, triggers a crash report.
45 //! \param[out] dump_complete_event A HANDLE, valid in the client process,
46 //! to an event that will be signaled when the crash report has been
47 //! successfully captured..
Mark Mentovai 2015/05/05 20:20:34 Double period.
erikwright (departed) 2015/05/20 17:10:16 Done.
48 virtual bool RegisterClient(ScopedKernelHANDLE client_process,
49 size_t crashpad_info_address,
Mark Mentovai 2015/05/05 20:20:34 #include <sys/types.h>
scottmg 2015/05/05 21:12:27 WinVMAddress in util/win/address_types.h would mak
erikwright (departed) 2015/05/20 17:10:16 Acknowledged.
50 HANDLE* request_dump_event,
Mark Mentovai 2015/05/05 20:20:34 #include <windows.h>
erikwright (departed) 2015/05/20 17:10:16 Done.
51 HANDLE* dump_complete_event) = 0;
52 };
53
54 //! \brief Instantiates a client registration server.
55 //!
56 //! \param[in] pipe_name The pipe name to be used by the server.
57 //! \param[in] delegate The delegate to be used to handle requests.
58 RegistrationServer(const base::string16& pipe_name,
59 scoped_ptr<Delegate> delegate);
60 ~RegistrationServer();
61
62 private:
63 class ListenerThread : public test::Thread {
64 public:
65 ListenerThread(ScopedKernelHANDLE pipe, Delegate* delegate);
66
67 void Stop();
68
69 private:
70 // test::Thread implementation.
Mark Mentovai 2015/05/05 20:20:34 // test::Thread:
erikwright (departed) 2015/05/20 17:10:16 Done.
71 void ThreadMain() override;
72
73 ScopedKernelHANDLE pipe_;
74 Delegate* delegate_;
75
76 DISALLOW_COPY_AND_ASSIGN(ListenerThread);
77 };
78
79 scoped_ptr<Delegate> delegate_;
80 std::vector<ListenerThread*> listener_threads_;
81
82 DISALLOW_COPY_AND_ASSIGN(RegistrationServer);
83 };
84
85 } // namespace crashpad
86
87 #endif // CRASHPAD_HANDLER_WIN_REGISTRATION_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698