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

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

Issue 2741203002: memory-infra: Finish moving to Mojo (3nd attempt) (Closed)
Patch Set: nit Created 3 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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #include "media/audio/audio_system_impl.h" 96 #include "media/audio/audio_system_impl.h"
97 #include "media/base/media.h" 97 #include "media/base/media.h"
98 #include "media/base/user_input_monitor.h" 98 #include "media/base/user_input_monitor.h"
99 #include "media/midi/midi_service.h" 99 #include "media/midi/midi_service.h"
100 #include "mojo/edk/embedder/embedder.h" 100 #include "mojo/edk/embedder/embedder.h"
101 #include "mojo/edk/embedder/scoped_ipc_support.h" 101 #include "mojo/edk/embedder/scoped_ipc_support.h"
102 #include "net/base/network_change_notifier.h" 102 #include "net/base/network_change_notifier.h"
103 #include "net/socket/client_socket_factory.h" 103 #include "net/socket/client_socket_factory.h"
104 #include "net/ssl/ssl_config_service.h" 104 #include "net/ssl/ssl_config_service.h"
105 #include "ppapi/features/features.h" 105 #include "ppapi/features/features.h"
106 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
106 #include "services/service_manager/runner/common/client_util.h" 107 #include "services/service_manager/runner/common/client_util.h"
107 #include "skia/ext/event_tracer_impl.h" 108 #include "skia/ext/event_tracer_impl.h"
108 #include "skia/ext/skia_memory_dump_provider.h" 109 #include "skia/ext/skia_memory_dump_provider.h"
109 #include "sql/sql_memory_dump_provider.h" 110 #include "sql/sql_memory_dump_provider.h"
110 #include "ui/base/clipboard/clipboard.h" 111 #include "ui/base/clipboard/clipboard.h"
111 #include "ui/gfx/switches.h" 112 #include "ui/gfx/switches.h"
112 113
113 #if defined(USE_AURA) || defined(OS_MACOSX) 114 #if defined(USE_AURA) || defined(OS_MACOSX)
114 #include "content/browser/compositor/image_transport_factory.h" 115 #include "content/browser/compositor/image_transport_factory.h"
115 #endif 116 #endif
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 g_current_browser_main_loop = NULL; 573 g_current_browser_main_loop = NULL;
573 } 574 }
574 575
575 void BrowserMainLoop::Init() { 576 void BrowserMainLoop::Init() {
576 TRACE_EVENT0("startup", "BrowserMainLoop::Init"); 577 TRACE_EVENT0("startup", "BrowserMainLoop::Init");
577 578
578 parts_.reset( 579 parts_.reset(
579 GetContentClient()->browser()->CreateBrowserMainParts(parameters_)); 580 GetContentClient()->browser()->CreateBrowserMainParts(parameters_));
580 } 581 }
581 582
583 // BrowserMainLoop static getters =========================================
584
585 // static
586 memory_instrumentation::CoordinatorImpl*
587 BrowserMainLoop::GetMemoryInstrumentationCoordinator() {
588 if (g_current_browser_main_loop)
589 return g_current_browser_main_loop->memory_instrumentation_coordinator();
590 return nullptr;
591 }
592
582 // BrowserMainLoop stages ================================================== 593 // BrowserMainLoop stages ==================================================
583 594
584 void BrowserMainLoop::EarlyInitialization() { 595 void BrowserMainLoop::EarlyInitialization() {
585 TRACE_EVENT0("startup", "BrowserMainLoop::EarlyInitialization"); 596 TRACE_EVENT0("startup", "BrowserMainLoop::EarlyInitialization");
586 597
587 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 598 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
588 // No thread should be created before this call, as SetupSandbox() 599 // No thread should be created before this call, as SetupSandbox()
589 // will end-up using fork(). 600 // will end-up using fork().
590 SetupSandbox(parsed_command_line_); 601 SetupSandbox(parsed_command_line_);
591 #endif 602 #endif
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 831 }
821 832
822 if (parsed_command_line_.HasSwitch( 833 if (parsed_command_line_.HasSwitch(
823 switches::kEnableAggressiveDOMStorageFlushing)) { 834 switches::kEnableAggressiveDOMStorageFlushing)) {
824 TRACE_EVENT0("startup", 835 TRACE_EVENT0("startup",
825 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay"); 836 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay");
826 DOMStorageArea::EnableAggressiveCommitDelay(); 837 DOMStorageArea::EnableAggressiveCommitDelay();
827 LevelDBWrapperImpl::EnableAggressiveCommitDelay(); 838 LevelDBWrapperImpl::EnableAggressiveCommitDelay();
828 } 839 }
829 840
841 // Create the memory instrumentation service. It will initialize the memory
842 // dump manager, too. It makes sense that BrowserMainLoop owns the service;
843 // this way, the service is alive for the lifetime of Mojo. Mojo is shutdown
844 // in BrowserMainLoop::ShutdownThreadsAndCleanupIO.
845 memory_instrumentation_coordinator_ =
846 base::MakeUnique<memory_instrumentation::CoordinatorImpl>(true);
Primiano Tucci (use gerrit) 2017/03/13 21:31:10 maybe add a comment to: true /* is_coordinator*/
chiniforooshan 2017/03/14 16:06:36 Done.
847
830 // Enable memory-infra dump providers. 848 // Enable memory-infra dump providers.
831 InitSkiaEventTracer(); 849 InitSkiaEventTracer();
832 tracing::ProcessMetricsMemoryDumpProvider::RegisterForProcess( 850 tracing::ProcessMetricsMemoryDumpProvider::RegisterForProcess(
833 base::kNullProcessId); 851 base::kNullProcessId);
834 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 852 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
835 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); 853 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr);
836 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 854 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
837 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); 855 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr);
838 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 856 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
839 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); 857 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr);
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 1799 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
1782 MediaInternals::GetInstance()); 1800 MediaInternals::GetInstance());
1783 } 1801 }
1784 CHECK(audio_manager_); 1802 CHECK(audio_manager_);
1785 1803
1786 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); 1804 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
1787 CHECK(audio_system_); 1805 CHECK(audio_system_);
1788 } 1806 }
1789 1807
1790 } // namespace content 1808 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698