OLD | NEW |
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 "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 19 matching lines...) Expand all Loading... |
30 /** | 30 /** |
31 * This enum is used to indicate whether a task is potentially long running, | 31 * This enum is used to indicate whether a task is potentially long running, |
32 * or causes a long wait. The embedder might want to use this hint to decide | 32 * or causes a long wait. The embedder might want to use this hint to decide |
33 * whether to execute the task on a dedicated thread. | 33 * whether to execute the task on a dedicated thread. |
34 */ | 34 */ |
35 enum ExpectedRuntime { | 35 enum ExpectedRuntime { |
36 kShortRunningTask, | 36 kShortRunningTask, |
37 kLongRunningTask | 37 kLongRunningTask |
38 }; | 38 }; |
39 | 39 |
| 40 virtual ~Platform() {} |
| 41 |
40 /** | 42 /** |
41 * Schedules a task to be invoked on a background thread. |expected_runtime| | 43 * Schedules a task to be invoked on a background thread. |expected_runtime| |
42 * indicates that the task will run a long time. The Platform implementation | 44 * indicates that the task will run a long time. The Platform implementation |
43 * takes ownership of |task|. There is no guarantee about order of execution | 45 * takes ownership of |task|. There is no guarantee about order of execution |
44 * of tasks wrt order of scheduling, nor is there a guarantee about the | 46 * of tasks wrt order of scheduling, nor is there a guarantee about the |
45 * thread the task will be run on. | 47 * thread the task will be run on. |
46 */ | 48 */ |
47 virtual void CallOnBackgroundThread(Task* task, | 49 virtual void CallOnBackgroundThread(Task* task, |
48 ExpectedRuntime expected_runtime) = 0; | 50 ExpectedRuntime expected_runtime) = 0; |
49 | 51 |
50 /** | 52 /** |
51 * Schedules a task to be invoked on a foreground thread wrt a specific | 53 * Schedules a task to be invoked on a foreground thread wrt a specific |
52 * |isolate|. Tasks posted for the same isolate should be execute in order of | 54 * |isolate|. Tasks posted for the same isolate should be execute in order of |
53 * scheduling. The definition of "foreground" is opaque to V8. | 55 * scheduling. The definition of "foreground" is opaque to V8. |
54 */ | 56 */ |
55 virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0; | 57 virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0; |
56 | |
57 protected: | |
58 virtual ~Platform() {} | |
59 }; | 58 }; |
60 | 59 |
61 } // namespace v8 | 60 } // namespace v8 |
62 | 61 |
63 #endif // V8_V8_PLATFORM_H_ | 62 #endif // V8_V8_PLATFORM_H_ |
OLD | NEW |