OLD | NEW |
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 } | 692 } |
693 | 693 |
694 // Enable memory-infra dump providers. | 694 // Enable memory-infra dump providers. |
695 InitSkiaEventTracer(); | 695 InitSkiaEventTracer(); |
696 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 696 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
697 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); | 697 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); |
698 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 698 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
699 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); | 699 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); |
700 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 700 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
701 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); | 701 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); |
702 | |
703 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | |
704 trace_memory_controller_.reset(new base::trace_event::TraceMemoryController( | |
705 base::MessageLoop::current()->task_runner(), | |
706 ::HeapProfilerWithPseudoStackStart, ::HeapProfilerStop, | |
707 ::GetHeapProfile)); | |
708 #endif | |
709 } | 702 } |
710 | 703 |
711 int BrowserMainLoop::PreCreateThreads() { | 704 int BrowserMainLoop::PreCreateThreads() { |
712 if (parts_) { | 705 if (parts_) { |
713 TRACE_EVENT0("startup", | 706 TRACE_EVENT0("startup", |
714 "BrowserMainLoop::CreateThreads:PreCreateThreads"); | 707 "BrowserMainLoop::CreateThreads:PreCreateThreads"); |
715 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::PreCreateThreads"); | 708 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::PreCreateThreads"); |
716 | 709 |
717 result_code_ = parts_->PreCreateThreads(); | 710 result_code_ = parts_->PreCreateThreads(); |
718 } | 711 } |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 if (parts_) { | 993 if (parts_) { |
1001 TRACE_EVENT0("shutdown", | 994 TRACE_EVENT0("shutdown", |
1002 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 995 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
1003 parts_->PostMainMessageLoopRun(); | 996 parts_->PostMainMessageLoopRun(); |
1004 } | 997 } |
1005 | 998 |
1006 #if defined(USE_AURA) | 999 #if defined(USE_AURA) |
1007 aura::Env::DeleteInstance(); | 1000 aura::Env::DeleteInstance(); |
1008 #endif | 1001 #endif |
1009 | 1002 |
1010 trace_memory_controller_.reset(); | |
1011 system_stats_monitor_.reset(); | 1003 system_stats_monitor_.reset(); |
1012 | 1004 |
1013 #if !defined(OS_IOS) | 1005 #if !defined(OS_IOS) |
1014 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 1006 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
1015 // delete related objects on the GPU thread. This must be done before | 1007 // delete related objects on the GPU thread. This must be done before |
1016 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 1008 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
1017 // processes so this has to happen before stopping the IO thread. | 1009 // processes so this has to happen before stopping the IO thread. |
1018 { | 1010 { |
1019 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); | 1011 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); |
1020 GpuProcessHostUIShim::DestroyAll(); | 1012 GpuProcessHostUIShim::DestroyAll(); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 DCHECK(is_tracing_startup_for_duration_); | 1468 DCHECK(is_tracing_startup_for_duration_); |
1477 | 1469 |
1478 is_tracing_startup_for_duration_ = false; | 1470 is_tracing_startup_for_duration_ = false; |
1479 TracingController::GetInstance()->StopTracing( | 1471 TracingController::GetInstance()->StopTracing( |
1480 TracingController::CreateFileSink( | 1472 TracingController::CreateFileSink( |
1481 startup_trace_file_, | 1473 startup_trace_file_, |
1482 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1474 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1483 } | 1475 } |
1484 | 1476 |
1485 } // namespace content | 1477 } // namespace content |
OLD | NEW |