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

Side by Side Diff: blimp/engine/app/blimp_content_main_delegate.cc

Issue 1783053002: Initial addition of blimp crash client code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address kmarshall's comments Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « blimp/engine/Dockerfile ('k') | blimp/engine/app/blimp_engine_crash_keys.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "blimp/engine/app/blimp_content_main_delegate.h" 5 #include "blimp/engine/app/blimp_content_main_delegate.h"
6 6
7 #include <string>
8
9 #include "base/base_switches.h"
10 #include "base/command_line.h"
7 #include "base/files/file.h" 11 #include "base/files/file.h"
8 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/lazy_instance.h"
9 #include "base/logging.h" 14 #include "base/logging.h"
10 #include "base/path_service.h" 15 #include "base/path_service.h"
11 #include "blimp/common/compositor/blimp_image_serialization_processor.h" 16 #include "blimp/common/compositor/blimp_image_serialization_processor.h"
12 #include "blimp/engine/app/blimp_content_browser_client.h" 17 #include "blimp/engine/app/blimp_content_browser_client.h"
13 #include "blimp/engine/app/blimp_content_renderer_client.h" 18 #include "blimp/engine/app/blimp_content_renderer_client.h"
19 #include "blimp/engine/app/blimp_engine_crash_reporter_client.h"
20 #include "components/crash/content/app/breakpad_linux.h"
21 #include "components/crash/content/app/crash_reporter_client.h"
22 #include "content/public/common/content_switches.h"
14 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
15 24
16 namespace blimp { 25 namespace blimp {
17 namespace engine { 26 namespace engine {
27
28 // Blimp engine crash client. This should be available globally and should be
29 // long lived.
30 base::LazyInstance<BlimpEngineCrashReporterClient>
31 g_blimp_engine_crash_reporter_client = LAZY_INSTANCE_INITIALIZER;
32
18 namespace { 33 namespace {
19 void InitLogging() { 34 void InitLogging() {
20 logging::LoggingSettings settings; 35 logging::LoggingSettings settings;
21 base::FilePath log_filename; 36 base::FilePath log_filename;
22 PathService::Get(base::DIR_EXE, &log_filename); 37 PathService::Get(base::DIR_EXE, &log_filename);
23 log_filename = log_filename.AppendASCII("blimp_engine.log"); 38 log_filename = log_filename.AppendASCII("blimp_engine.log");
24 settings.logging_dest = logging::LOG_TO_ALL; 39 settings.logging_dest = logging::LOG_TO_ALL;
25 settings.log_file = log_filename.value().c_str(); 40 settings.log_file = log_filename.value().c_str();
26 settings.delete_old = logging::DELETE_OLD_LOG_FILE; 41 settings.delete_old = logging::DELETE_OLD_LOG_FILE;
27 logging::InitLogging(settings); 42 logging::InitLogging(settings);
28 logging::SetLogItems(true, // Process ID 43 logging::SetLogItems(true, // Process ID
29 true, // Thread ID 44 true, // Thread ID
30 true, // Timestamp 45 true, // Timestamp
31 false); // Tick count 46 false); // Tick count
32 } 47 }
33 } // namespace 48 } // namespace
34 49
35 BlimpContentMainDelegate::BlimpContentMainDelegate() {} 50 BlimpContentMainDelegate::BlimpContentMainDelegate() {}
36 51
37 BlimpContentMainDelegate::~BlimpContentMainDelegate() {} 52 BlimpContentMainDelegate::~BlimpContentMainDelegate() {}
38 53
39 bool BlimpContentMainDelegate::BasicStartupComplete(int* exit_code) { 54 bool BlimpContentMainDelegate::BasicStartupComplete(int* exit_code) {
40 InitLogging(); 55 InitLogging();
41 content::SetContentClient(&content_client_); 56 content::SetContentClient(&content_client_);
42 return false; 57 return false;
43 } 58 }
44 59
45 void BlimpContentMainDelegate::PreSandboxStartup() { 60 void BlimpContentMainDelegate::PreSandboxStartup() {
61 // Enable crash reporting for all processes, and initialize the crash
62 // reporter client.
63 crash_reporter::SetCrashReporterClient(
64 g_blimp_engine_crash_reporter_client.Pointer());
65 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
66 const std::string process_type =
67 cmd->GetSwitchValueASCII(::switches::kProcessType);
68 cmd->AppendSwitch(::switches::kEnableCrashReporter);
69 breakpad::InitCrashReporter(process_type);
70
46 InitializeResourceBundle(); 71 InitializeResourceBundle();
47 } 72 }
48 73
49 void BlimpContentMainDelegate::InitializeResourceBundle() { 74 void BlimpContentMainDelegate::InitializeResourceBundle() {
50 base::FilePath pak_file; 75 base::FilePath pak_file;
51 bool pak_file_valid = PathService::Get(base::DIR_MODULE, &pak_file); 76 bool pak_file_valid = PathService::Get(base::DIR_MODULE, &pak_file);
52 CHECK(pak_file_valid); 77 CHECK(pak_file_valid);
53 pak_file = pak_file.Append(FILE_PATH_LITERAL("blimp_engine.pak")); 78 pak_file = pak_file.Append(FILE_PATH_LITERAL("blimp_engine.pak"));
54 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); 79 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
55 } 80 }
(...skipping 11 matching lines...) Expand all
67 scoped_ptr<BlimpImageSerializationProcessor> image_serialization_processor = 92 scoped_ptr<BlimpImageSerializationProcessor> image_serialization_processor =
68 make_scoped_ptr(new BlimpImageSerializationProcessor( 93 make_scoped_ptr(new BlimpImageSerializationProcessor(
69 BlimpImageSerializationProcessor::Mode::SERIALIZATION)); 94 BlimpImageSerializationProcessor::Mode::SERIALIZATION));
70 renderer_client_.reset( 95 renderer_client_.reset(
71 new BlimpContentRendererClient(std::move(image_serialization_processor))); 96 new BlimpContentRendererClient(std::move(image_serialization_processor)));
72 return renderer_client_.get(); 97 return renderer_client_.get();
73 } 98 }
74 99
75 } // namespace engine 100 } // namespace engine
76 } // namespace blimp 101 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/engine/Dockerfile ('k') | blimp/engine/app/blimp_engine_crash_keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698