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

Side by Side Diff: chrome/browser/chrome_browser_main_android.cc

Issue 2200693002: Refactor CrashDump*Manager to use a shared CrashDumpObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang compile errors Created 4 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chrome_browser_main_android.h" 5 #include "chrome/browser/chrome_browser_main_android.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/memory/ptr_util.h"
11 #include "base/path_service.h" 12 #include "base/path_service.h"
12 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
13 #include "chrome/browser/android/seccomp_support_detector.h" 14 #include "chrome/browser/android/seccomp_support_detector.h"
14 #include "chrome/browser/signin/signin_manager_factory.h" 15 #include "chrome/browser/signin/signin_manager_factory.h"
15 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/descriptors_android.h"
16 #include "components/crash/content/app/breakpad_linux.h" 18 #include "components/crash/content/app/breakpad_linux.h"
17 #include "components/crash/content/browser/crash_dump_manager_android.h" 19 #include "components/crash/content/browser/crash_dump_manager_android.h"
18 #include "components/signin/core/browser/signin_manager.h" 20 #include "components/signin/core/browser/signin_manager.h"
19 #include "content/public/browser/android/compositor.h" 21 #include "content/public/browser/android/compositor.h"
20 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
21 #include "content/public/common/main_function_params.h" 23 #include "content/public/common/main_function_params.h"
22 #include "net/android/network_change_notifier_factory_android.h" 24 #include "net/android/network_change_notifier_factory_android.h"
23 #include "net/base/network_change_notifier.h" 25 #include "net/base/network_change_notifier.h"
24 #include "ui/base/resource/resource_bundle_android.h" 26 #include "ui/base/resource/resource_bundle_android.h"
25 #include "ui/base/ui_base_paths.h" 27 #include "ui/base/ui_base_paths.h"
(...skipping 12 matching lines...) Expand all
38 const content::MainFunctionParams& parameters) 40 const content::MainFunctionParams& parameters)
39 : ChromeBrowserMainParts(parameters) { 41 : ChromeBrowserMainParts(parameters) {
40 } 42 }
41 43
42 ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() { 44 ChromeBrowserMainPartsAndroid::~ChromeBrowserMainPartsAndroid() {
43 } 45 }
44 46
45 int ChromeBrowserMainPartsAndroid::PreCreateThreads() { 47 int ChromeBrowserMainPartsAndroid::PreCreateThreads() {
46 TRACE_EVENT0("startup", "ChromeBrowserMainPartsAndroid::PreCreateThreads") 48 TRACE_EVENT0("startup", "ChromeBrowserMainPartsAndroid::PreCreateThreads")
47 49
48 // The CrashDumpManager must be initialized before any child process is 50 // The CrashDumpManager must be initialized before any child
49 // created (as they need to access it during creation). Such processes 51 // process is created (as they need to access it during
50 // are created on the PROCESS_LAUNCHER thread, and so the manager is 52 // creation). Such processes are created on the PROCESS_LAUNCHER
51 // initialized before that thread is created. 53 // thread, and so the manager is initialized before that thread is
54 // created.
52 #if defined(GOOGLE_CHROME_BUILD) 55 #if defined(GOOGLE_CHROME_BUILD)
53 // TODO(jcivelli): we should not initialize the crash-reporter when it was not 56 // TODO(jcivelli): we should not initialize the crash-reporter when it was not
54 // enabled. Right now if it is disabled we still generate the minidumps but we 57 // enabled. Right now if it is disabled we still generate the minidumps but we
55 // do not upload them. 58 // do not upload them.
56 bool breakpad_enabled = true; 59 bool breakpad_enabled = true;
57 #else 60 #else
58 bool breakpad_enabled = false; 61 bool breakpad_enabled = false;
59 #endif 62 #endif
60 63
61 // Allow Breakpad to be enabled in Chromium builds for testing purposes. 64 // Allow Breakpad to be enabled in Chromium builds for testing purposes.
62 if (!breakpad_enabled) 65 if (!breakpad_enabled)
63 breakpad_enabled = base::CommandLine::ForCurrentProcess()->HasSwitch( 66 breakpad_enabled = base::CommandLine::ForCurrentProcess()->HasSwitch(
64 switches::kEnableCrashReporterForTesting); 67 switches::kEnableCrashReporterForTesting);
65 68
66 if (breakpad_enabled) { 69 if (breakpad_enabled) {
67 base::FilePath crash_dump_dir; 70 base::FilePath crash_dump_dir;
68 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_dir); 71 PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_dir);
69 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir)); 72 breakpad::CrashDumpObserver::GetInstance()->RegisterClient(
73 base::MakeUnique<breakpad::CrashDumpManager>(
74 crash_dump_dir, kAndroidMinidumpDescriptor));
70 } 75 }
71 76
72 ui::SetLocalePaksStoredInApk(false); 77 ui::SetLocalePaksStoredInApk(false);
73 78
74 return ChromeBrowserMainParts::PreCreateThreads(); 79 return ChromeBrowserMainParts::PreCreateThreads();
75 } 80 }
76 81
77 void ChromeBrowserMainPartsAndroid::PostProfileInit() { 82 void ChromeBrowserMainPartsAndroid::PostProfileInit() {
78 ChromeBrowserMainParts::PostProfileInit(); 83 ChromeBrowserMainParts::PostProfileInit();
79 84
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 ChromeBrowserMainParts::PostBrowserStart(); 126 ChromeBrowserMainParts::PostBrowserStart();
122 127
123 content::BrowserThread::GetBlockingPool()->PostDelayedTask(FROM_HERE, 128 content::BrowserThread::GetBlockingPool()->PostDelayedTask(FROM_HERE,
124 base::Bind(&SeccompSupportDetector::StartDetection), 129 base::Bind(&SeccompSupportDetector::StartDetection),
125 base::TimeDelta::FromMinutes(1)); 130 base::TimeDelta::FromMinutes(1));
126 } 131 }
127 132
128 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() { 133 void ChromeBrowserMainPartsAndroid::ShowMissingLocaleMessageBox() {
129 NOTREACHED(); 134 NOTREACHED();
130 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698