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

Unified 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: fixes and move some things around Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: util/win/exception_handler_server.h
diff --git a/util/win/exception_handler_server.h b/util/win/exception_handler_server.h
new file mode 100644
index 0000000000000000000000000000000000000000..e7d23cbc8ffefab46439e7768f13e35ee69ba239
--- /dev/null
+++ b/util/win/exception_handler_server.h
@@ -0,0 +1,81 @@
+// Copyright 2015 The Crashpad Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_
+#define CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_
+
+#include <map>
+#include <set>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/synchronization/lock.h"
+#include "util/win/address_types.h"
+#include "util/win/scoped_handle.h"
+
+namespace crashpad {
+
+namespace internal {
+class ClientData;
+} // namespace internal
+
+//! \brief Runs the main exception-handling server in Crashpad's handler
+//! process.
+class ExceptionHandlerServer {
+ public:
+ class Delegate {
+ public:
+ virtual ~Delegate();
+
+ virtual void OnStarted() = 0;
Mark Mentovai 2015/08/26 21:40:28 I like to name interface methods according to thei
scottmg 2015/08/27 01:04:38 Done.
+ virtual void OnException(HANDLE process,
+ WinVMAddress exception_information_address) = 0;
+ virtual void OnShutdown() = 0;
+ };
+
+ //! \brief Constructs the exception handling server.
+ //!
+ //! \param[in] delegate The interface to which the exceptions are delegated
+ //! when they are caught in Run(). Ownership is not transferred and it
+ //! must outlive this object.
+ explicit ExceptionHandlerServer(Delegate* delegate);
+ ~ExceptionHandlerServer();
+
+ //! \brief Runs the exception-handling server.
+ //!
+ //! \param[in] pipe_name The name of the pipe to listen on. Must be of the
+ //! form "\\.\pipe\<some_name>".
+ void Run(const std::string& pipe_name);
+
+ //! \brief Stops the exception-handling server. Returns immediately. The
+ //! object must not be destroyed until Run() returns.
+ void Stop();
+
+ private:
+ static DWORD __stdcall PipeServiceProc(void* ctx);
+ static void __stdcall OnDumpEvent(void* ctx, BOOLEAN);
+ static void __stdcall OnProcessEnd(void* ctx, BOOLEAN);
+
+ Delegate* delegate_; // Weak.
+ ScopedKernelHANDLE port_;
+
+ base::Lock clients_lock_;
+ std::set<internal::ClientData*> clients_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer);
+};
+
+} // namespace crashpad
+
+#endif // CRASHPAD_UTIL_WIN_EXCEPTION_HANDLER_SERVER_H_

Powered by Google App Engine
This is Rietveld 408576698