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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 // The response from the specified message filter has already been received. | 675 // The response from the specified message filter has already been received. |
675 return; | 676 return; |
676 } | 677 } |
677 | 678 |
678 if (--pending_disable_recording_ack_count_ == 1) { | 679 if (--pending_disable_recording_ack_count_ == 1) { |
679 // All acks from subprocesses have been received. Now flush the local trace. | 680 // All acks from subprocesses have been received. Now flush the local trace. |
680 // During or after this call, our OnLocalTraceDataCollected will be | 681 // During or after this call, our OnLocalTraceDataCollected will be |
681 // called with the last of the local trace data. | 682 // called with the last of the local trace data. |
682 TraceLog::GetInstance()->Flush( | 683 TraceLog::GetInstance()->Flush( |
683 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, | 684 base::Bind(&TracingControllerImpl::OnLocalTraceDataCollected, |
684 base::Unretained(this))); | 685 base::Unretained(this)), |
| 686 true); |
685 return; | 687 return; |
686 } | 688 } |
687 | 689 |
688 if (pending_disable_recording_ack_count_ != 0) | 690 if (pending_disable_recording_ack_count_ != 0) |
689 return; | 691 return; |
690 | 692 |
691 // All acks (including from the subprocesses and the local trace) have been | 693 // All acks (including from the subprocesses and the local trace) have been |
692 // received. | 694 // received. |
693 is_recording_ = false; | 695 is_recording_ = false; |
694 | 696 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 is_monitoring_ = is_monitoring; | 885 is_monitoring_ = is_monitoring; |
884 #if !defined(OS_ANDROID) | 886 #if !defined(OS_ANDROID) |
885 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 887 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
886 it != tracing_uis_.end(); it++) { | 888 it != tracing_uis_.end(); it++) { |
887 (*it)->OnMonitoringStateChanged(is_monitoring); | 889 (*it)->OnMonitoringStateChanged(is_monitoring); |
888 } | 890 } |
889 #endif | 891 #endif |
890 } | 892 } |
891 | 893 |
892 } // namespace content | 894 } // namespace content |
OLD | NEW |