| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/tracing/tracing_controller_impl.h" | 4 #include "content/browser/tracing/tracing_controller_impl.h" |
| 5 | 5 |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/cpu.h" | 7 #include "base/cpu.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 // Stop tracing only if all agents report back. | 906 // Stop tracing only if all agents report back. |
| 907 if(--pending_clock_sync_ack_count_ == 0) { | 907 if(--pending_clock_sync_ack_count_ == 0) { |
| 908 clock_sync_timer_.Stop(); | 908 clock_sync_timer_.Stop(); |
| 909 StopTracingAfterClockSync(); | 909 StopTracingAfterClockSync(); |
| 910 } | 910 } |
| 911 } | 911 } |
| 912 | 912 |
| 913 void TracingControllerImpl::RequestGlobalMemoryDump( | 913 void TracingControllerImpl::RequestGlobalMemoryDump( |
| 914 const base::trace_event::MemoryDumpRequestArgs& args, | 914 const base::trace_event::MemoryDumpRequestArgs& args, |
| 915 const base::trace_event::MemoryDumpCallback& callback) { | 915 const base::trace_event::MemoryDumpCallback& callback) { |
| 916 if (!base::trace_event::MemoryDumpManager::GetInstance()->IsDumpModeAllowed( |
| 917 args.level_of_detail)) |
| 918 return; |
| 919 |
| 916 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 920 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 917 BrowserThread::PostTask( | 921 BrowserThread::PostTask( |
| 918 BrowserThread::UI, FROM_HERE, | 922 BrowserThread::UI, FROM_HERE, |
| 919 base::Bind(&TracingControllerImpl::RequestGlobalMemoryDump, | 923 base::Bind(&TracingControllerImpl::RequestGlobalMemoryDump, |
| 920 base::Unretained(this), args, callback)); | 924 base::Unretained(this), args, callback)); |
| 921 return; | 925 return; |
| 922 } | 926 } |
| 923 // Abort if another dump is already in progress. | 927 // Abort if another dump is already in progress. |
| 924 if (pending_memory_dump_guid_) { | 928 if (pending_memory_dump_guid_) { |
| 925 DVLOG(1) << "Requested memory dump " << args.dump_guid | 929 DVLOG(1) << "Requested memory dump " << args.dump_guid |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 const bool global_success = failed_memory_dump_count_ == 0; | 1030 const bool global_success = failed_memory_dump_count_ == 0; |
| 1027 if (!pending_memory_dump_callback_.is_null()) { | 1031 if (!pending_memory_dump_callback_.is_null()) { |
| 1028 pending_memory_dump_callback_.Run(pending_memory_dump_guid_, | 1032 pending_memory_dump_callback_.Run(pending_memory_dump_guid_, |
| 1029 global_success); | 1033 global_success); |
| 1030 pending_memory_dump_callback_.Reset(); | 1034 pending_memory_dump_callback_.Reset(); |
| 1031 } | 1035 } |
| 1032 pending_memory_dump_guid_ = 0; | 1036 pending_memory_dump_guid_ = 0; |
| 1033 } | 1037 } |
| 1034 | 1038 |
| 1035 } // namespace content | 1039 } // namespace content |
| OLD | NEW |