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

Side by Side Diff: base/debug/trace_event_impl.h

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: Selectively enable startup tracing in ChromeShell. 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 4
5 5
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_
8 8
9 #include <stack> 9 #include <stack>
10 #include <string> 10 #include <string>
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // JSON. The callback can be null if the caller doesn't want any data. 537 // JSON. The callback can be null if the caller doesn't want any data.
538 // Due to the implementation of thread-local buffers, flush can't be 538 // Due to the implementation of thread-local buffers, flush can't be
539 // done when tracing is enabled. If called when tracing is enabled, the 539 // done when tracing is enabled. If called when tracing is enabled, the
540 // callback will be called directly with (empty_string, false) to indicate 540 // callback will be called directly with (empty_string, false) to indicate
541 // the end of this unsuccessful flush. 541 // the end of this unsuccessful flush.
542 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&, 542 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&,
543 bool has_more_events)> OutputCallback; 543 bool has_more_events)> OutputCallback;
544 void Flush(const OutputCallback& cb); 544 void Flush(const OutputCallback& cb);
545 void FlushButLeaveBufferIntact(const OutputCallback& flush_output_callback); 545 void FlushButLeaveBufferIntact(const OutputCallback& flush_output_callback);
546 546
547 // Can be called by clients to add custom events to the trace log without
548 // using the TRACE_EVENT* macros. This must only be called when category group
549 // is enabled for recording.
550 TraceEventHandle AddCustomTraceEvent(
dsinclair 2015/01/27 14:43:30 Instead of AddCustomTraceEvent, I think we should
Benoit L 2015/02/09 16:34:01 Done.
551 char phase,
552 const unsigned char* category_group_enabled,
553 const char* name,
554 int thread_id,
555 const TimeTicks& timestamp,
556 const TimeTicks& thread_time);
557
547 // Called by TRACE_EVENT* macros, don't call this directly. 558 // Called by TRACE_EVENT* macros, don't call this directly.
548 // The name parameter is a category group for example: 559 // The name parameter is a category group for example:
549 // TRACE_EVENT0("renderer,webkit", "WebViewImpl::HandleInputEvent") 560 // TRACE_EVENT0("renderer,webkit", "WebViewImpl::HandleInputEvent")
550 static const unsigned char* GetCategoryGroupEnabled(const char* name); 561 static const unsigned char* GetCategoryGroupEnabled(const char* name);
551 static const char* GetCategoryGroupName( 562 static const char* GetCategoryGroupName(
552 const unsigned char* category_group_enabled); 563 const unsigned char* category_group_enabled);
553 564
554 // Called by TRACE_EVENT* macros, don't call this directly. 565 // Called by TRACE_EVENT* macros, don't call this directly.
555 // If |copy| is set, |name|, |arg_name1| and |arg_name2| will be deep copied 566 // If |copy| is set, |name|, |arg_name1| and |arg_name2| will be deep copied
556 // into the event; see "Memory scoping note" and TRACE_EVENT_COPY_XXX above. 567 // into the event; see "Memory scoping note" and TRACE_EVENT_COPY_XXX above.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 } 703 }
693 704
694 TraceBuffer* trace_buffer() const { return logged_events_.get(); } 705 TraceBuffer* trace_buffer() const { return logged_events_.get(); }
695 TraceBuffer* CreateTraceBuffer(); 706 TraceBuffer* CreateTraceBuffer();
696 TraceBuffer* CreateTraceBufferVectorOfSize(size_t max_chunks); 707 TraceBuffer* CreateTraceBufferVectorOfSize(size_t max_chunks);
697 708
698 std::string EventToConsoleMessage(unsigned char phase, 709 std::string EventToConsoleMessage(unsigned char phase,
699 const TimeTicks& timestamp, 710 const TimeTicks& timestamp,
700 TraceEvent* trace_event); 711 TraceEvent* trace_event);
701 712
713 TraceEventHandle AddTraceEventInternal(
714 char phase,
715 const unsigned char* category_group_enabled,
716 const char* name,
717 unsigned long long id,
718 int thread_id,
719 const TimeTicks& timestamp,
720 const TimeTicks& thread_time,
721 int num_args,
722 const char** arg_names,
723 const unsigned char* arg_types,
724 const unsigned long long* arg_values,
725 const scoped_refptr<ConvertableToTraceFormat>* convertable_values,
726 unsigned char flags);
727
702 TraceEvent* AddEventToThreadSharedChunkWhileLocked(TraceEventHandle* handle, 728 TraceEvent* AddEventToThreadSharedChunkWhileLocked(TraceEventHandle* handle,
703 bool check_buffer_is_full); 729 bool check_buffer_is_full);
704 void CheckIfBufferIsFullWhileLocked(); 730 void CheckIfBufferIsFullWhileLocked();
705 void SetDisabledWhileLocked(); 731 void SetDisabledWhileLocked();
706 732
707 TraceEvent* GetEventByHandleInternal(TraceEventHandle handle, 733 TraceEvent* GetEventByHandleInternal(TraceEventHandle handle,
708 OptionalAutoLock* lock); 734 OptionalAutoLock* lock);
709 735
710 // |generation| is used in the following callbacks to check if the callback 736 // |generation| is used in the following callbacks to check if the callback
711 // is called for the flush of the current |logged_events_|. 737 // is called for the flush of the current |logged_events_|.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; 830 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_;
805 subtle::AtomicWord generation_; 831 subtle::AtomicWord generation_;
806 832
807 DISALLOW_COPY_AND_ASSIGN(TraceLog); 833 DISALLOW_COPY_AND_ASSIGN(TraceLog);
808 }; 834 };
809 835
810 } // namespace debug 836 } // namespace debug
811 } // namespace base 837 } // namespace base
812 838
813 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ 839 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698