| 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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 it == pending_memory_dump_filters_.end()) { | 994 it == pending_memory_dump_filters_.end()) { |
| 995 DLOG(WARNING) << "Received unexpected memory dump response: " << dump_guid; | 995 DLOG(WARNING) << "Received unexpected memory dump response: " << dump_guid; |
| 996 return; | 996 return; |
| 997 } | 997 } |
| 998 | 998 |
| 999 DCHECK_GT(pending_memory_dump_ack_count_, 0); | 999 DCHECK_GT(pending_memory_dump_ack_count_, 0); |
| 1000 --pending_memory_dump_ack_count_; | 1000 --pending_memory_dump_ack_count_; |
| 1001 pending_memory_dump_filters_.erase(it); | 1001 pending_memory_dump_filters_.erase(it); |
| 1002 if (!success) { | 1002 if (!success) { |
| 1003 ++failed_memory_dump_count_; | 1003 ++failed_memory_dump_count_; |
| 1004 DLOG(WARNING) << "Global memory dump failed because of NACK from child " | 1004 VLOG(1) << "Global memory dump failed because of NACK from child " |
| 1005 << trace_message_filter->peer_pid(); | 1005 << trace_message_filter->peer_pid(); |
| 1006 } | 1006 } |
| 1007 FinalizeGlobalMemoryDumpIfAllProcessesReplied(); | 1007 FinalizeGlobalMemoryDumpIfAllProcessesReplied(); |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 void TracingControllerImpl::OnBrowserProcessMemoryDumpDone(uint64_t dump_guid, | 1010 void TracingControllerImpl::OnBrowserProcessMemoryDumpDone(uint64_t dump_guid, |
| 1011 bool success) { | 1011 bool success) { |
| 1012 DCHECK_GT(pending_memory_dump_ack_count_, 0); | 1012 DCHECK_GT(pending_memory_dump_ack_count_, 0); |
| 1013 --pending_memory_dump_ack_count_; | 1013 --pending_memory_dump_ack_count_; |
| 1014 if (!success) { | 1014 if (!success) { |
| 1015 ++failed_memory_dump_count_; | 1015 ++failed_memory_dump_count_; |
| 1016 DLOG(WARNING) << "Global memory dump aborted on the current process"; | 1016 VLOG(1) << "Global memory dump aborted on the current process"; |
| 1017 } | 1017 } |
| 1018 FinalizeGlobalMemoryDumpIfAllProcessesReplied(); | 1018 FinalizeGlobalMemoryDumpIfAllProcessesReplied(); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 void TracingControllerImpl::FinalizeGlobalMemoryDumpIfAllProcessesReplied() { | 1021 void TracingControllerImpl::FinalizeGlobalMemoryDumpIfAllProcessesReplied() { |
| 1022 if (pending_memory_dump_ack_count_ > 0) | 1022 if (pending_memory_dump_ack_count_ > 0) |
| 1023 return; | 1023 return; |
| 1024 | 1024 |
| 1025 DCHECK_NE(0u, pending_memory_dump_guid_); | 1025 DCHECK_NE(0u, pending_memory_dump_guid_); |
| 1026 const bool global_success = failed_memory_dump_count_ == 0; | 1026 const bool global_success = failed_memory_dump_count_ == 0; |
| 1027 if (!pending_memory_dump_callback_.is_null()) { | 1027 if (!pending_memory_dump_callback_.is_null()) { |
| 1028 pending_memory_dump_callback_.Run(pending_memory_dump_guid_, | 1028 pending_memory_dump_callback_.Run(pending_memory_dump_guid_, |
| 1029 global_success); | 1029 global_success); |
| 1030 pending_memory_dump_callback_.Reset(); | 1030 pending_memory_dump_callback_.Reset(); |
| 1031 } | 1031 } |
| 1032 pending_memory_dump_guid_ = 0; | 1032 pending_memory_dump_guid_ = 0; |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 } // namespace content | 1035 } // namespace content |
| OLD | NEW |