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

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

Issue 1925993004: Initial addition of Blimp engine crash client code (take 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with head and resolve conflicts Created 4 years, 7 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 "base/base_switches.h"
7 #include "base/command_line.h" 8 #include "base/command_line.h"
8 #include "base/files/file.h" 9 #include "base/files/file.h"
9 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/lazy_instance.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/path_service.h" 13 #include "base/path_service.h"
12 #include "blimp/engine/app/blimp_content_browser_client.h" 14 #include "blimp/engine/app/blimp_content_browser_client.h"
15 #include "blimp/engine/app/blimp_engine_crash_reporter_client.h"
13 #include "blimp/engine/renderer/blimp_content_renderer_client.h" 16 #include "blimp/engine/renderer/blimp_content_renderer_client.h"
17 // TODO(marcinjb): Reenable gncheck for breakpad_linux.h after
18 // http://crbug.com/466890 is resolved.
19 #include "components/crash/content/app/breakpad_linux.h" // nogncheck
20 #include "components/crash/content/app/crash_reporter_client.h"
21 #include "content/public/common/content_switches.h"
14 #include "mojo/public/cpp/bindings/interface_request.h" 22 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
16 24
17 namespace blimp { 25 namespace blimp {
18 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
19 namespace { 33 namespace {
20 void InitLogging() { 34 void InitLogging() {
21 // TODO(haibinlu): Remove this before release. 35 // TODO(haibinlu): Remove this before release.
22 // Enables a few verbose log by default. 36 // Enables a few verbose log by default.
23 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("vmodule")) { 37 if (!base::CommandLine::ForCurrentProcess()->HasSwitch("vmodule")) {
24 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 38 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
25 "vmodule", "remote_channel_main=1"); 39 "vmodule", "remote_channel_main=1");
26 } 40 }
27 41
28 logging::LoggingSettings settings; 42 logging::LoggingSettings settings;
(...skipping 15 matching lines...) Expand all
44 58
45 BlimpContentMainDelegate::~BlimpContentMainDelegate() {} 59 BlimpContentMainDelegate::~BlimpContentMainDelegate() {}
46 60
47 bool BlimpContentMainDelegate::BasicStartupComplete(int* exit_code) { 61 bool BlimpContentMainDelegate::BasicStartupComplete(int* exit_code) {
48 InitLogging(); 62 InitLogging();
49 content::SetContentClient(&content_client_); 63 content::SetContentClient(&content_client_);
50 return false; 64 return false;
51 } 65 }
52 66
53 void BlimpContentMainDelegate::PreSandboxStartup() { 67 void BlimpContentMainDelegate::PreSandboxStartup() {
68 // Enable crash reporting for all processes, and initialize the crash
69 // reporter client.
70 crash_reporter::SetCrashReporterClient(
71 g_blimp_engine_crash_reporter_client.Pointer());
72 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
73 cmd->AppendSwitch(::switches::kEnableCrashReporter);
74 breakpad::InitCrashReporter(
75 cmd->GetSwitchValueASCII(::switches::kProcessType));
76
54 InitializeResourceBundle(); 77 InitializeResourceBundle();
55 } 78 }
56 79
57 void BlimpContentMainDelegate::InitializeResourceBundle() { 80 void BlimpContentMainDelegate::InitializeResourceBundle() {
58 base::FilePath pak_file; 81 base::FilePath pak_file;
59 bool pak_file_valid = PathService::Get(base::DIR_MODULE, &pak_file); 82 bool pak_file_valid = PathService::Get(base::DIR_MODULE, &pak_file);
60 CHECK(pak_file_valid); 83 CHECK(pak_file_valid);
61 pak_file = pak_file.Append(FILE_PATH_LITERAL("blimp_engine.pak")); 84 pak_file = pak_file.Append(FILE_PATH_LITERAL("blimp_engine.pak"));
62 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); 85 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
63 } 86 }
64 87
65 content::ContentBrowserClient* 88 content::ContentBrowserClient*
66 BlimpContentMainDelegate::CreateContentBrowserClient() { 89 BlimpContentMainDelegate::CreateContentBrowserClient() {
67 DCHECK(!browser_client_); 90 DCHECK(!browser_client_);
68 browser_client_.reset(new BlimpContentBrowserClient); 91 browser_client_.reset(new BlimpContentBrowserClient);
69 return browser_client_.get(); 92 return browser_client_.get();
70 } 93 }
71 94
72 content::ContentRendererClient* 95 content::ContentRendererClient*
73 BlimpContentMainDelegate::CreateContentRendererClient() { 96 BlimpContentMainDelegate::CreateContentRendererClient() {
74 DCHECK(!renderer_client_); 97 DCHECK(!renderer_client_);
75 renderer_client_.reset(new BlimpContentRendererClient); 98 renderer_client_.reset(new BlimpContentRendererClient);
76 return renderer_client_.get(); 99 return renderer_client_.get();
77 } 100 }
78 101
79 } // namespace engine 102 } // namespace engine
80 } // namespace blimp 103 } // 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