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

Side by Side Diff: chrome/test/base/testing_browser_process.cc

Issue 1803143002: Replace BrowserProces::AddRefModule/RemoveModule by ScopedKeepAlive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address 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 | « chrome/test/base/testing_browser_process.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/base/testing_browser_process.h" 5 #include "chrome/test/base/testing_browser_process.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/time/default_clock.h" 8 #include "base/time/default_clock.h"
9 #include "base/time/default_tick_clock.h" 9 #include "base/time/default_tick_clock.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_process_impl.h" 12 #include "chrome/browser/browser_process_impl.h"
13 #include "chrome/browser/lifetime/application_lifetime.h"
13 #include "chrome/browser/notifications/notification_ui_manager.h" 14 #include "chrome/browser/notifications/notification_ui_manager.h"
14 #include "chrome/browser/printing/print_job_manager.h" 15 #include "chrome/browser/printing/print_job_manager.h"
15 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 17 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "chrome/common/features.h" 18 #include "chrome/common/features.h"
18 #include "chrome/test/base/testing_browser_process_platform_part.h" 19 #include "chrome/test/base/testing_browser_process_platform_part.h"
19 #include "components/network_time/network_time_tracker.h" 20 #include "components/network_time/network_time_tracker.h"
20 #include "components/policy/core/browser/browser_policy_connector.h" 21 #include "components/policy/core/browser/browser_policy_connector.h"
21 #include "components/prefs/pref_service.h" 22 #include "components/prefs/pref_service.h"
22 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // static 56 // static
56 void TestingBrowserProcess::DeleteInstance() { 57 void TestingBrowserProcess::DeleteInstance() {
57 // g_browser_process must be null during its own destruction. 58 // g_browser_process must be null during its own destruction.
58 BrowserProcess* browser_process = g_browser_process; 59 BrowserProcess* browser_process = g_browser_process;
59 g_browser_process = nullptr; 60 g_browser_process = nullptr;
60 delete browser_process; 61 delete browser_process;
61 } 62 }
62 63
63 TestingBrowserProcess::TestingBrowserProcess() 64 TestingBrowserProcess::TestingBrowserProcess()
64 : notification_service_(content::NotificationService::Create()), 65 : notification_service_(content::NotificationService::Create()),
65 module_ref_count_(0),
66 app_locale_("en"), 66 app_locale_("en"),
67 local_state_(nullptr), 67 local_state_(nullptr),
68 io_thread_(nullptr), 68 io_thread_(nullptr),
69 system_request_context_(nullptr), 69 system_request_context_(nullptr),
70 rappor_service_(nullptr), 70 rappor_service_(nullptr),
71 platform_part_(new TestingBrowserProcessPlatformPart()) { 71 platform_part_(new TestingBrowserProcessPlatformPart()) {
72 #if defined(ENABLE_EXTENSIONS) 72 #if defined(ENABLE_EXTENSIONS)
73 extensions_browser_client_.reset( 73 extensions_browser_client_.reset(
74 new extensions::ChromeExtensionsBrowserClient); 74 new extensions::ChromeExtensionsBrowserClient);
75 extensions::AppWindowClient::Set(ChromeAppWindowClient::GetInstance()); 75 extensions::AppWindowClient::Set(ChromeAppWindowClient::GetInstance());
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 228
229 void TestingBrowserProcess::CreateDevToolsHttpProtocolHandler( 229 void TestingBrowserProcess::CreateDevToolsHttpProtocolHandler(
230 const std::string& ip, 230 const std::string& ip,
231 uint16_t port) { 231 uint16_t port) {
232 } 232 }
233 233
234 void TestingBrowserProcess::CreateDevToolsAutoOpener() { 234 void TestingBrowserProcess::CreateDevToolsAutoOpener() {
235 } 235 }
236 236
237 unsigned int TestingBrowserProcess::AddRefModule() {
238 return ++module_ref_count_;
239 }
240
241 unsigned int TestingBrowserProcess::ReleaseModule() {
242 DCHECK_GT(module_ref_count_, 0U);
243 return --module_ref_count_;
244 }
245
246 bool TestingBrowserProcess::IsShuttingDown() { 237 bool TestingBrowserProcess::IsShuttingDown() {
247 return false; 238 return false;
248 } 239 }
249 240
250 printing::PrintJobManager* TestingBrowserProcess::print_job_manager() { 241 printing::PrintJobManager* TestingBrowserProcess::print_job_manager() {
251 #if defined(ENABLE_PRINTING) 242 #if defined(ENABLE_PRINTING)
252 if (!print_job_manager_.get()) 243 if (!print_job_manager_.get())
253 print_job_manager_.reset(new printing::PrintJobManager()); 244 print_job_manager_.reset(new printing::PrintJobManager());
254 return print_job_manager_.get(); 245 return print_job_manager_.get();
255 #else 246 #else
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 412
422 /////////////////////////////////////////////////////////////////////////////// 413 ///////////////////////////////////////////////////////////////////////////////
423 414
424 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { 415 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() {
425 TestingBrowserProcess::CreateInstance(); 416 TestingBrowserProcess::CreateInstance();
426 } 417 }
427 418
428 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { 419 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() {
429 TestingBrowserProcess::DeleteInstance(); 420 TestingBrowserProcess::DeleteInstance();
430 } 421 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_browser_process.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698