OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium 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 GIN_PUBLIC_ISOLATE_HOLDER_H_ | 5 #ifndef GIN_PUBLIC_ISOLATE_HOLDER_H_ |
6 #define GIN_PUBLIC_ISOLATE_HOLDER_H_ | 6 #define GIN_PUBLIC_ISOLATE_HOLDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "gin/gin_export.h" | 10 #include "gin/gin_export.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 kNonStrictMode, | 28 kNonStrictMode, |
29 kStrictMode | 29 kStrictMode |
30 }; | 30 }; |
31 | 31 |
32 // Stores whether the client uses v8::Locker to access the isolate. | 32 // Stores whether the client uses v8::Locker to access the isolate. |
33 enum AccessMode { | 33 enum AccessMode { |
34 kSingleThread, | 34 kSingleThread, |
35 kUseLocker | 35 kUseLocker |
36 }; | 36 }; |
37 | 37 |
| 38 // Indicates whether V8 works with stable or experimental v8 extras. |
| 39 enum V8ExtrasMode { |
| 40 kStableV8Extras, |
| 41 kStableAndExperimentalV8Extras, |
| 42 }; |
| 43 |
38 IsolateHolder(); | 44 IsolateHolder(); |
39 explicit IsolateHolder(AccessMode access_mode); | 45 explicit IsolateHolder(AccessMode access_mode); |
40 ~IsolateHolder(); | 46 ~IsolateHolder(); |
41 | 47 |
42 // Should be invoked once before creating IsolateHolder instances to | 48 // Should be invoked once before creating IsolateHolder instances to |
43 // initialize V8 and Gin. In case V8_USE_EXTERNAL_STARTUP_DATA is | 49 // initialize V8 and Gin. In case V8_USE_EXTERNAL_STARTUP_DATA is |
44 // defined, V8's initial natives should be loaded (by calling | 50 // defined, V8's initial natives should be loaded (by calling |
45 // V8Initializer::LoadV8NativesFromFD or | 51 // V8Initializer::LoadV8NativesFromFD or |
46 // V8Initializer::LoadV8Natives) before calling this method. If the | 52 // V8Initializer::LoadV8Natives) before calling this method. If the |
47 // snapshot file is available, it should also be loaded (by calling | 53 // snapshot file is available, it should also be loaded (by calling |
48 // V8Initializer::LoadV8SnapshotFromFD or | 54 // V8Initializer::LoadV8SnapshotFromFD or |
49 // V8Initializer::LoadV8Snapshot) before calling this method. | 55 // V8Initializer::LoadV8Snapshot) before calling this method. |
50 static void Initialize(ScriptMode mode, | 56 static void Initialize(ScriptMode mode, |
| 57 V8ExtrasMode v8_extras_mode, |
51 v8::ArrayBuffer::Allocator* allocator); | 58 v8::ArrayBuffer::Allocator* allocator); |
52 | 59 |
53 v8::Isolate* isolate() { return isolate_; } | 60 v8::Isolate* isolate() { return isolate_; } |
54 | 61 |
55 // The implementations of Object.observe() and Promise enqueue v8 Microtasks | 62 // The implementations of Object.observe() and Promise enqueue v8 Microtasks |
56 // that should be executed just before control is returned to the message | 63 // that should be executed just before control is returned to the message |
57 // loop. This method adds a MessageLoop TaskObserver which runs any pending | 64 // loop. This method adds a MessageLoop TaskObserver which runs any pending |
58 // Microtasks each time a Task is completed. This method should be called | 65 // Microtasks each time a Task is completed. This method should be called |
59 // once, when a MessageLoop is created and it should be called on the | 66 // once, when a MessageLoop is created and it should be called on the |
60 // MessageLoop's thread. | 67 // MessageLoop's thread. |
(...skipping 21 matching lines...) Expand all Loading... |
82 scoped_ptr<RunMicrotasksObserver> task_observer_; | 89 scoped_ptr<RunMicrotasksObserver> task_observer_; |
83 scoped_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_; | 90 scoped_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_; |
84 AccessMode access_mode_; | 91 AccessMode access_mode_; |
85 | 92 |
86 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); | 93 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); |
87 }; | 94 }; |
88 | 95 |
89 } // namespace gin | 96 } // namespace gin |
90 | 97 |
91 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ | 98 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ |
OLD | NEW |