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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } | 342 } |
343 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) | 343 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) |
344 | 344 |
345 // Handle special case of zero child processes by immediately flushing the | 345 // Handle special case of zero child processes by immediately flushing the |
346 // trace log. Once the flush has completed the caller will be notified that | 346 // trace log. Once the flush has completed the caller will be notified that |
347 // tracing has ended. | 347 // tracing has ended. |
348 if (pending_disable_recording_ack_count_ == 1) { | 348 if (pending_disable_recording_ack_count_ == 1) { |
349 // Flush asynchronously now, because we don't have any children to wait for. | 349 // Flush asynchronously now, because we don't have any children to wait for. |
350 TraceLog::GetInstance()->Flush( | 350 TraceLog::GetInstance()->Flush( |
351 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, | 351 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, |
352 base::Unretained(this)), | 352 base::Unretained(this))); |
353 true); | |
354 } | 353 } |
355 | 354 |
356 // Notify all child processes. | 355 // Notify all child processes. |
357 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); | 356 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); |
358 it != trace_message_filters_.end(); ++it) { | 357 it != trace_message_filters_.end(); ++it) { |
359 it->get()->SendEndTracing(); | 358 it->get()->SendEndTracing(); |
360 } | 359 } |
361 } | 360 } |
362 | 361 |
363 bool TracingControllerImpl::EnableMonitoring( | 362 bool TracingControllerImpl::EnableMonitoring( |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // The response from the specified message filter has already been received. | 674 // The response from the specified message filter has already been received. |
676 return; | 675 return; |
677 } | 676 } |
678 | 677 |
679 if (--pending_disable_recording_ack_count_ == 1) { | 678 if (--pending_disable_recording_ack_count_ == 1) { |
680 // All acks from subprocesses have been received. Now flush the local trace. | 679 // All acks from subprocesses have been received. Now flush the local trace. |
681 // During or after this call, our OnLocalTraceDataCollected will be | 680 // During or after this call, our OnLocalTraceDataCollected will be |
682 // called with the last of the local trace data. | 681 // called with the last of the local trace data. |
683 TraceLog::GetInstance()->Flush( | 682 TraceLog::GetInstance()->Flush( |
684 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, | 683 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, |
685 base::Unretained(this)), | 684 base::Unretained(this))); |
686 true); | |
687 return; | 685 return; |
688 } | 686 } |
689 | 687 |
690 if (pending_disable_recording_ack_count_ != 0) | 688 if (pending_disable_recording_ack_count_ != 0) |
691 return; | 689 return; |
692 | 690 |
693 // All acks (including from the subprocesses and the local trace) have been | 691 // All acks (including from the subprocesses and the local trace) have been |
694 // received. | 692 // received. |
695 is_recording_ = false; | 693 is_recording_ = false; |
696 | 694 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 is_monitoring_ = is_monitoring; | 883 is_monitoring_ = is_monitoring; |
886 #if !defined(OS_ANDROID) | 884 #if !defined(OS_ANDROID) |
887 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 885 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
888 it != tracing_uis_.end(); it++) { | 886 it != tracing_uis_.end(); it++) { |
889 (*it)->OnMonitoringStateChanged(is_monitoring); | 887 (*it)->OnMonitoringStateChanged(is_monitoring); |
890 } | 888 } |
891 #endif | 889 #endif |
892 } | 890 } |
893 | 891 |
894 } // namespace content | 892 } // namespace content |
OLD | NEW |