Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
| 6 * | 6 * |
| 7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
| 8 * | 8 * |
| 9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
| 10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
| (...skipping 5432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5443 | 5443 |
| 5444 /** | 5444 /** |
| 5445 * Types of garbage collections that can be requested via | 5445 * Types of garbage collections that can be requested via |
| 5446 * RequestGarbageCollectionForTesting. | 5446 * RequestGarbageCollectionForTesting. |
| 5447 */ | 5447 */ |
| 5448 enum GarbageCollectionType { | 5448 enum GarbageCollectionType { |
| 5449 kFullGarbageCollection, | 5449 kFullGarbageCollection, |
| 5450 kMinorGarbageCollection | 5450 kMinorGarbageCollection |
| 5451 }; | 5451 }; |
| 5452 | 5452 |
| 5453 | |
| 5454 /** | |
| 5455 * Policy for running microtasks: | |
| 5456 * - explicit: microtasks are invoked with RunMicrotasks() method; | |
| 5457 * - scoped: microtasks invocation is controlled by MicrotasksScope objects; | |
| 5458 * - auto: microtasks are invoked when the script call depth decrements | |
| 5459 * to zero. | |
| 5460 */ | |
| 5461 enum MicrotasksPolicy { | |
|
jochen (gone - plz use gerrit)
2016/03/01 14:26:08
i'd prefer an enum class
dgozman
2016/03/03 01:22:06
Done.
| |
| 5462 kExplicitMicrotasksInvocation, | |
| 5463 kScopedMicrotasksInvocation, | |
| 5464 kAutoMicrotasksInvocation | |
| 5465 }; | |
| 5466 | |
| 5467 | |
| 5453 /** | 5468 /** |
| 5454 * Features reported via the SetUseCounterCallback callback. Do not change | 5469 * Features reported via the SetUseCounterCallback callback. Do not change |
| 5455 * assigned numbers of existing items; add new features to the end of this | 5470 * assigned numbers of existing items; add new features to the end of this |
| 5456 * list. | 5471 * list. |
| 5457 */ | 5472 */ |
| 5458 enum UseCounterFeature { | 5473 enum UseCounterFeature { |
| 5459 kUseAsm = 0, | 5474 kUseAsm = 0, |
| 5460 kBreakIterator = 1, | 5475 kBreakIterator = 1, |
| 5461 kLegacyConst = 2, | 5476 kLegacyConst = 2, |
| 5462 kMarkDequeOverflow = 3, | 5477 kMarkDequeOverflow = 3, |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5877 /** | 5892 /** |
| 5878 * Experimental: Enqueues the callback to the Microtask Work Queue | 5893 * Experimental: Enqueues the callback to the Microtask Work Queue |
| 5879 */ | 5894 */ |
| 5880 void EnqueueMicrotask(Local<Function> microtask); | 5895 void EnqueueMicrotask(Local<Function> microtask); |
| 5881 | 5896 |
| 5882 /** | 5897 /** |
| 5883 * Experimental: Enqueues the callback to the Microtask Work Queue | 5898 * Experimental: Enqueues the callback to the Microtask Work Queue |
| 5884 */ | 5899 */ |
| 5885 void EnqueueMicrotask(MicrotaskCallback microtask, void* data = NULL); | 5900 void EnqueueMicrotask(MicrotaskCallback microtask, void* data = NULL); |
| 5886 | 5901 |
| 5887 /** | 5902 /** |
| 5888 * Experimental: Controls whether the Microtask Work Queue is automatically | 5903 * Experimental: Controls how Microtasks are invoked. See MicrotasksPolicy |
| 5889 * run when the script call depth decrements to zero. | 5904 * for details. |
| 5890 */ | 5905 */ |
| 5891 void SetAutorunMicrotasks(bool autorun); | 5906 void SetMicrotasksPolicy(MicrotasksPolicy policy); |
| 5907 V8_DEPRECATE_SOON( | |
| 5908 "Use SetMicrotasksPolicy", | |
| 5909 void SetAutorunMicrotasks(bool autorun)); | |
| 5892 | 5910 |
| 5893 /** | 5911 /** |
| 5894 * Experimental: Returns whether the Microtask Work Queue is automatically | 5912 * Experimental: Returns the policy controlling how Microtasks are invoked. |
| 5895 * run when the script call depth decrements to zero. | |
| 5896 */ | 5913 */ |
| 5897 bool WillAutorunMicrotasks() const; | 5914 MicrotasksPolicy GetMicrotasksPolicy() const; |
| 5915 V8_DEPRECATE_SOON( | |
| 5916 "Use GetMicrotasksPolicy", | |
| 5917 bool WillAutorunMicrotasks() const); | |
| 5898 | 5918 |
| 5899 /** | 5919 /** |
| 5900 * Experimental: adds a callback to notify the host application after | 5920 * Experimental: adds a callback to notify the host application after |
| 5901 * microtasks were run. The callback is triggered by explicit RunMicrotasks | 5921 * microtasks were run. The callback is triggered by explicit RunMicrotasks |
| 5902 * call or automatic microtasks execution (see SetAutorunMicrotasks). | 5922 * call or automatic microtasks execution (see SetAutorunMicrotasks). |
| 5903 * | 5923 * |
| 5904 * Callback will trigger even if microtasks were attempted to run, | 5924 * Callback will trigger even if microtasks were attempted to run, |
| 5905 * but the microtasks queue was empty and no single microtask was actually | 5925 * but the microtasks queue was empty and no single microtask was actually |
| 5906 * executed. | 5926 * executed. |
| 5907 * | 5927 * |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6137 }; | 6157 }; |
| 6138 | 6158 |
| 6139 class V8_EXPORT StartupData { | 6159 class V8_EXPORT StartupData { |
| 6140 public: | 6160 public: |
| 6141 const char* data; | 6161 const char* data; |
| 6142 int raw_size; | 6162 int raw_size; |
| 6143 }; | 6163 }; |
| 6144 | 6164 |
| 6145 | 6165 |
| 6146 /** | 6166 /** |
| 6167 * This scope is used to control microtasks when kScopeMicrotasksInvocation | |
| 6168 * is used on Isolate. In this mode every non-primitive call to V8 should be | |
| 6169 * done inside some MicrotasksScope. | |
| 6170 * Microtasks are executed when topmost MicrotasksScope marked as kRunMicrotasks | |
| 6171 * exits. | |
| 6172 * kDoNotRunMicrotasks should be used to annotate calls not intended to trigger | |
| 6173 * microtasks. | |
| 6174 */ | |
| 6175 class V8_EXPORT MicrotasksScope { | |
| 6176 public: | |
| 6177 enum Type { kRunMicrotasks, kDoNotRunMicrotasks }; | |
| 6178 | |
| 6179 MicrotasksScope(Isolate* isolate, Type type); | |
| 6180 ~MicrotasksScope(); | |
| 6181 | |
| 6182 /** | |
| 6183 * Runs microtasks if no kRunMicrotasks scope is currently active. | |
| 6184 */ | |
| 6185 static void PerformCheckpoint(Isolate*); | |
| 6186 | |
| 6187 /** | |
| 6188 * Returns current recursion level of scope objects. | |
| 6189 */ | |
| 6190 static int GetRecursionLevel(Isolate*); | |
| 6191 | |
| 6192 private: | |
| 6193 void* internal_; | |
| 6194 | |
| 6195 // Prevent copying. | |
| 6196 MicrotasksScope(const MicrotasksScope&); | |
| 6197 MicrotasksScope& operator=(const MicrotasksScope&); | |
| 6198 }; | |
| 6199 | |
| 6200 | |
| 6201 /** | |
| 6147 * EntropySource is used as a callback function when v8 needs a source | 6202 * EntropySource is used as a callback function when v8 needs a source |
| 6148 * of entropy. | 6203 * of entropy. |
| 6149 */ | 6204 */ |
| 6150 typedef bool (*EntropySource)(unsigned char* buffer, size_t length); | 6205 typedef bool (*EntropySource)(unsigned char* buffer, size_t length); |
| 6151 | 6206 |
| 6152 | 6207 |
| 6153 /** | 6208 /** |
| 6154 * ReturnAddressLocationResolver is used as a callback function when v8 is | 6209 * ReturnAddressLocationResolver is used as a callback function when v8 is |
| 6155 * resolving the location of a return address on the stack. Profilers that | 6210 * resolving the location of a return address on the stack. Profilers that |
| 6156 * change the return address on the stack can use this to resolve the stack | 6211 * change the return address on the stack can use this to resolve the stack |
| (...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8592 */ | 8647 */ |
| 8593 | 8648 |
| 8594 | 8649 |
| 8595 } // namespace v8 | 8650 } // namespace v8 |
| 8596 | 8651 |
| 8597 | 8652 |
| 8598 #undef TYPE_CHECK | 8653 #undef TYPE_CHECK |
| 8599 | 8654 |
| 8600 | 8655 |
| 8601 #endif // INCLUDE_V8_H_ | 8656 #endif // INCLUDE_V8_H_ |
| OLD | NEW |