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

Unified Diff: base/debug/trace_event_impl.h

Issue 67683003: Remove TraceController (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | content/browser/tracing/tracing_controller_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event_impl.h
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h
index 9e0ece932b03bc39764a91c9920967d040aba6fc..31a5f94548f8ae5c30e2b8929cacbe51ca6ba844 100644
--- a/base/debug/trace_event_impl.h
+++ b/base/debug/trace_event_impl.h
@@ -352,16 +352,6 @@ class TraceSamplingThread;
class BASE_EXPORT TraceLog {
public:
- // Notification is a mask of one or more of the following events.
- enum Notification {
- // The trace buffer does not flush dynamically, so when it fills up,
- // subsequent trace events will be dropped. This callback is generated when
- // the trace buffer is full. The callback must be thread safe.
- TRACE_BUFFER_FULL = 1 << 0,
- // A subscribed trace-event occurred.
- EVENT_WATCH_NOTIFICATION = 1 << 1
- };
-
// Options determines how the trace buffer stores data.
enum Options {
// Record until the trace buffer is full.
@@ -393,10 +383,6 @@ class BASE_EXPORT TraceLog {
static TraceLog* GetInstance();
- // Convert the given string to trace options. Defaults to RECORD_UNTIL_FULL if
- // the string does not provide valid options.
- static Options TraceOptionsFromString(const std::string& str);
-
// Get set of known category groups. This can change as new code paths are
// reached. The known category groups are inserted into |category_groups|.
void GetKnownCategoryGroups(std::vector<std::string>* category_groups);
@@ -450,14 +436,7 @@ class BASE_EXPORT TraceLog {
bool HasEnabledStateObserver(EnabledStateObserver* listener) const;
float GetBufferPercentFull() const;
-
- // Set the thread-safe notification callback. The callback can occur at any
- // time and from any thread. WARNING: It is possible for the previously set
- // callback to be called during OR AFTER a call to SetNotificationCallback.
- // Therefore, the target of the callback must either be a global function,
- // ref-counted object or a LazyInstance with Leaky traits (or equivalent).
- typedef base::Callback<void(int)> NotificationCallback;
- void SetNotificationCallback(const NotificationCallback& cb);
+ bool BufferIsFull() const;
// Not using base::Callback because of its limited by 7 parameters.
// Also, using primitive type allows directly passing callback from WebCore.
@@ -545,12 +524,11 @@ class BASE_EXPORT TraceLog {
const char* name,
TraceEventHandle handle);
- // For every matching event, a notification will be fired. NOTE: the
- // notification will fire for each matching event that has already occurred
- // since tracing was started (including before tracing if the process was
- // started with tracing turned on).
+ // For every matching event, the callback will be called.
+ typedef base::Callback<void()> WatchEventCallback;
void SetWatchEvent(const std::string& category_name,
- const std::string& event_name);
+ const std::string& event_name,
+ const WatchEventCallback& callback);
// Cancel the watch event. If tracing is enabled, this may race with the
// watch event notification firing.
void CancelWatchEvent();
@@ -619,29 +597,6 @@ class BASE_EXPORT TraceLog {
void UpdateCategoryGroupEnabledFlags();
void UpdateCategoryGroupEnabledFlag(int category_index);
- // Helper class for managing notification_thread_count_ and running
- // notification callbacks. This is very similar to a reader-writer lock, but
- // shares the lock with TraceLog and manages the notification flags.
- class NotificationHelper {
- public:
- inline explicit NotificationHelper(TraceLog* trace_log);
- inline ~NotificationHelper();
-
- // Called only while TraceLog::lock_ is held. This ORs the given
- // notification with any existing notifications.
- inline void AddNotificationWhileLocked(int notification);
-
- // Called only while TraceLog::lock_ is NOT held. If there are any pending
- // notifications from previous calls to AddNotificationWhileLocked, this
- // will call the NotificationCallback.
- inline void SendNotificationIfAny();
-
- private:
- TraceLog* trace_log_;
- NotificationCallback callback_copy_;
- int notification_;
- };
-
class ThreadLocalEventBuffer;
class OptionalAutoLock;
@@ -657,9 +612,10 @@ class BASE_EXPORT TraceLog {
const TimeTicks& timestamp,
TraceEvent* trace_event);
- TraceEvent* AddEventToThreadSharedChunkWhileLocked(
- NotificationHelper* notifier, TraceEventHandle* handle);
- void CheckIfBufferIsFullWhileLocked(NotificationHelper* notifier);
+ TraceEvent* AddEventToThreadSharedChunkWhileLocked(TraceEventHandle* handle,
+ bool check_buffer_is_full);
+ void CheckIfBufferIsFullWhileLocked();
+ void SetDisabledWhileLocked();
TraceEvent* GetEventByHandleInternal(TraceEventHandle handle,
OptionalAutoLock* lock);
@@ -690,12 +646,10 @@ class BASE_EXPORT TraceLog {
}
// This lock protects TraceLog member accesses from arbitrary threads.
- Lock lock_;
+ mutable Lock lock_;
int locked_line_;
bool enabled_;
int num_traces_recorded_;
- subtle::AtomicWord /* bool */ buffer_is_full_;
- NotificationCallback notification_callback_;
scoped_ptr<TraceBuffer> logged_events_;
subtle::AtomicWord /* EventCallback */ event_callback_;
bool dispatching_to_observer_list_;
@@ -719,6 +673,7 @@ class BASE_EXPORT TraceLog {
TimeDelta time_offset_;
// Allow tests to wake up when certain events occur.
+ WatchEventCallback watch_event_callback_;
subtle::AtomicWord /* const unsigned char* */ watch_category_;
std::string watch_event_name_;
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | content/browser/tracing/tracing_controller_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698