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/logging.h" | 10 #include "base/logging.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 SurfaceTexturePeer::InitInstance(new SurfaceTexturePeerBrowserImpl()); | 467 SurfaceTexturePeer::InitInstance(new SurfaceTexturePeerBrowserImpl()); |
468 } | 468 } |
469 #endif | 469 #endif |
470 | 470 |
471 if (parsed_command_line_.HasSwitch(switches::kMemoryMetrics)) { | 471 if (parsed_command_line_.HasSwitch(switches::kMemoryMetrics)) { |
472 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MemoryObserver") | 472 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MemoryObserver") |
473 memory_observer_.reset(new MemoryObserver()); | 473 memory_observer_.reset(new MemoryObserver()); |
474 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); | 474 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); |
475 } | 475 } |
476 | 476 |
| 477 trace_system_controller_.reset(new base::debug::TraceSystemController( |
| 478 base::MessageLoop::current()->message_loop_proxy())); |
477 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 479 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
478 trace_memory_controller_.reset(new base::debug::TraceMemoryController( | 480 trace_memory_controller_.reset(new base::debug::TraceMemoryController( |
479 base::MessageLoop::current()->message_loop_proxy(), | 481 base::MessageLoop::current()->message_loop_proxy(), |
480 ::HeapProfilerWithPseudoStackStart, | 482 ::HeapProfilerWithPseudoStackStart, |
481 ::HeapProfilerStop, | 483 ::HeapProfilerStop, |
482 ::GetHeapProfile)); | 484 ::GetHeapProfile)); |
483 #endif | 485 #endif |
484 } | 486 } |
485 | 487 |
486 void BrowserMainLoop::CreateThreads() { | 488 void BrowserMainLoop::CreateThreads() { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 base::ThreadRestrictions::SetIOAllowed(true); | 637 base::ThreadRestrictions::SetIOAllowed(true); |
636 BrowserThread::PostTask( | 638 BrowserThread::PostTask( |
637 BrowserThread::IO, FROM_HERE, | 639 BrowserThread::IO, FROM_HERE, |
638 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 640 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
639 true)); | 641 true)); |
640 | 642 |
641 if (parts_) | 643 if (parts_) |
642 parts_->PostMainMessageLoopRun(); | 644 parts_->PostMainMessageLoopRun(); |
643 | 645 |
644 trace_memory_controller_.reset(); | 646 trace_memory_controller_.reset(); |
| 647 trace_system_controller_.reset(); |
645 | 648 |
646 #if !defined(OS_IOS) | 649 #if !defined(OS_IOS) |
647 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 650 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
648 // delete related objects on the GPU thread. This must be done before | 651 // delete related objects on the GPU thread. This must be done before |
649 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 652 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
650 // processes so this has to happen before stopping the IO thread. | 653 // processes so this has to happen before stopping the IO thread. |
651 GpuProcessHostUIShim::DestroyAll(); | 654 GpuProcessHostUIShim::DestroyAll(); |
652 | 655 |
653 // Cancel pending requests and prevent new requests. | 656 // Cancel pending requests and prevent new requests. |
654 if (resource_dispatcher_host_) | 657 if (resource_dispatcher_host_) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 if (parameters_.ui_task) | 904 if (parameters_.ui_task) |
902 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 905 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
903 *parameters_.ui_task); | 906 *parameters_.ui_task); |
904 | 907 |
905 base::RunLoop run_loop; | 908 base::RunLoop run_loop; |
906 run_loop.Run(); | 909 run_loop.Run(); |
907 #endif | 910 #endif |
908 } | 911 } |
909 | 912 |
910 } // namespace content | 913 } // namespace content |
OLD | NEW |