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/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.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); |
353 } | 354 } |
354 | 355 |
355 // Notify all child processes. | 356 // Notify all child processes. |
356 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); | 357 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); |
357 it != trace_message_filters_.end(); ++it) { | 358 it != trace_message_filters_.end(); ++it) { |
358 it->get()->SendEndTracing(); | 359 it->get()->SendEndTracing(); |
359 } | 360 } |
360 } | 361 } |
361 | 362 |
362 bool TracingControllerImpl::EnableMonitoring( | 363 bool TracingControllerImpl::EnableMonitoring( |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // The response from the specified message filter has already been received. | 676 // The response from the specified message filter has already been received. |
676 return; | 677 return; |
677 } | 678 } |
678 | 679 |
679 if (--pending_disable_recording_ack_count_ == 1) { | 680 if (--pending_disable_recording_ack_count_ == 1) { |
680 // All acks from subprocesses have been received. Now flush the local trace. | 681 // All acks from subprocesses have been received. Now flush the local trace. |
681 // During or after this call, our OnLocalTraceDataCollected will be | 682 // During or after this call, our OnLocalTraceDataCollected will be |
682 // called with the last of the local trace data. | 683 // called with the last of the local trace data. |
683 TraceLog::GetInstance()->Flush( | 684 TraceLog::GetInstance()->Flush( |
684 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, | 685 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, |
685 base::Unretained(this))); | 686 base::Unretained(this)), |
| 687 true); |
686 return; | 688 return; |
687 } | 689 } |
688 | 690 |
689 if (pending_disable_recording_ack_count_ != 0) | 691 if (pending_disable_recording_ack_count_ != 0) |
690 return; | 692 return; |
691 | 693 |
692 // All acks (including from the subprocesses and the local trace) have been | 694 // All acks (including from the subprocesses and the local trace) have been |
693 // received. | 695 // received. |
694 is_recording_ = false; | 696 is_recording_ = false; |
695 | 697 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 is_monitoring_ = is_monitoring; | 886 is_monitoring_ = is_monitoring; |
885 #if !defined(OS_ANDROID) | 887 #if !defined(OS_ANDROID) |
886 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 888 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
887 it != tracing_uis_.end(); it++) { | 889 it != tracing_uis_.end(); it++) { |
888 (*it)->OnMonitoringStateChanged(is_monitoring); | 890 (*it)->OnMonitoringStateChanged(is_monitoring); |
889 } | 891 } |
890 #endif | 892 #endif |
891 } | 893 } |
892 | 894 |
893 } // namespace content | 895 } // namespace content |
OLD | NEW |