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

Side by Side Diff: Source/platform/scheduler/TracedTask.h

Issue 656463004: Use the scheduling mechanism provided by the platform (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Mike's comments. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/scheduler/SchedulerTest.cpp ('k') | Source/platform/scheduler/TracedTask.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 TracedTask_h
6 #define TracedTask_h
7
8 #include "platform/Task.h"
9 #include "platform/TraceEvent.h"
10 #include "platform/TraceLocation.h"
11
12 namespace blink {
13 namespace internal {
14
15 #ifdef MANGLE_COMPILES_ON_WIN_OK
16 // TODO: Once win version compiles correctly when using TRACE_ID_MANGLE remove
17 // the ifdef to always mangle
18 #define MANGLE(id) TRACE_ID_MANGLE(id)
19 #else
20 #define MANGLE(id) (id)
21 #endif
22
23 class TracedTask {
24 public:
25 virtual void run() const = 0;
26 virtual ~TracedTask();
27
28 protected:
29 TracedTask(const TraceLocation&, const char* traceName);
30 TraceLocation getLocation() const;
31 const char* getTraceName() const;
32 void endFlowTraceEvent() const;
33
34 private:
35 // Declared volatile as it is atomically incremented.
36 static volatile int s_nextFlowTraceID;
37
38 uint64_t m_flowTraceID;
39 TraceLocation m_location;
40 const char* m_traceName;
41 };
42
43 class TracedStandardTask : public TracedTask {
44 public:
45 typedef Function<void()> Task;
46
47 static PassOwnPtr<TracedStandardTask> Create(const Task&, const TraceLocatio n&, const char* traceName);
48 virtual void run() const;
49 virtual ~TracedStandardTask();
50
51 private:
52 TracedStandardTask(const Task&, const TraceLocation&, const char* traceName) ;
53 Task m_task;
54 };
55
56 class TracedIdleTask : public TracedTask {
57 public:
58 typedef Function<void(double deadlineSeconds)> IdleTask;
59
60 static PassOwnPtr<TracedIdleTask> Create(const IdleTask&, const TraceLocatio n&, const char* traceName);
61 virtual void run() const;
62 virtual ~TracedIdleTask();
63
64 private:
65 TracedIdleTask(const IdleTask&, const TraceLocation&, const char* traceName) ;
66 IdleTask m_idleTask;
67 };
68
69 } // namespace internal
70 } // namespace blink
71
72 #endif // TracedTask_h
OLDNEW
« no previous file with comments | « Source/platform/scheduler/SchedulerTest.cpp ('k') | Source/platform/scheduler/TracedTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698