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

Side by Side Diff: include/v8-platform.h

Issue 2367603002: [tracing] Support ConvertableToTraceFormat argument type. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | src/libplatform/tracing/trace-writer.cc » ('j') | src/tracing/trace-event.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project 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 #ifndef V8_V8_PLATFORM_H_ 5 #ifndef V8_V8_PLATFORM_H_
6 #define V8_V8_PLATFORM_H_ 6 #define V8_V8_PLATFORM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <string>
10 11
11 namespace v8 { 12 namespace v8 {
12 13
13 class Isolate; 14 class Isolate;
14 15
15 /** 16 /**
16 * A Task represents a unit of work. 17 * A Task represents a unit of work.
17 */ 18 */
18 class Task { 19 class Task {
19 public: 20 public:
20 virtual ~Task() {} 21 virtual ~Task() = default;
21 22
22 virtual void Run() = 0; 23 virtual void Run() = 0;
23 }; 24 };
24 25
25
26 /** 26 /**
27 * An IdleTask represents a unit of work to be performed in idle time. 27 * An IdleTask represents a unit of work to be performed in idle time.
28 * The Run method is invoked with an argument that specifies the deadline in 28 * The Run method is invoked with an argument that specifies the deadline in
29 * seconds returned by MonotonicallyIncreasingTime(). 29 * seconds returned by MonotonicallyIncreasingTime().
30 * The idle task is expected to complete by this deadline. 30 * The idle task is expected to complete by this deadline.
31 */ 31 */
32 class IdleTask { 32 class IdleTask {
33 public: 33 public:
34 virtual ~IdleTask() {} 34 virtual ~IdleTask() = default;
35 virtual void Run(double deadline_in_seconds) = 0; 35 virtual void Run(double deadline_in_seconds) = 0;
36 }; 36 };
37 37
38 /**
39 * The interface represents complex arguments to trace events.
40 */
41 class ConvertableToTraceFormat {
42 public:
43 virtual ~ConvertableToTraceFormat() = default;
44
45 /**
46 * Append the class info to the provided |out| string. The appended
47 * data must be a valid JSON object. Strings must be properly quoted, and
48 * escaped. There is no processing applied to the content after it is
49 * appended.
50 */
51 virtual void AppendAsTraceFormat(std::string* out) const = 0;
52 };
38 53
39 /** 54 /**
40 * V8 Platform abstraction layer. 55 * V8 Platform abstraction layer.
41 * 56 *
42 * The embedder has to provide an implementation of this interface before 57 * The embedder has to provide an implementation of this interface before
43 * initializing the rest of V8. 58 * initializing the rest of V8.
44 */ 59 */
45 class Platform { 60 class Platform {
46 public: 61 public:
47 /** 62 /**
48 * This enum is used to indicate whether a task is potentially long running, 63 * This enum is used to indicate whether a task is potentially long running,
49 * or causes a long wait. The embedder might want to use this hint to decide 64 * or causes a long wait. The embedder might want to use this hint to decide
50 * whether to execute the task on a dedicated thread. 65 * whether to execute the task on a dedicated thread.
51 */ 66 */
52 enum ExpectedRuntime { 67 enum ExpectedRuntime {
53 kShortRunningTask, 68 kShortRunningTask,
54 kLongRunningTask 69 kLongRunningTask
55 }; 70 };
56 71
57 virtual ~Platform() {} 72 virtual ~Platform() = default;
58 73
59 /** 74 /**
60 * Gets the number of threads that are used to execute background tasks. Is 75 * Gets the number of threads that are used to execute background tasks. Is
61 * used to estimate the number of tasks a work package should be split into. 76 * used to estimate the number of tasks a work package should be split into.
62 * A return value of 0 means that there are no background threads available. 77 * A return value of 0 means that there are no background threads available.
63 * Note that a value of 0 won't prohibit V8 from posting tasks using 78 * Note that a value of 0 won't prohibit V8 from posting tasks using
64 * |CallOnBackgroundThread|. 79 * |CallOnBackgroundThread|.
65 */ 80 */
66 virtual size_t NumberOfAvailableBackgroundThreads() { return 0; } 81 virtual size_t NumberOfAvailableBackgroundThreads() { return 0; }
67 82
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 /** Adds tracing state change observer. */ 190 /** Adds tracing state change observer. */
176 virtual void AddTraceStateObserver(TraceStateObserver*) {} 191 virtual void AddTraceStateObserver(TraceStateObserver*) {}
177 192
178 /** Removes tracing state change observer. */ 193 /** Removes tracing state change observer. */
179 virtual void RemoveTraceStateObserver(TraceStateObserver*) {} 194 virtual void RemoveTraceStateObserver(TraceStateObserver*) {}
180 }; 195 };
181 196
182 } // namespace v8 197 } // namespace v8
183 198
184 #endif // V8_V8_PLATFORM_H_ 199 #endif // V8_V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « no previous file | src/libplatform/tracing/trace-writer.cc » ('j') | src/tracing/trace-event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698