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

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

Issue 2159323002: Add tracing AutoOpenCloseEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update design Created 4 years, 3 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_
6 #define BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_
7
8 #include "base/macros.h"
9 #include "base/threading/thread_checker.h"
10 #include "base/time/time.h"
11 #include "base/trace_event/trace_event.h"
Primiano Tucci (use gerrit) 2016/09/15 10:08:29 don't think you need to include trace_event here a
Primiano Tucci (use gerrit) 2016/09/15 10:08:29 IWYU (include what you use): add an include base/m
alexandermont 2016/09/15 21:05:13 Done. But you do still need to include trace_event
12
13 namespace base {
14 namespace trace_event {
15
16 class BASE_EXPORT PersistentAsyncEvent
Primiano Tucci (use gerrit) 2016/09/15 10:08:29 Add a comment explaining what this class does and
alexandermont 2016/09/15 21:05:13 Done
17 : public trace_event::TraceLog::AsyncEnabledStateObserver {
Primiano Tucci (use gerrit) 2016/09/15 10:08:30 you don't need trace_event:: here as you are alrea
alexandermont 2016/09/15 21:05:13 Done
18 public:
19 enum Type {
20 ASYNC
21 };
22
23 PersistentAsyncEvent(PersistentAsyncEvent::Type type,
Primiano Tucci (use gerrit) 2016/09/15 10:08:29 you don't need PersistentAsyncEvent:: here I belie
Primiano Tucci (use gerrit) 2016/09/15 10:08:30 Can you add a comment saying // As in the rest of
alexandermont 2016/09/15 21:05:13 Done
24 const char* category, const char* event_name);
25 ~PersistentAsyncEvent() override;
26
27 void Begin();
28 void End();
29
30 // EnabledStateObserver implementation
Primiano Tucci (use gerrit) 2016/09/15 10:08:30 nit, +Async. This is now extending AsyncEnabledSta
alexandermont 2016/09/15 21:05:13 Done
31 void OnTraceLogEnabled() override;
32 void OnTraceLogDisabled() override;
33
34 // TODO(alexandermont): Add in auto-close in OnBeforeTraceLogDisabled once the
35 // OnBeforeTraceLogDisabled CL lands.
36
37 private:
38 bool active_;
39 const char* const category_;
40 const char* const event_name_;
41 base::TimeTicks start_time_;
42 base::ThreadChecker thread_checker_;
43 WeakPtrFactory<PersistentAsyncEvent> weak_factory_;
44 DISALLOW_COPY_AND_ASSIGN(PersistentAsyncEvent);
Primiano Tucci (use gerrit) 2016/09/15 10:08:30 nit: add a blankline between fields and DISALLOW..
alexandermont 2016/09/15 21:05:13 Done
45 };
46
47 } // namespace trace_event
48 } // namespace base
49
50 #endif // BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698