From fc816a3b3ae4f5606fc5bad14007e57420df96f2 Mon Sep 17 00:00:00 2001 From: doshimun Date: Thu, 3 Apr 2008 21:46:58 +0000 Subject: Minor style changes to comply with Google style guidelines. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@252 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../crash_generation/crash_generation_client.h | 2 + .../crash_generation/crash_generation_server.cc | 50 +++++++++++----------- .../crash_generation/crash_generation_server.h | 17 +++++--- .../windows/crash_generation/minidump_generator.h | 4 +- 4 files changed, 39 insertions(+), 34 deletions(-) (limited to 'src/client/windows') diff --git a/src/client/windows/crash_generation/crash_generation_client.h b/src/client/windows/crash_generation/crash_generation_client.h index dbf701f4..01c9417a 100644 --- a/src/client/windows/crash_generation/crash_generation_client.h +++ b/src/client/windows/crash_generation/crash_generation_client.h @@ -30,6 +30,8 @@ #ifndef CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__ #define CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__ +#include +#include #include #include "client/windows/common/ipc_protocol.h" diff --git a/src/client/windows/crash_generation/crash_generation_server.cc b/src/client/windows/crash_generation/crash_generation_server.cc index 31e0b4ea..5409cc5a 100644 --- a/src/client/windows/crash_generation/crash_generation_server.cc +++ b/src/client/windows/crash_generation/crash_generation_server.cc @@ -28,7 +28,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "client/windows/crash_generation/crash_generation_server.h" -#include +#include #include #include "client/windows/common/auto_critical_section.h" #include "processor/scoped_ptr.h" @@ -80,7 +80,7 @@ const int kShutdownDelayMs = 10000; // Interval for each sleep during server shutdown. const int kShutdownSleepIntervalMs = 5; -static bool ValidateClientRequest(const ProtocolMessage& msg) { +static bool IsClientRequestValid(const ProtocolMessage& msg) { return msg.tag == MESSAGE_TAG_REGISTRATION_REQUEST && msg.pid != 0 && msg.thread_id != NULL && @@ -89,7 +89,7 @@ static bool ValidateClientRequest(const ProtocolMessage& msg) { } CrashGenerationServer::CrashGenerationServer( - const wchar_t* pipe_name, + const std::wstring& pipe_name, OnClientConnectedCallback connect_callback, void* connect_context, OnClientDumpRequestCallback dump_callback, @@ -98,23 +98,23 @@ CrashGenerationServer::CrashGenerationServer( void* exit_context, bool generate_dumps, const std::wstring* dump_path) - : pipe_name_(pipe_name), - pipe_(NULL), - pipe_wait_handle_(NULL), - server_alive_handle_(NULL), - connect_callback_(connect_callback), - connect_context_(connect_context), - dump_callback_(dump_callback), - dump_context_(dump_context), - exit_callback_(exit_callback), - exit_context_(exit_context), - generate_dumps_(generate_dumps), - dump_generator_(NULL), - server_state_(IPC_SERVER_STATE_INITIAL), - shutting_down_(false), - overlapped_(), - client_info_(NULL), - cleanup_item_count_(0) { + : pipe_name_(pipe_name), + pipe_(NULL), + pipe_wait_handle_(NULL), + server_alive_handle_(NULL), + connect_callback_(connect_callback), + connect_context_(connect_context), + dump_callback_(dump_callback), + dump_context_(dump_context), + exit_callback_(exit_callback), + exit_context_(exit_context), + generate_dumps_(generate_dumps), + dump_generator_(NULL), + server_state_(IPC_SERVER_STATE_INITIAL), + shutting_down_(false), + overlapped_(), + client_info_(NULL), + cleanup_item_count_(0) { InitializeCriticalSection(&clients_sync_); if (dump_path) { @@ -269,8 +269,7 @@ void CrashGenerationServer::HandleInitialState() { return; } - bool success; - success = ConnectNamedPipe(pipe_, &overlapped_) != FALSE; + bool success = ConnectNamedPipe(pipe_, &overlapped_) != FALSE; // From MSDN, it is not clear that when ConnectNamedPipe is used // in an overlapped mode, will it ever return non-zero value, and @@ -362,7 +361,7 @@ void CrashGenerationServer::HandleReadingState() { &bytes_count, FALSE) != FALSE; - if (success && bytes_count == sizeof(ProtocolMessage)){ + if (success && bytes_count == sizeof(ProtocolMessage)) { server_state_ = IPC_SERVER_STATE_READ_DONE; return; } @@ -387,7 +386,7 @@ void CrashGenerationServer::HandleReadingState() { void CrashGenerationServer::HandleReadDoneState() { assert(server_state_ == IPC_SERVER_STATE_READ_DONE); - if (!ValidateClientRequest(msg_)) { + if (!IsClientRequestValid(msg_)) { server_state_ = IPC_SERVER_STATE_DISCONNECTING; return; } @@ -743,8 +742,7 @@ void CALLBACK CrashGenerationServer::OnClientEnd(void* context, BOOLEAN) { InterlockedIncrement(&crash_server->cleanup_item_count_); - if (!QueueUserWorkItem(CleanupClient, context, WT_EXECUTEDEFAULT)) - { + if (!QueueUserWorkItem(CleanupClient, context, WT_EXECUTEDEFAULT)) { InterlockedDecrement(&crash_server->cleanup_item_count_); } } diff --git a/src/client/windows/crash_generation/crash_generation_server.h b/src/client/windows/crash_generation/crash_generation_server.h index 864bacb1..57fa2ec3 100644 --- a/src/client/windows/crash_generation/crash_generation_server.h +++ b/src/client/windows/crash_generation/crash_generation_server.h @@ -40,8 +40,13 @@ namespace google_breakpad { // Abstraction for server side implementation of out-of-process crash -// generation protocol. It generates minidumps (Windows platform) for -// client processes that request dump generation. +// generation protocol for Windows platform only. It generates Windows +// minidump files for client processes that request dump generation. When +// the server is requested to start listening for clients (by calling the +// Start method), it creates a named pipe and waits for the clients to +// register. In response, it hands them event handles that the client can +// signal to request dump generation. When the clients request dump +// generation in this way, the server generates Windows minidump files. class CrashGenerationServer { public: typedef void (*OnClientConnectedCallback)(void* context, @@ -55,20 +60,20 @@ class CrashGenerationServer { // Creates an instance with the given parameters. // - // Parameter pipe_name: Name of the pipe + // Parameter pipe_name: Name of the Windows Named pipe // Parameter connect_callback: Callback for a new client connection. // Parameter connect_context: Context for client connection callback. // Parameter crash_callback: Callback for a client crash dump request. // Parameter crash_context: Context for client crash dump request callback. // Parameter exit_callback: Callback for client process exit. // Parameter exit_context: Context for client exit callback. - // Parameter generate_dumps: Whether to automatically generate dumps or not. + // Parameter generate_dumps: Whether to automatically generate dumps. // Client code of this class might want to generate dumps explicitly in the // crash dump request callback. In that case, false can be passed for this // parameter. // Parameter dump_path: Path for generating dumps; required only if true is // passed for generateDumps parameter; NULL can be passed otherwise. - CrashGenerationServer(const wchar_t* pipe_name, + CrashGenerationServer(const std::wstring& pipe_name, OnClientConnectedCallback connect_callback, void* connect_context, OnClientDumpRequestCallback dump_callback, @@ -217,7 +222,7 @@ class CrashGenerationServer { // Context for client process exit callback. void* exit_context_; - // Whether to generate dumps or not. + // Whether to generate dumps. bool generate_dumps_; // Instance of a mini dump generator. diff --git a/src/client/windows/crash_generation/minidump_generator.h b/src/client/windows/crash_generation/minidump_generator.h index 71af6e9c..b14fc67b 100644 --- a/src/client/windows/crash_generation/minidump_generator.h +++ b/src/client/windows/crash_generation/minidump_generator.h @@ -30,8 +30,8 @@ #ifndef CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__ #define CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__ -#include -#include +#include +#include #include #include "google_breakpad/common/minidump_format.h" -- cgit v1.2.1