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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 2579233002: Merge MemoryCoordinator and MemoryCoordinatorImpl into one class (Closed)
Patch Set: addressed comments Created 3 years, 12 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 | « content/browser/BUILD.gn ('k') | content/browser/dom_storage/dom_storage_context_wrapper.cc » ('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 (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 "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 60 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
61 #include "content/browser/gpu/compositor_util.h" 61 #include "content/browser/gpu/compositor_util.h"
62 #include "content/browser/gpu/gpu_data_manager_impl.h" 62 #include "content/browser/gpu/gpu_data_manager_impl.h"
63 #include "content/browser/gpu/gpu_process_host.h" 63 #include "content/browser/gpu/gpu_process_host.h"
64 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 64 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
65 #include "content/browser/gpu/shader_cache_factory.h" 65 #include "content/browser/gpu/shader_cache_factory.h"
66 #include "content/browser/histogram_synchronizer.h" 66 #include "content/browser/histogram_synchronizer.h"
67 #include "content/browser/loader/resource_dispatcher_host_impl.h" 67 #include "content/browser/loader/resource_dispatcher_host_impl.h"
68 #include "content/browser/loader_delegate_impl.h" 68 #include "content/browser/loader_delegate_impl.h"
69 #include "content/browser/media/media_internals.h" 69 #include "content/browser/media/media_internals.h"
70 #include "content/browser/memory/memory_coordinator.h" 70 #include "content/browser/memory/memory_coordinator_impl.h"
71 #include "content/browser/net/browser_online_state_observer.h" 71 #include "content/browser/net/browser_online_state_observer.h"
72 #include "content/browser/renderer_host/media/media_stream_manager.h" 72 #include "content/browser/renderer_host/media/media_stream_manager.h"
73 #include "content/browser/renderer_host/render_process_host_impl.h" 73 #include "content/browser/renderer_host/render_process_host_impl.h"
74 #include "content/browser/service_manager/service_manager_context.h" 74 #include "content/browser/service_manager/service_manager_context.h"
75 #include "content/browser/speech/speech_recognition_manager_impl.h" 75 #include "content/browser/speech/speech_recognition_manager_impl.h"
76 #include "content/browser/startup_task_runner.h" 76 #include "content/browser/startup_task_runner.h"
77 #include "content/browser/utility_process_host_impl.h" 77 #include "content/browser/utility_process_host_impl.h"
78 #include "content/browser/webui/content_web_ui_controller_factory.h" 78 #include "content/browser/webui/content_web_ui_controller_factory.h"
79 #include "content/browser/webui/url_data_manager.h" 79 #include "content/browser/webui/url_data_manager.h"
80 #include "content/common/content_switches_internal.h" 80 #include "content/common/content_switches_internal.h"
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 base::CommandLine::ForCurrentProcess(); 861 base::CommandLine::ForCurrentProcess();
862 // Note that we do not initialize a new FeatureList when calling this for 862 // Note that we do not initialize a new FeatureList when calling this for
863 // the second time. 863 // the second time.
864 base::FeatureList::InitializeInstance( 864 base::FeatureList::InitializeInstance(
865 command_line->GetSwitchValueASCII(switches::kEnableFeatures), 865 command_line->GetSwitchValueASCII(switches::kEnableFeatures),
866 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); 866 command_line->GetSwitchValueASCII(switches::kDisableFeatures));
867 867
868 InitializeMemoryManagementComponent(); 868 InitializeMemoryManagementComponent();
869 869
870 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) 870 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator))
871 MemoryCoordinator::GetInstance()->Start(); 871 MemoryCoordinatorImpl::GetInstance()->Start();
872 872
873 #if BUILDFLAG(ENABLE_PLUGINS) 873 #if BUILDFLAG(ENABLE_PLUGINS)
874 // Prior to any processing happening on the IO thread, we create the 874 // Prior to any processing happening on the IO thread, we create the
875 // plugin service as it is predominantly used from the IO thread, 875 // plugin service as it is predominantly used from the IO thread,
876 // but must be created on the main thread. The service ctor is 876 // but must be created on the main thread. The service ctor is
877 // inexpensive and does not invoke the io_thread() accessor. 877 // inexpensive and does not invoke the io_thread() accessor.
878 { 878 {
879 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); 879 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService");
880 PluginService::GetInstance()->Init(); 880 PluginService::GetInstance()->Init();
881 } 881 }
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 CreateWinMemoryPressureMonitor(parsed_command_line_); 1616 CreateWinMemoryPressureMonitor(parsed_command_line_);
1617 #endif 1617 #endif
1618 1618
1619 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { 1619 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) {
1620 // Disable MemoryPressureListener when memory coordinator is enabled. 1620 // Disable MemoryPressureListener when memory coordinator is enabled.
1621 base::MemoryPressureListener::SetNotificationsSuppressed(true); 1621 base::MemoryPressureListener::SetNotificationsSuppressed(true);
1622 // base::Unretained is safe because the lifetime of MemoryCoordinator is 1622 // base::Unretained is safe because the lifetime of MemoryCoordinator is
1623 // tied to the lifetime of the browser process. 1623 // tied to the lifetime of the browser process.
1624 base::MemoryCoordinatorProxy::GetInstance()-> 1624 base::MemoryCoordinatorProxy::GetInstance()->
1625 SetGetCurrentMemoryStateCallback(base::Bind( 1625 SetGetCurrentMemoryStateCallback(base::Bind(
1626 &MemoryCoordinator::GetCurrentMemoryState, 1626 &MemoryCoordinatorImpl::GetCurrentMemoryState,
1627 base::Unretained(MemoryCoordinator::GetInstance()))); 1627 base::Unretained(MemoryCoordinatorImpl::GetInstance())));
1628 base::MemoryCoordinatorProxy::GetInstance()-> 1628 base::MemoryCoordinatorProxy::GetInstance()->
1629 SetSetCurrentMemoryStateForTestingCallback(base::Bind( 1629 SetSetCurrentMemoryStateForTestingCallback(base::Bind(
1630 &MemoryCoordinator::SetCurrentMemoryStateForTesting, 1630 &MemoryCoordinatorImpl::SetCurrentMemoryStateForTesting,
1631 base::Unretained(MemoryCoordinator::GetInstance()))); 1631 base::Unretained(MemoryCoordinatorImpl::GetInstance())));
1632 1632
1633 if (memory_pressure_monitor_) { 1633 if (memory_pressure_monitor_) {
1634 memory_pressure_monitor_->SetDispatchCallback( 1634 memory_pressure_monitor_->SetDispatchCallback(
1635 base::Bind(&MemoryCoordinator::RecordMemoryPressure, 1635 base::Bind(&MemoryCoordinatorImpl::RecordMemoryPressure,
1636 base::Unretained(MemoryCoordinator::GetInstance()))); 1636 base::Unretained(MemoryCoordinatorImpl::GetInstance())));
1637 } 1637 }
1638 } 1638 }
1639 } 1639 }
1640 1640
1641 bool BrowserMainLoop::InitializeToolkit() { 1641 bool BrowserMainLoop::InitializeToolkit() {
1642 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); 1642 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit");
1643 1643
1644 // TODO(evan): this function is rather subtle, due to the variety 1644 // TODO(evan): this function is rather subtle, due to the variety
1645 // of intersecting ifdefs we have. To keep it easy to follow, there 1645 // of intersecting ifdefs we have. To keep it easy to follow, there
1646 // are no #else branches on any #ifs. 1646 // are no #else branches on any #ifs.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 if (!audio_manager_) { 1793 if (!audio_manager_) {
1794 audio_thread_ = base::MakeUnique<AudioManagerThread>(); 1794 audio_thread_ = base::MakeUnique<AudioManagerThread>();
1795 audio_manager_ = media::AudioManager::Create( 1795 audio_manager_ = media::AudioManager::Create(
1796 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), 1796 audio_thread_->task_runner(), audio_thread_->worker_task_runner(),
1797 MediaInternals::GetInstance()); 1797 MediaInternals::GetInstance());
1798 } 1798 }
1799 CHECK(audio_manager_); 1799 CHECK(audio_manager_);
1800 } 1800 }
1801 1801
1802 } // namespace content 1802 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/dom_storage/dom_storage_context_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698