Chromium Code Reviews| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); | 488 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); |
| 489 } | 489 } |
| 490 | 490 |
| 491 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 491 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
| 492 trace_memory_controller_.reset(new base::debug::TraceMemoryController( | 492 trace_memory_controller_.reset(new base::debug::TraceMemoryController( |
| 493 base::MessageLoop::current()->message_loop_proxy(), | 493 base::MessageLoop::current()->message_loop_proxy(), |
| 494 ::HeapProfilerWithPseudoStackStart, | 494 ::HeapProfilerWithPseudoStackStart, |
| 495 ::HeapProfilerStop, | 495 ::HeapProfilerStop, |
| 496 ::GetHeapProfile)); | 496 ::GetHeapProfile)); |
| 497 #endif | 497 #endif |
| 498 | |
| 499 system_stats_monitor_.reset(new base::debug::TraceEventSystemStatsMonitor( | |
| 500 base::MessageLoop::current()->message_loop_proxy())); | |
|
darin (slow to review)
2013/09/12 20:51:15
nit: New code should really be using base::ThreadT
jwmak
2013/09/13 20:57:11
Done.
| |
| 498 } | 501 } |
| 499 | 502 |
| 500 int BrowserMainLoop::PreCreateThreads() { | 503 int BrowserMainLoop::PreCreateThreads() { |
| 501 | 504 |
| 502 if (parts_) { | 505 if (parts_) { |
| 503 TRACE_EVENT0("startup", | 506 TRACE_EVENT0("startup", |
| 504 "BrowserMainLoop::CreateThreads:PreCreateThreads"); | 507 "BrowserMainLoop::CreateThreads:PreCreateThreads"); |
| 505 result_code_ = parts_->PreCreateThreads(); | 508 result_code_ = parts_->PreCreateThreads(); |
| 506 } | 509 } |
| 507 | 510 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 708 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 711 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
| 709 true)); | 712 true)); |
| 710 | 713 |
| 711 if (parts_) { | 714 if (parts_) { |
| 712 TRACE_EVENT0("shutdown", | 715 TRACE_EVENT0("shutdown", |
| 713 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 716 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
| 714 parts_->PostMainMessageLoopRun(); | 717 parts_->PostMainMessageLoopRun(); |
| 715 } | 718 } |
| 716 | 719 |
| 717 trace_memory_controller_.reset(); | 720 trace_memory_controller_.reset(); |
| 721 system_stats_monitor_.reset(); | |
| 718 | 722 |
| 719 #if !defined(OS_IOS) | 723 #if !defined(OS_IOS) |
| 720 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 724 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
| 721 // delete related objects on the GPU thread. This must be done before | 725 // delete related objects on the GPU thread. This must be done before |
| 722 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 726 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
| 723 // processes so this has to happen before stopping the IO thread. | 727 // processes so this has to happen before stopping the IO thread. |
| 724 { | 728 { |
| 725 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); | 729 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); |
| 726 GpuProcessHostUIShim::DestroyAll(); | 730 GpuProcessHostUIShim::DestroyAll(); |
| 727 } | 731 } |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1035 if (parameters_.ui_task) | 1039 if (parameters_.ui_task) |
| 1036 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 1040 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 1037 *parameters_.ui_task); | 1041 *parameters_.ui_task); |
| 1038 | 1042 |
| 1039 base::RunLoop run_loop; | 1043 base::RunLoop run_loop; |
| 1040 run_loop.Run(); | 1044 run_loop.Run(); |
| 1041 #endif | 1045 #endif |
| 1042 } | 1046 } |
| 1043 | 1047 |
| 1044 } // namespace content | 1048 } // namespace content |
| OLD | NEW |