OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_LIBPLATFORM_LIBPLATFORM_H_ | 5 #ifndef V8_LIBPLATFORM_LIBPLATFORM_H_ |
6 #define V8_LIBPLATFORM_LIBPLATFORM_H_ | 6 #define V8_LIBPLATFORM_LIBPLATFORM_H_ |
7 | 7 |
| 8 #include "include/v8-platform.h" |
| 9 |
8 namespace v8 { | 10 namespace v8 { |
9 | |
10 class Isolate; | |
11 class Platform; | |
12 | |
13 namespace platform { | 11 namespace platform { |
14 | 12 |
15 /** | 13 /** |
16 * Returns a new instance of the default v8::Platform implementation. | 14 * Returns a new instance of the default v8::Platform implementation. |
17 * | 15 * |
18 * The caller will take ownership of the returned pointer. |thread_pool_size| | 16 * The caller will take ownership of the returned pointer. |thread_pool_size| |
19 * is the number of worker threads to allocate for background jobs. If a value | 17 * is the number of worker threads to allocate for background jobs. If a value |
20 * of zero is passed, a suitable default based on the current number of | 18 * of zero is passed, a suitable default based on the current number of |
21 * processors online will be chosen. | 19 * processors online will be chosen. |
22 */ | 20 */ |
23 v8::Platform* CreateDefaultPlatform(int thread_pool_size = 0); | 21 v8::Platform* CreateDefaultPlatform(int thread_pool_size = 0); |
24 | 22 |
25 | 23 |
26 /** | 24 /** |
27 * Pumps the message loop for the given isolate. | 25 * Pumps the message loop for the given isolate. |
28 * | 26 * |
29 * The caller has to make sure that this is called from the right thread. | 27 * The caller has to make sure that this is called from the right thread. |
30 * Returns true if a task was executed, and false otherwise. This call does | 28 * Returns true if a task was executed, and false otherwise. This call does |
31 * not block if no task is pending. The |platform| has to be created using | 29 * not block if no task is pending. The |platform| has to be created using |
32 * |CreateDefaultPlatform|. | 30 * |CreateDefaultPlatform|. |
33 */ | 31 */ |
34 bool PumpMessageLoop(v8::Platform* platform, v8::Isolate* isolate); | 32 bool PumpMessageLoop(v8::Platform* platform, v8::Isolate* isolate); |
35 | 33 |
36 | 34 |
37 } // namespace platform | 35 } // namespace platform |
38 } // namespace v8 | 36 } // namespace v8 |
39 | 37 |
40 #endif // V8_LIBPLATFORM_LIBPLATFORM_H_ | 38 #endif // V8_LIBPLATFORM_LIBPLATFORM_H_ |
OLD | NEW |