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

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: Comments, cleanup and a JNI unittest. Created 5 years, 9 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
« no previous file with comments | « content/browser/tracing/tracing_controller_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 DCHECK(tracing_uis_.find(tracing_ui) == tracing_uis_.end()); 873 DCHECK(tracing_uis_.find(tracing_ui) == tracing_uis_.end());
871 tracing_uis_.insert(tracing_ui); 874 tracing_uis_.insert(tracing_ui);
872 } 875 }
873 876
874 void TracingControllerImpl::UnregisterTracingUI(TracingUI* tracing_ui) { 877 void TracingControllerImpl::UnregisterTracingUI(TracingUI* tracing_ui) {
875 std::set<TracingUI*>::iterator it = tracing_uis_.find(tracing_ui); 878 std::set<TracingUI*>::iterator it = tracing_uis_.find(tracing_ui);
876 DCHECK(it != tracing_uis_.end()); 879 DCHECK(it != tracing_uis_.end());
877 tracing_uis_.erase(it); 880 tracing_uis_.erase(it);
878 } 881 }
879 882
883 void TracingControllerImpl::SetDisableRecordingCallback(
884 const DisableRecordingCallback& callback) {
885 disable_recording_callback_ = callback;
886 }
887
880 void TracingControllerImpl::OnMonitoringStateChanged(bool is_monitoring) { 888 void TracingControllerImpl::OnMonitoringStateChanged(bool is_monitoring) {
881 if (is_monitoring_ == is_monitoring) 889 if (is_monitoring_ == is_monitoring)
882 return; 890 return;
883 891
884 is_monitoring_ = is_monitoring; 892 is_monitoring_ = is_monitoring;
885 #if !defined(OS_ANDROID) 893 #if !defined(OS_ANDROID)
886 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); 894 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin();
887 it != tracing_uis_.end(); it++) { 895 it != tracing_uis_.end(); it++) {
888 (*it)->OnMonitoringStateChanged(is_monitoring); 896 (*it)->OnMonitoringStateChanged(is_monitoring);
889 } 897 }
890 #endif 898 #endif
891 } 899 }
892 900
893 } // namespace content 901 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/tracing_controller_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698