content_shell_crash_service.cc revision 1e9bf3e0803691d0a228da41fc608347b6db4340
1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <windows.h>
6#include <stdlib.h>
7#include <tchar.h>
8
9#include "base/at_exit.h"
10#include "base/command_line.h"
11#include "base/files/file_path.h"
12#include "base/logging.h"
13#include "components/breakpad/tools/crash_service.h"
14
15int __stdcall wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd_line,
16                       int show_mode) {
17  // Manages the destruction of singletons.
18  base::AtExitManager exit_manager;
19
20  CommandLine::Init(0, NULL);
21
22  // Logging to stderr.
23  logging::LoggingSettings settings;
24  settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
25  logging::InitLogging(settings);
26  // Logging with pid, tid and timestamp.
27  logging::SetLogItems(true, true, true, false);
28
29  VLOG(1) << "session start. cmdline is [" << cmd_line << "]";
30
31  breakpad::CrashService crash_service;
32  if (!crash_service.Initialize(base::FilePath(), base::FilePath()))
33    return 1;
34
35  VLOG(1) << "ready to process crash requests";
36
37  // Enter the message loop.
38  int retv = crash_service.ProcessingLoop();
39  // Time to exit.
40  VLOG(1) << "session end. return code is " << retv;
41  return retv;
42}
43