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

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

Issue 2741203002: memory-infra: Finish moving to Mojo (3nd attempt) (Closed)
Patch Set: review 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 (tracing::TraceConfigFile::GetInstance()->IsEnabled() && 564 (tracing::TraceConfigFile::GetInstance()->IsEnabled() &&
564 tracing::TraceConfigFile::GetInstance()->GetStartupDuration() > 0)) { 565 tracing::TraceConfigFile::GetInstance()->GetStartupDuration() > 0)) {
565 DCHECK(!g_current_browser_main_loop); 566 DCHECK(!g_current_browser_main_loop);
566 g_current_browser_main_loop = this; 567 g_current_browser_main_loop = this;
567 } 568 }
568 569
569 BrowserMainLoop::~BrowserMainLoop() { 570 BrowserMainLoop::~BrowserMainLoop() {
570 DCHECK_EQ(this, g_current_browser_main_loop); 571 DCHECK_EQ(this, g_current_browser_main_loop);
571 ui::Clipboard::DestroyClipboardForCurrentThread(); 572 ui::Clipboard::DestroyClipboardForCurrentThread();
572 g_current_browser_main_loop = NULL; 573 g_current_browser_main_loop = NULL;
574 memory_instrumentation::CoordinatorImpl::SetInstance(nullptr);
573 } 575 }
574 576
575 void BrowserMainLoop::Init() { 577 void BrowserMainLoop::Init() {
576 TRACE_EVENT0("startup", "BrowserMainLoop::Init"); 578 TRACE_EVENT0("startup", "BrowserMainLoop::Init");
577 579
578 parts_.reset( 580 parts_.reset(
579 GetContentClient()->browser()->CreateBrowserMainParts(parameters_)); 581 GetContentClient()->browser()->CreateBrowserMainParts(parameters_));
580 } 582 }
581 583
582 // BrowserMainLoop stages ================================================== 584 // BrowserMainLoop stages ==================================================
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 822 }
821 823
822 if (parsed_command_line_.HasSwitch( 824 if (parsed_command_line_.HasSwitch(
823 switches::kEnableAggressiveDOMStorageFlushing)) { 825 switches::kEnableAggressiveDOMStorageFlushing)) {
824 TRACE_EVENT0("startup", 826 TRACE_EVENT0("startup",
825 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay"); 827 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay");
826 DOMStorageArea::EnableAggressiveCommitDelay(); 828 DOMStorageArea::EnableAggressiveCommitDelay();
827 LevelDBWrapperImpl::EnableAggressiveCommitDelay(); 829 LevelDBWrapperImpl::EnableAggressiveCommitDelay();
828 } 830 }
829 831
832 // Create the memory instrumentation service. It will initialize the memory
833 // dump manager, too. It makes sense that BrowserMainLoop owns the service;
834 // this way, the service is alive for the lifetime of Mojo. Mojo is shutdown
835 // in BrowserMainLoop::ShutdownThreadsAndCleanupIO.
836 memory_instrumentation_coordinator_ =
837 base::MakeUnique<memory_instrumentation::CoordinatorImpl>(
838 true /* initialize_memory_dump_manager */);
839 memory_instrumentation::CoordinatorImpl::SetInstance(
840 memory_instrumentation_coordinator_.get());
841
830 // Enable memory-infra dump providers. 842 // Enable memory-infra dump providers.
831 InitSkiaEventTracer(); 843 InitSkiaEventTracer();
832 tracing::ProcessMetricsMemoryDumpProvider::RegisterForProcess( 844 tracing::ProcessMetricsMemoryDumpProvider::RegisterForProcess(
833 base::kNullProcessId); 845 base::kNullProcessId);
834 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 846 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
835 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); 847 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr);
836 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 848 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
837 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); 849 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr);
838 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 850 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
839 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); 851 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr);
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 1793 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE),
1782 MediaInternals::GetInstance()); 1794 MediaInternals::GetInstance());
1783 } 1795 }
1784 CHECK(audio_manager_); 1796 CHECK(audio_manager_);
1785 1797
1786 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); 1798 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
1787 CHECK(audio_system_); 1799 CHECK(audio_system_);
1788 } 1800 }
1789 1801
1790 } // namespace content 1802 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698