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

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

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month 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
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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ 15 #ifndef CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_
16 #define CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ 16 #define CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_
17 17
18 #include <set> 18 #include <set>
19 #include <string> 19 #include <string>
20 20
21 #include "base/macros.h" 21 #include "base/macros.h"
22 #include "base/synchronization/lock.h" 22 #include "base/synchronization/lock.h"
23 #include "util/file/file_io.h" 23 #include "util/file/file_io.h"
24 #include "util/win/address_types.h" 24 #include "util/win/address_types.h"
25 #include "util/win/initial_client_data.h"
25 #include "util/win/scoped_handle.h" 26 #include "util/win/scoped_handle.h"
26 27
27 namespace crashpad { 28 namespace crashpad {
28 29
29 namespace internal { 30 namespace internal {
30 class PipeServiceContext; 31 class PipeServiceContext;
31 class ClientData; 32 class ClientData;
32 } // namespace internal 33 } // namespace internal
33 34
34 //! \brief Runs the main exception-handling server in Crashpad's handler 35 //! \brief Runs the main exception-handling server in Crashpad's handler
(...skipping 30 matching lines...) Expand all
65 //! 66 //!
66 //! \param[in] persistent `true` if Run() should not return until Stop() is 67 //! \param[in] persistent `true` if Run() should not return until Stop() is
67 //! called. If `false`, Run() will return when all clients have exited, 68 //! called. If `false`, Run() will return when all clients have exited,
68 //! although Run() will always wait for the first client to connect. 69 //! although Run() will always wait for the first client to connect.
69 explicit ExceptionHandlerServer(bool persistent); 70 explicit ExceptionHandlerServer(bool persistent);
70 71
71 ~ExceptionHandlerServer(); 72 ~ExceptionHandlerServer();
72 73
73 //! \brief Sets the pipe name to listen for client registrations on. 74 //! \brief Sets the pipe name to listen for client registrations on.
74 //! 75 //!
75 //! Either this method or CreatePipe(), but not both, must be called before 76 //! This method, or InitializeWithInheritedDataForInitialClient(), must be
76 //! Run(). 77 //! called before Run().
77 //! 78 //!
78 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the 79 //! \param[in] pipe_name The name of the pipe to listen on. Must be of the
79 //! form "\\.\pipe\<some_name>". 80 //! form "\\.\pipe\<some_name>".
80 void SetPipeName(const std::wstring& pipe_name); 81 void SetPipeName(const std::wstring& pipe_name);
81 82
82 //! \brief Creates a randomized pipe name to listen for client registrations 83 //! \brief Sets the pipe to listen for client registrations on, providing
83 //! on and returns its name. 84 //! the first precreated instance.
84 //! 85 //!
85 //! Either this method or CreatePipe(), but not both, must be called before 86 //! This method, or SetPipeName(), must be called before Run(). All of these
86 //! Run(). 87 //! parameters are generally created in a parent process that launches the
88 //! handler. For more details see the Windows implementation of
89 //! CrashpadClient.
87 //! 90 //!
88 //! \return The pipe name that will be listened on. 91 //! \sa CrashpadClient
89 std::wstring CreatePipe(); 92 //! \sa RegistrationRequest
93 //!
94 //! \param[in] initial_client_data The handles and addresses of data inherited
95 //! from a parent process needed to initialize and register the first
96 //! client. Ownership of these handles is taken.
97 //! \param[in] delegate The interface to which the exceptions are delegated
98 //! when they are caught in Run(). Ownership is not transferred.
99 void InitializeWithInheritedDataForInitialClient(
100 const InitialClientData& initial_client_data,
101 Delegate* delegate);
90 102
91 //! \brief Runs the exception-handling server. 103 //! \brief Runs the exception-handling server.
92 //! 104 //!
93 //! \param[in] delegate The interface to which the exceptions are delegated 105 //! \param[in] delegate The interface to which the exceptions are delegated
94 //! when they are caught in Run(). Ownership is not transferred. 106 //! when they are caught in Run(). Ownership is not transferred.
95 void Run(Delegate* delegate); 107 void Run(Delegate* delegate);
96 108
97 //! \brief Stops the exception-handling server. Returns immediately. The 109 //! \brief Stops the exception-handling server. Returns immediately. The
98 //! object must not be destroyed until Run() returns. 110 //! object must not be destroyed until Run() returns.
99 void Stop(); 111 void Stop();
100 112
113 //! \brief The number of server-side pipe instances that the exception handler
114 //! server creates to listen for connections from clients.
115 static const size_t kPipeInstances = 2;
116
101 private: 117 private:
102 static bool ServiceClientConnection( 118 static bool ServiceClientConnection(
103 const internal::PipeServiceContext& service_context); 119 const internal::PipeServiceContext& service_context);
104 static DWORD __stdcall PipeServiceProc(void* ctx); 120 static DWORD __stdcall PipeServiceProc(void* ctx);
105 static void __stdcall OnCrashDumpEvent(void* ctx, BOOLEAN); 121 static void __stdcall OnCrashDumpEvent(void* ctx, BOOLEAN);
106 static void __stdcall OnNonCrashDumpEvent(void* ctx, BOOLEAN); 122 static void __stdcall OnNonCrashDumpEvent(void* ctx, BOOLEAN);
107 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN); 123 static void __stdcall OnProcessEnd(void* ctx, BOOLEAN);
108 124
109 std::wstring pipe_name_; 125 std::wstring pipe_name_;
110 ScopedKernelHANDLE port_; 126 ScopedKernelHANDLE port_;
111 ScopedFileHandle first_pipe_instance_; 127 ScopedFileHandle first_pipe_instance_;
112 128
113 base::Lock clients_lock_; 129 base::Lock clients_lock_;
114 std::set<internal::ClientData*> clients_; 130 std::set<internal::ClientData*> clients_;
115 131
116 bool persistent_; 132 bool persistent_;
117 133
118 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer); 134 DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer);
119 }; 135 };
120 136
121 } // namespace crashpad 137 } // namespace crashpad
122 138
123 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_ 139 #endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_
OLDNEW
« no previous file with comments | « third_party/crashpad/crashpad/util/util_test.gyp ('k') | third_party/crashpad/crashpad/util/win/exception_handler_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698