Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / chrome / tools / crash_service / main.cc
blobc4889c71e978d5e8343233b3a55e677fc5b9eaed
1 // Copyright (c) 2010 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.
5 #include "chrome/tools/crash_service/crash_service.h"
7 #include <windows.h>
8 #include <stdlib.h>
9 #include <tchar.h>
11 #include "base/at_exit.h"
12 #include "base/command_line.h"
13 #include "base/file_util.h"
14 #include "base/logging.h"
16 namespace {
18 const wchar_t kStandardLogFile[] = L"operation_log.txt";
20 bool GetCrashServiceDirectory(base::FilePath* dir) {
21 base::FilePath temp_dir;
22 if (!file_util::GetTempDir(&temp_dir))
23 return false;
24 temp_dir = temp_dir.Append(L"chrome_crashes");
25 if (!base::PathExists(temp_dir)) {
26 if (!file_util::CreateDirectory(temp_dir))
27 return false;
29 *dir = temp_dir;
30 return true;
33 } // namespace.
35 int __stdcall wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd_line,
36 int show_mode) {
37 // Manages the destruction of singletons.
38 base::AtExitManager exit_manager;
40 CommandLine::Init(0, NULL);
42 // We use/create a directory under the user's temp folder, for logging.
43 base::FilePath operating_dir;
44 GetCrashServiceDirectory(&operating_dir);
45 base::FilePath log_file = operating_dir.Append(kStandardLogFile);
47 // Logging to stderr (to help with debugging failures on the
48 // buildbots) and to a file.
49 logging::LoggingSettings settings;
50 settings.logging_dest = logging::LOG_TO_ALL;
51 settings.log_file = log_file.value().c_str();
52 logging::InitLogging(settings);
53 // Logging with pid, tid and timestamp.
54 logging::SetLogItems(true, true, true, false);
56 VLOG(1) << "session start. cmdline is [" << cmd_line << "]";
58 CrashService crash_service(operating_dir.value());
59 if (!crash_service.Initialize(::GetCommandLineW()))
60 return 1;
62 VLOG(1) << "ready to process crash requests";
64 // Enter the message loop.
65 int retv = crash_service.ProcessingLoop();
66 // Time to exit.
67 VLOG(1) << "session end. return code is " << retv;
68 return retv;