Chromium Code Reviews| 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 kExperimentalV8Extras, | |
|
domenic
2015/12/02 18:07:23
It'd be less confusing to name this kStableAndExpe
yhirano
2015/12/03 02:21:05
Done.
| |
| 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); |
| 59 static void Initialize(ScriptMode mode, | |
|
jochen (gone - plz use gerrit)
2015/12/02 13:09:18
please add the parameter explicitly everywhere
yhirano
2015/12/03 02:21:05
Done.
| |
| 60 v8::ArrayBuffer::Allocator* allocator) { | |
| 61 Initialize(mode, kStableV8Extras, allocator); | |
| 62 } | |
| 52 | 63 |
| 53 v8::Isolate* isolate() { return isolate_; } | 64 v8::Isolate* isolate() { return isolate_; } |
| 54 | 65 |
| 55 // The implementations of Object.observe() and Promise enqueue v8 Microtasks | 66 // The implementations of Object.observe() and Promise enqueue v8 Microtasks |
| 56 // that should be executed just before control is returned to the message | 67 // that should be executed just before control is returned to the message |
| 57 // loop. This method adds a MessageLoop TaskObserver which runs any pending | 68 // loop. This method adds a MessageLoop TaskObserver which runs any pending |
| 58 // Microtasks each time a Task is completed. This method should be called | 69 // 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 | 70 // once, when a MessageLoop is created and it should be called on the |
| 60 // MessageLoop's thread. | 71 // MessageLoop's thread. |
| 61 void AddRunMicrotasksObserver(); | 72 void AddRunMicrotasksObserver(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 82 scoped_ptr<RunMicrotasksObserver> task_observer_; | 93 scoped_ptr<RunMicrotasksObserver> task_observer_; |
| 83 scoped_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_; | 94 scoped_ptr<V8IsolateMemoryDumpProvider> isolate_memory_dump_provider_; |
| 84 AccessMode access_mode_; | 95 AccessMode access_mode_; |
| 85 | 96 |
| 86 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); | 97 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); |
| 87 }; | 98 }; |
| 88 | 99 |
| 89 } // namespace gin | 100 } // namespace gin |
| 90 | 101 |
| 91 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ | 102 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ |
| OLD | NEW |