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

Side by Side Diff: util/win/exception_handler_server.h

Issue 1301853002: win: Crash handler server (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: oops Created 5 years, 3 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 | « util/util_test.gyp ('k') | util/win/exception_handler_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_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_
16 #define CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_
17
18 #include <set>
19 #include <string>
20
21 #include "base/basictypes.h"
22 #include "base/synchronization/lock.h"
23 #include "util/win/address_types.h"
24 #include "util/win/scoped_handle.h"
25
26 namespace crashpad {
27
28 namespace internal {
29 class PipeServiceContext;
30 class ClientData;
31 } // namespace internal
32
33 //! \brief Runs the main exception-handling server in Crashpad's handler
34 //! process.
35 class ExceptionHandlerServer {
36 public:
37 class Delegate {
38 public:
39 virtual ~Delegate();
40
41 //! \brief Called when the server has created the named pipe connection
42 //! points and is ready to service requests.
43 virtual void ExceptionHandlerServerStarted() = 0;
44
45 //! \brief Called when the client has signalled that it has encountered an
46 //! exception and so wants a crash dump to be taken.
47 //!
48 //! \param[in] process A handle to the client process. Ownership of the
49 //! lifetime of this handle is not passed to the delegate.
50 //! \param[in] exception_information_address The address in the client's
51 //! address space of an ExceptionInformation structure.
52 //! \return The exit code that should be used when terminating the client
53 //! process.
54 virtual unsigned int ExceptionHandlerServerException(
55 HANDLE process,
56 WinVMAddress exception_information_address) = 0;
57 };
58
59 //! \brief Constructs the exception handling server.
60 //!
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();
66
67 //! \brief Runs the exception-handling server.
68 //!
69 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the
70 //! form "\\.\pipe\<some_name>".
71 void Run(const std::string& pipe_name);
72
73 //! \brief Stops the exception-handling server. Returns immediately. The
74 //! object must not be destroyed until Run() returns.
75 void Stop();
76
77 private:
78 static bool ServiceClientConnection(
79 const internal::PipeServiceContext& service_context);
80 static DWORD __stdcall PipeServiceProc(void* ctx);
81 static void __stdcall OnDumpEvent(void* ctx, BOOLEAN);
82 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN);
83
84 Delegate* delegate_; // Weak.
85 ScopedKernelHANDLE port_;
86
87 base::Lock clients_lock_;
88 std::set<internal::ClientData*> clients_;
89
90 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer);
91 };
92
93 } // namespace crashpad
94
95 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_
OLDNEW
« no previous file with comments | « util/util_test.gyp ('k') | util/win/exception_handler_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698