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
This commit is contained in:
doshimun 2008-04-03 21:46:58 +00:00
parent dd2ff4a21c
commit fc816a3b3a
4 changed files with 39 additions and 34 deletions

View file

@ -30,6 +30,8 @@
#ifndef CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__ #ifndef CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__
#define CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__ #define CLIENT_WINDOWS_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H__
#include <windows.h>
#include <dbghelp.h>
#include <string> #include <string>
#include "client/windows/common/ipc_protocol.h" #include "client/windows/common/ipc_protocol.h"

View file

@ -28,7 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "client/windows/crash_generation/crash_generation_server.h" #include "client/windows/crash_generation/crash_generation_server.h"
#include <Windows.h> #include <windows.h>
#include <cassert> #include <cassert>
#include "client/windows/common/auto_critical_section.h" #include "client/windows/common/auto_critical_section.h"
#include "processor/scoped_ptr.h" #include "processor/scoped_ptr.h"
@ -80,7 +80,7 @@ const int kShutdownDelayMs = 10000;
// Interval for each sleep during server shutdown. // Interval for each sleep during server shutdown.
const int kShutdownSleepIntervalMs = 5; const int kShutdownSleepIntervalMs = 5;
static bool ValidateClientRequest(const ProtocolMessage& msg) { static bool IsClientRequestValid(const ProtocolMessage& msg) {
return msg.tag == MESSAGE_TAG_REGISTRATION_REQUEST && return msg.tag == MESSAGE_TAG_REGISTRATION_REQUEST &&
msg.pid != 0 && msg.pid != 0 &&
msg.thread_id != NULL && msg.thread_id != NULL &&
@ -89,7 +89,7 @@ static bool ValidateClientRequest(const ProtocolMessage& msg) {
} }
CrashGenerationServer::CrashGenerationServer( CrashGenerationServer::CrashGenerationServer(
const wchar_t* pipe_name, const std::wstring& pipe_name,
OnClientConnectedCallback connect_callback, OnClientConnectedCallback connect_callback,
void* connect_context, void* connect_context,
OnClientDumpRequestCallback dump_callback, OnClientDumpRequestCallback dump_callback,
@ -269,8 +269,7 @@ void CrashGenerationServer::HandleInitialState() {
return; return;
} }
bool success; bool success = ConnectNamedPipe(pipe_, &overlapped_) != FALSE;
success = ConnectNamedPipe(pipe_, &overlapped_) != FALSE;
// From MSDN, it is not clear that when ConnectNamedPipe is used // From MSDN, it is not clear that when ConnectNamedPipe is used
// in an overlapped mode, will it ever return non-zero value, and // in an overlapped mode, will it ever return non-zero value, and
@ -362,7 +361,7 @@ void CrashGenerationServer::HandleReadingState() {
&bytes_count, &bytes_count,
FALSE) != FALSE; FALSE) != FALSE;
if (success && bytes_count == sizeof(ProtocolMessage)){ if (success && bytes_count == sizeof(ProtocolMessage)) {
server_state_ = IPC_SERVER_STATE_READ_DONE; server_state_ = IPC_SERVER_STATE_READ_DONE;
return; return;
} }
@ -387,7 +386,7 @@ void CrashGenerationServer::HandleReadingState() {
void CrashGenerationServer::HandleReadDoneState() { void CrashGenerationServer::HandleReadDoneState() {
assert(server_state_ == IPC_SERVER_STATE_READ_DONE); assert(server_state_ == IPC_SERVER_STATE_READ_DONE);
if (!ValidateClientRequest(msg_)) { if (!IsClientRequestValid(msg_)) {
server_state_ = IPC_SERVER_STATE_DISCONNECTING; server_state_ = IPC_SERVER_STATE_DISCONNECTING;
return; return;
} }
@ -743,8 +742,7 @@ void CALLBACK CrashGenerationServer::OnClientEnd(void* context, BOOLEAN) {
InterlockedIncrement(&crash_server->cleanup_item_count_); InterlockedIncrement(&crash_server->cleanup_item_count_);
if (!QueueUserWorkItem(CleanupClient, context, WT_EXECUTEDEFAULT)) if (!QueueUserWorkItem(CleanupClient, context, WT_EXECUTEDEFAULT)) {
{
InterlockedDecrement(&crash_server->cleanup_item_count_); InterlockedDecrement(&crash_server->cleanup_item_count_);
} }
} }

View file

@ -40,8 +40,13 @@
namespace google_breakpad { namespace google_breakpad {
// Abstraction for server side implementation of out-of-process crash // Abstraction for server side implementation of out-of-process crash
// generation protocol. It generates minidumps (Windows platform) for // generation protocol for Windows platform only. It generates Windows
// client processes that request dump generation. // 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 { class CrashGenerationServer {
public: public:
typedef void (*OnClientConnectedCallback)(void* context, typedef void (*OnClientConnectedCallback)(void* context,
@ -55,20 +60,20 @@ class CrashGenerationServer {
// Creates an instance with the given parameters. // 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_callback: Callback for a new client connection.
// Parameter connect_context: Context for client connection callback. // Parameter connect_context: Context for client connection callback.
// Parameter crash_callback: Callback for a client crash dump request. // Parameter crash_callback: Callback for a client crash dump request.
// Parameter crash_context: Context for client crash dump request callback. // Parameter crash_context: Context for client crash dump request callback.
// Parameter exit_callback: Callback for client process exit. // Parameter exit_callback: Callback for client process exit.
// Parameter exit_context: Context for client exit callback. // 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 // 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 // crash dump request callback. In that case, false can be passed for this
// parameter. // parameter.
// Parameter dump_path: Path for generating dumps; required only if true is // Parameter dump_path: Path for generating dumps; required only if true is
// passed for generateDumps parameter; NULL can be passed otherwise. // passed for generateDumps parameter; NULL can be passed otherwise.
CrashGenerationServer(const wchar_t* pipe_name, CrashGenerationServer(const std::wstring& pipe_name,
OnClientConnectedCallback connect_callback, OnClientConnectedCallback connect_callback,
void* connect_context, void* connect_context,
OnClientDumpRequestCallback dump_callback, OnClientDumpRequestCallback dump_callback,
@ -217,7 +222,7 @@ class CrashGenerationServer {
// Context for client process exit callback. // Context for client process exit callback.
void* exit_context_; void* exit_context_;
// Whether to generate dumps or not. // Whether to generate dumps.
bool generate_dumps_; bool generate_dumps_;
// Instance of a mini dump generator. // Instance of a mini dump generator.

View file

@ -30,8 +30,8 @@
#ifndef CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__ #ifndef CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__
#define CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__ #define CLIENT_WINDOWS_CRASH_GENERATION_MINIDUMP_GENERATION_H__
#include <Windows.h> #include <windows.h>
#include <DbgHelp.h> #include <dbghelp.h>
#include <list> #include <list>
#include "google_breakpad/common/minidump_format.h" #include "google_breakpad/common/minidump_format.h"