| 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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 } | 898 } |
| 899 | 899 |
| 900 // If the UI thread blocks, the whole UI is unresponsive. | 900 // If the UI thread blocks, the whole UI is unresponsive. |
| 901 // Do not allow disk IO from the UI thread. | 901 // Do not allow disk IO from the UI thread. |
| 902 base::ThreadRestrictions::SetIOAllowed(false); | 902 base::ThreadRestrictions::SetIOAllowed(false); |
| 903 base::ThreadRestrictions::DisallowWaiting(); | 903 base::ThreadRestrictions::DisallowWaiting(); |
| 904 return result_code_; | 904 return result_code_; |
| 905 } | 905 } |
| 906 | 906 |
| 907 void BrowserMainLoop::RunMainMessageLoopParts() { | 907 void BrowserMainLoop::RunMainMessageLoopParts() { |
| 908 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); | 908 // Don't use the TRACE_EVENT0 macro because the tracing infrastructure doesn't |
| 909 // expect synchronous events around the main loop of a thread. |
| 910 TRACE_EVENT_ASYNC_BEGIN0("toplevel", "BrowserMain:MESSAGE_LOOP", this); |
| 909 | 911 |
| 910 bool ran_main_loop = false; | 912 bool ran_main_loop = false; |
| 911 if (parts_) | 913 if (parts_) |
| 912 ran_main_loop = parts_->MainMessageLoopRun(&result_code_); | 914 ran_main_loop = parts_->MainMessageLoopRun(&result_code_); |
| 913 | 915 |
| 914 if (!ran_main_loop) | 916 if (!ran_main_loop) |
| 915 MainMessageLoopRun(); | 917 MainMessageLoopRun(); |
| 916 | 918 |
| 917 TRACE_EVENT_END_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); | 919 TRACE_EVENT_ASYNC_END0("toplevel", "BrowserMain:MESSAGE_LOOP", this); |
| 918 } | 920 } |
| 919 | 921 |
| 920 void BrowserMainLoop::ShutdownThreadsAndCleanUp() { | 922 void BrowserMainLoop::ShutdownThreadsAndCleanUp() { |
| 921 if (!created_threads_) { | 923 if (!created_threads_) { |
| 922 // Called early, nothing to do | 924 // Called early, nothing to do |
| 923 return; | 925 return; |
| 924 } | 926 } |
| 925 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); | 927 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); |
| 926 | 928 |
| 927 // Teardown may start in PostMainMessageLoopRun, and during teardown we | 929 // Teardown may start in PostMainMessageLoopRun, and during teardown we |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 DCHECK(is_tracing_startup_for_duration_); | 1408 DCHECK(is_tracing_startup_for_duration_); |
| 1407 | 1409 |
| 1408 is_tracing_startup_for_duration_ = false; | 1410 is_tracing_startup_for_duration_ = false; |
| 1409 TracingController::GetInstance()->DisableRecording( | 1411 TracingController::GetInstance()->DisableRecording( |
| 1410 TracingController::CreateFileSink( | 1412 TracingController::CreateFileSink( |
| 1411 startup_trace_file_, | 1413 startup_trace_file_, |
| 1412 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1414 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1413 } | 1415 } |
| 1414 | 1416 |
| 1415 } // namespace content | 1417 } // namespace content |
| OLD | NEW |