Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: content/browser/tracing/tracing_controller_impl.cc

Issue 874543003: Add support for TraceEvent before the native library is loaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 #if defined(OS_ANDROID) 312 #if defined(OS_ANDROID)
313 if (pending_get_categories_done_callback_.is_null()) 313 if (pending_get_categories_done_callback_.is_null())
314 TraceLog::GetInstance()->AddClockSyncMetadataEvent(); 314 TraceLog::GetInstance()->AddClockSyncMetadataEvent();
315 #endif 315 #endif
316 316
317 // Count myself (local trace) in pending_disable_recording_ack_count_, 317 // Count myself (local trace) in pending_disable_recording_ack_count_,
318 // acked below. 318 // acked below.
319 pending_disable_recording_ack_count_ = trace_message_filters_.size() + 1; 319 pending_disable_recording_ack_count_ = trace_message_filters_.size() + 1;
320 pending_disable_recording_filters_ = trace_message_filters_; 320 pending_disable_recording_filters_ = trace_message_filters_;
321 321
322 if (!disable_recording_callback_.is_null())
323 disable_recording_callback_.Run(TraceLog::GetInstance());
324
322 #if defined(OS_CHROMEOS) || defined(OS_WIN) 325 #if defined(OS_CHROMEOS) || defined(OS_WIN)
323 if (is_system_tracing_) { 326 if (is_system_tracing_) {
324 // Disable system tracing. 327 // Disable system tracing.
325 is_system_tracing_ = false; 328 is_system_tracing_ = false;
326 ++pending_disable_recording_ack_count_; 329 ++pending_disable_recording_ack_count_;
327 330
328 #if defined(OS_CHROMEOS) 331 #if defined(OS_CHROMEOS)
329 scoped_refptr<base::TaskRunner> task_runner = 332 scoped_refptr<base::TaskRunner> task_runner =
330 BrowserThread::GetBlockingPool(); 333 BrowserThread::GetBlockingPool();
331 chromeos::DBusThreadManager::Get() 334 chromeos::DBusThreadManager::Get()
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 DCHECK(tracing_uis_.find(tracing_ui) == tracing_uis_.end()); 872 DCHECK(tracing_uis_.find(tracing_ui) == tracing_uis_.end());
870 tracing_uis_.insert(tracing_ui); 873 tracing_uis_.insert(tracing_ui);
871 } 874 }
872 875
873 void TracingControllerImpl::UnregisterTracingUI(TracingUI* tracing_ui) { 876 void TracingControllerImpl::UnregisterTracingUI(TracingUI* tracing_ui) {
874 std::set<TracingUI*>::iterator it = tracing_uis_.find(tracing_ui); 877 std::set<TracingUI*>::iterator it = tracing_uis_.find(tracing_ui);
875 DCHECK(it != tracing_uis_.end()); 878 DCHECK(it != tracing_uis_.end());
876 tracing_uis_.erase(it); 879 tracing_uis_.erase(it);
877 } 880 }
878 881
882 void TracingControllerImpl::SetDisableRecordingCallback(
883 const DisableRecordingCallback& callback) {
884 disable_recording_callback_ = callback;
885 }
886
879 void TracingControllerImpl::OnMonitoringStateChanged(bool is_monitoring) { 887 void TracingControllerImpl::OnMonitoringStateChanged(bool is_monitoring) {
880 if (is_monitoring_ == is_monitoring) 888 if (is_monitoring_ == is_monitoring)
881 return; 889 return;
882 890
883 is_monitoring_ = is_monitoring; 891 is_monitoring_ = is_monitoring;
884 #if !defined(OS_ANDROID) 892 #if !defined(OS_ANDROID)
885 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); 893 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin();
886 it != tracing_uis_.end(); it++) { 894 it != tracing_uis_.end(); it++) {
887 (*it)->OnMonitoringStateChanged(is_monitoring); 895 (*it)->OnMonitoringStateChanged(is_monitoring);
888 } 896 }
889 #endif 897 #endif
890 } 898 }
891 899
892 } // namespace content 900 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698