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

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

Issue 1067233002: Added a trace option for whitewashing trace args against a known-PII-less list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed enable_args_whitelist Created 5 years, 7 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 | « no previous file | base/trace_event/trace_event_impl.cc » ('j') | 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) 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_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
8 8
9 #include <stack> 9 #include <stack>
10 #include <string> 10 #include <string>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const unsigned char* arg_types, 115 const unsigned char* arg_types,
116 const unsigned long long* arg_values, 116 const unsigned long long* arg_values,
117 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, 117 const scoped_refptr<ConvertableToTraceFormat>* convertable_values,
118 unsigned char flags); 118 unsigned char flags);
119 119
120 void Reset(); 120 void Reset();
121 121
122 void UpdateDuration(const TimeTicks& now, const TimeTicks& thread_now); 122 void UpdateDuration(const TimeTicks& now, const TimeTicks& thread_now);
123 123
124 // Serialize event data to JSON 124 // Serialize event data to JSON
125 void AppendAsJSON(std::string* out) const; 125 typedef base::Callback<bool(const char* category_group_name,
126 const char* event_name)> EventFilterPredicate;
127 void AppendAsJSON(std::string* out,
128 const EventFilterPredicate& event_filter_predicate) const;
126 void AppendPrettyPrinted(std::ostringstream* out) const; 129 void AppendPrettyPrinted(std::ostringstream* out) const;
127 130
128 static void AppendValueAsJSON(unsigned char type, 131 static void AppendValueAsJSON(unsigned char type,
129 TraceValue value, 132 TraceValue value,
130 std::string* out); 133 std::string* out);
131 134
132 TimeTicks timestamp() const { return timestamp_; } 135 TimeTicks timestamp() const { return timestamp_; }
133 TimeTicks thread_timestamp() const { return thread_timestamp_; } 136 TimeTicks thread_timestamp() const { return thread_timestamp_; }
134 char phase() const { return phase_; } 137 char phase() const { return phase_; }
135 int thread_id() const { return thread_id_; } 138 int thread_id() const { return thread_id_; }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 int num_args, 528 int num_args,
526 const char* const arg_names[], 529 const char* const arg_names[],
527 const unsigned char arg_types[], 530 const unsigned char arg_types[],
528 const unsigned long long arg_values[], 531 const unsigned long long arg_values[],
529 unsigned char flags); 532 unsigned char flags);
530 533
531 // Enable tracing for EventCallback. 534 // Enable tracing for EventCallback.
532 void SetEventCallbackEnabled(const CategoryFilter& category_filter, 535 void SetEventCallbackEnabled(const CategoryFilter& category_filter,
533 EventCallback cb); 536 EventCallback cb);
534 void SetEventCallbackDisabled(); 537 void SetEventCallbackDisabled();
538 void SetEventFilterPredicate(
539 const TraceEvent::EventFilterPredicate& event_filter_predicate);
535 540
536 // Flush all collected events to the given output callback. The callback will 541 // Flush all collected events to the given output callback. The callback will
537 // be called one or more times either synchronously or asynchronously from 542 // be called one or more times either synchronously or asynchronously from
538 // the current thread with IPC-bite-size chunks. The string format is 543 // the current thread with IPC-bite-size chunks. The string format is
539 // undefined. Use TraceResultBuffer to convert one or more trace strings to 544 // undefined. Use TraceResultBuffer to convert one or more trace strings to
540 // JSON. The callback can be null if the caller doesn't want any data. 545 // JSON. The callback can be null if the caller doesn't want any data.
541 // Due to the implementation of thread-local buffers, flush can't be 546 // Due to the implementation of thread-local buffers, flush can't be
542 // done when tracing is enabled. If called when tracing is enabled, the 547 // done when tracing is enabled. If called when tracing is enabled, the
543 // callback will be called directly with (empty_string, false) to indicate 548 // callback will be called directly with (empty_string, false) to indicate
544 // the end of this unsuccessful flush. Flush does the serialization 549 // the end of this unsuccessful flush. Flush does the serialization
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 void CheckIfBufferIsFullWhileLocked(); 715 void CheckIfBufferIsFullWhileLocked();
711 void SetDisabledWhileLocked(); 716 void SetDisabledWhileLocked();
712 717
713 TraceEvent* GetEventByHandleInternal(TraceEventHandle handle, 718 TraceEvent* GetEventByHandleInternal(TraceEventHandle handle,
714 OptionalAutoLock* lock); 719 OptionalAutoLock* lock);
715 720
716 // |generation| is used in the following callbacks to check if the callback 721 // |generation| is used in the following callbacks to check if the callback
717 // is called for the flush of the current |logged_events_|. 722 // is called for the flush of the current |logged_events_|.
718 void FlushCurrentThread(int generation); 723 void FlushCurrentThread(int generation);
719 // Usually it runs on a different thread. 724 // Usually it runs on a different thread.
720 static void ConvertTraceEventsToTraceFormat( 725 void ConvertTraceEventsToTraceFormat(
721 scoped_ptr<TraceBuffer> logged_events, 726 scoped_ptr<TraceBuffer> logged_events,
722 const TraceLog::OutputCallback& flush_output_callback); 727 const TraceLog::OutputCallback& flush_output_callback,
728 const TraceEvent::EventFilterPredicate& event_filter_predicate);
723 void FinishFlush(int generation); 729 void FinishFlush(int generation);
724 void OnFlushTimeout(int generation); 730 void OnFlushTimeout(int generation);
725 731
726 int generation() const { 732 int generation() const {
727 return static_cast<int>(subtle::NoBarrier_Load(&generation_)); 733 return static_cast<int>(subtle::NoBarrier_Load(&generation_));
728 } 734 }
729 bool CheckGeneration(int generation) const { 735 bool CheckGeneration(int generation) const {
730 return generation == this->generation(); 736 return generation == this->generation();
731 } 737 }
732 void UseNextTraceBuffer(); 738 void UseNextTraceBuffer();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 // need to know the life time of the message loops. 808 // need to know the life time of the message loops.
803 hash_set<MessageLoop*> thread_message_loops_; 809 hash_set<MessageLoop*> thread_message_loops_;
804 810
805 // For events which can't be added into the thread local buffer, e.g. events 811 // For events which can't be added into the thread local buffer, e.g. events
806 // from threads without a message loop. 812 // from threads without a message loop.
807 scoped_ptr<TraceBufferChunk> thread_shared_chunk_; 813 scoped_ptr<TraceBufferChunk> thread_shared_chunk_;
808 size_t thread_shared_chunk_index_; 814 size_t thread_shared_chunk_index_;
809 815
810 // Set when asynchronous Flush is in progress. 816 // Set when asynchronous Flush is in progress.
811 OutputCallback flush_output_callback_; 817 OutputCallback flush_output_callback_;
818 TraceEvent::EventFilterPredicate event_filter_predicate_;
812 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; 819 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_;
813 subtle::AtomicWord generation_; 820 subtle::AtomicWord generation_;
814 bool use_worker_thread_; 821 bool use_worker_thread_;
815 822
816 DISALLOW_COPY_AND_ASSIGN(TraceLog); 823 DISALLOW_COPY_AND_ASSIGN(TraceLog);
817 }; 824 };
818 825
819 } // namespace trace_event 826 } // namespace trace_event
820 } // namespace base 827 } // namespace base
821 828
822 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ 829 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698