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

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

Issue 1664203004: [platform] Add NumberOfAvailableBackgroundThreads (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 4 years, 10 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/default-platform.h » ('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 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 <stdint.h> 9 #include <stdint.h>
9 10
10 namespace v8 { 11 namespace v8 {
11 12
12 class Isolate; 13 class Isolate;
13 14
14 /** 15 /**
15 * A Task represents a unit of work. 16 * A Task represents a unit of work.
16 */ 17 */
17 class Task { 18 class Task {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 * whether to execute the task on a dedicated thread. 50 * whether to execute the task on a dedicated thread.
50 */ 51 */
51 enum ExpectedRuntime { 52 enum ExpectedRuntime {
52 kShortRunningTask, 53 kShortRunningTask,
53 kLongRunningTask 54 kLongRunningTask
54 }; 55 };
55 56
56 virtual ~Platform() {} 57 virtual ~Platform() {}
57 58
58 /** 59 /**
60 * 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.
62 * 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
64 * |CallOnBackgroundThread|.
65 */
66 virtual size_t NumberOfAvailableBackgroundThreads() { return 0; }
67
68 /**
59 * Schedules a task to be invoked on a background thread. |expected_runtime| 69 * Schedules a task to be invoked on a background thread. |expected_runtime|
60 * indicates that the task will run a long time. The Platform implementation 70 * indicates that the task will run a long time. The Platform implementation
61 * takes ownership of |task|. There is no guarantee about order of execution 71 * takes ownership of |task|. There is no guarantee about order of execution
62 * of tasks wrt order of scheduling, nor is there a guarantee about the 72 * of tasks wrt order of scheduling, nor is there a guarantee about the
63 * thread the task will be run on. 73 * thread the task will be run on.
64 */ 74 */
65 virtual void CallOnBackgroundThread(Task* task, 75 virtual void CallOnBackgroundThread(Task* task,
66 ExpectedRuntime expected_runtime) = 0; 76 ExpectedRuntime expected_runtime) = 0;
67 77
68 /** 78 /**
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 * Sets the duration field of a COMPLETE trace event. It must be called with 162 * Sets the duration field of a COMPLETE trace event. It must be called with
153 * the handle returned from AddTraceEvent(). 163 * the handle returned from AddTraceEvent().
154 **/ 164 **/
155 virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag, 165 virtual void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
156 const char* name, uint64_t handle) {} 166 const char* name, uint64_t handle) {}
157 }; 167 };
158 168
159 } // namespace v8 169 } // namespace v8
160 170
161 #endif // V8_V8_PLATFORM_H_ 171 #endif // V8_V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « no previous file | src/libplatform/default-platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698