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

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

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « base/cancelable_callback.h ('k') | base/debug/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_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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // Returns true on success. 413 // Returns true on success.
414 bool SetFromString(const std::string& options_string); 414 bool SetFromString(const std::string& options_string);
415 415
416 std::string ToString() const; 416 std::string ToString() const;
417 417
418 TraceRecordMode record_mode; 418 TraceRecordMode record_mode;
419 bool enable_sampling; 419 bool enable_sampling;
420 bool enable_systrace; 420 bool enable_systrace;
421 }; 421 };
422 422
423 struct BASE_EXPORT TraceLogStatus {
424 TraceLogStatus();
425 ~TraceLogStatus();
426 size_t event_capacity;
427 size_t event_count;
428 };
429
423 class BASE_EXPORT TraceLog { 430 class BASE_EXPORT TraceLog {
424 public: 431 public:
425 enum Mode { 432 enum Mode {
426 DISABLED = 0, 433 DISABLED = 0,
427 RECORDING_MODE, 434 RECORDING_MODE,
428 MONITORING_MODE, 435 MONITORING_MODE,
429 }; 436 };
430 437
431 // The pointer returned from GetCategoryGroupEnabledInternal() points to a 438 // The pointer returned from GetCategoryGroupEnabledInternal() points to a
432 // value with zero or more of the following bits. Used in this class only. 439 // value with zero or more of the following bits. Used in this class only.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 virtual void OnTraceLogEnabled() = 0; 495 virtual void OnTraceLogEnabled() = 0;
489 496
490 // Called just after the tracing system disables, outside of the |lock_|. 497 // Called just after the tracing system disables, outside of the |lock_|.
491 // TraceLog::IsEnabled() is false at this point. 498 // TraceLog::IsEnabled() is false at this point.
492 virtual void OnTraceLogDisabled() = 0; 499 virtual void OnTraceLogDisabled() = 0;
493 }; 500 };
494 void AddEnabledStateObserver(EnabledStateObserver* listener); 501 void AddEnabledStateObserver(EnabledStateObserver* listener);
495 void RemoveEnabledStateObserver(EnabledStateObserver* listener); 502 void RemoveEnabledStateObserver(EnabledStateObserver* listener);
496 bool HasEnabledStateObserver(EnabledStateObserver* listener) const; 503 bool HasEnabledStateObserver(EnabledStateObserver* listener) const;
497 504
498 float GetBufferPercentFull() const; 505 TraceLogStatus GetStatus() const;
499 bool BufferIsFull() const; 506 bool BufferIsFull() const;
500 507
501 // Not using base::Callback because of its limited by 7 parameters. 508 // Not using base::Callback because of its limited by 7 parameters.
502 // Also, using primitive type allows directly passing callback from WebCore. 509 // Also, using primitive type allows directly passing callback from WebCore.
503 // WARNING: It is possible for the previously set callback to be called 510 // WARNING: It is possible for the previously set callback to be called
504 // after a call to SetEventCallbackEnabled() that replaces or a call to 511 // after a call to SetEventCallbackEnabled() that replaces or a call to
505 // SetEventCallbackDisabled() that disables the callback. 512 // SetEventCallbackDisabled() that disables the callback.
506 // This callback may be invoked on any thread. 513 // This callback may be invoked on any thread.
507 // For TRACE_EVENT_PHASE_COMPLETE events, the client will still receive pairs 514 // For TRACE_EVENT_PHASE_COMPLETE events, the client will still receive pairs
508 // of TRACE_EVENT_PHASE_BEGIN and TRACE_EVENT_PHASE_END events to keep the 515 // of TRACE_EVENT_PHASE_BEGIN and TRACE_EVENT_PHASE_END events to keep the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 int process_id() const { return process_id_; } 603 int process_id() const { return process_id_; }
597 604
598 // Exposed for unittesting: 605 // Exposed for unittesting:
599 606
600 void WaitSamplingEventForTesting(); 607 void WaitSamplingEventForTesting();
601 608
602 // Allows deleting our singleton instance. 609 // Allows deleting our singleton instance.
603 static void DeleteForTesting(); 610 static void DeleteForTesting();
604 611
605 // Allow tests to inspect TraceEvents. 612 // Allow tests to inspect TraceEvents.
606 size_t GetEventsSize() const { return logged_events_->Size(); }
607 TraceEvent* GetEventByHandle(TraceEventHandle handle); 613 TraceEvent* GetEventByHandle(TraceEventHandle handle);
608 614
609 void SetProcessID(int process_id); 615 void SetProcessID(int process_id);
610 616
611 // Process sort indices, if set, override the order of a process will appear 617 // Process sort indices, if set, override the order of a process will appear
612 // relative to other processes in the trace viewer. Processes are sorted first 618 // relative to other processes in the trace viewer. Processes are sorted first
613 // on their sort index, ascending, then by their name, and then tid. 619 // on their sort index, ascending, then by their name, and then tid.
614 void SetProcessSortIndex(int sort_index); 620 void SetProcessSortIndex(int sort_index);
615 621
616 // Sets the name of the process. 622 // Sets the name of the process.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; 805 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_;
800 subtle::AtomicWord generation_; 806 subtle::AtomicWord generation_;
801 807
802 DISALLOW_COPY_AND_ASSIGN(TraceLog); 808 DISALLOW_COPY_AND_ASSIGN(TraceLog);
803 }; 809 };
804 810
805 } // namespace debug 811 } // namespace debug
806 } // namespace base 812 } // namespace base
807 813
808 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ 814 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_
OLDNEW
« no previous file with comments | « base/cancelable_callback.h ('k') | base/debug/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698