Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: include/v8.h

Issue 1815153002: Introduce EmbedderHeapTracer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate Jochen'c comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5140 matching lines...) Expand 10 before | Expand all | Expand 10 after
5151 */ 5151 */
5152 enum GCCallbackFlags { 5152 enum GCCallbackFlags {
5153 kNoGCCallbackFlags = 0, 5153 kNoGCCallbackFlags = 0,
5154 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1, 5154 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1,
5155 kGCCallbackFlagForced = 1 << 2, 5155 kGCCallbackFlagForced = 1 << 2,
5156 kGCCallbackFlagSynchronousPhantomCallbackProcessing = 1 << 3, 5156 kGCCallbackFlagSynchronousPhantomCallbackProcessing = 1 << 3,
5157 kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4, 5157 kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4,
5158 }; 5158 };
5159 5159
5160 typedef void (*GCCallback)(GCType type, GCCallbackFlags flags); 5160 typedef void (*GCCallback)(GCType type, GCCallbackFlags flags);
5161 typedef void (*GCPutOnMarkingDequeCallback)(PersistentBase<Object>* handle,
5162 Isolate* isolate);
5161 5163
5162 typedef void (*InterruptCallback)(Isolate* isolate, void* data); 5164 typedef void (*InterruptCallback)(Isolate* isolate, void* data);
5163 5165
5164 5166
5165 /** 5167 /**
5166 * Collection of V8 heap information. 5168 * Collection of V8 heap information.
5167 * 5169 *
5168 * Instances of this class can be passed to v8::V8::HeapStatistics to 5170 * Instances of this class can be passed to v8::V8::HeapStatistics to
5169 * get heap statistics from V8. 5171 * get heap statistics from V8.
5170 */ 5172 */
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
5343 /** 5345 /**
5344 * Interface for iterating through all the persistent handles in the heap. 5346 * Interface for iterating through all the persistent handles in the heap.
5345 */ 5347 */
5346 class V8_EXPORT PersistentHandleVisitor { // NOLINT 5348 class V8_EXPORT PersistentHandleVisitor { // NOLINT
5347 public: 5349 public:
5348 virtual ~PersistentHandleVisitor() {} 5350 virtual ~PersistentHandleVisitor() {}
5349 virtual void VisitPersistentHandle(Persistent<Value>* value, 5351 virtual void VisitPersistentHandle(Persistent<Value>* value,
5350 uint16_t class_id) {} 5352 uint16_t class_id) {}
5351 }; 5353 };
5352 5354
5355 /**
5356 * Interface for tracing through the embedder heap. During the v8 garbage
5357 * collection, the embedder is notified that some object he has a reference to
5358 * is still alive, and is expected to trace through its heap and call callback
5359 * function for each dependent js object.
5360 *
5361 * After the v8 garbage collection is finished, ClearTracingMarks is called so
5362 * the embedder can clear its temporary data.
5363 */
5364 class EmbedderHeapTracer {
5365 public:
5366 virtual ~EmbedderHeapTracer() {}
5367 /**
5368 * V8 will call this method with every wrapper. Embedder is expected to call
5369 * the provided callback (synchronously) with every dependent wrapper so the
5370 * v8 will keep it alive.
5371 */
5372 virtual void TraceWrappableFrom(Isolate* isolate, Persistent<Object>* value,
5373 GCPutOnMarkingDequeCallback callback);
jochen (gone - plz use gerrit) 2016/03/24 14:31:36 as discussed offline, I'd propose to not add callb
5374 /**
5375 * V8 allocation is *not* allowed in the ClearTracingMarks.
5376 */
5377 virtual void ClearTracingMarks(Isolate* isolate) {}
5378 };
5353 5379
5354 /** 5380 /**
5355 * Isolate represents an isolated instance of the V8 engine. V8 isolates have 5381 * Isolate represents an isolated instance of the V8 engine. V8 isolates have
5356 * completely separate states. Objects from one isolate must not be used in 5382 * completely separate states. Objects from one isolate must not be used in
5357 * other isolates. The embedder can create multiple isolates and use them in 5383 * other isolates. The embedder can create multiple isolates and use them in
5358 * parallel in multiple threads. An isolate can be entered by at most one 5384 * parallel in multiple threads. An isolate can be entered by at most one
5359 * thread at any given time. The Locker/Unlocker API must be used to 5385 * thread at any given time. The Locker/Unlocker API must be used to
5360 * synchronize. 5386 * synchronize.
5361 */ 5387 */
5362 class V8_EXPORT Isolate { 5388 class V8_EXPORT Isolate {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
5805 void AddGCPrologueCallback(GCCallback callback, 5831 void AddGCPrologueCallback(GCCallback callback,
5806 GCType gc_type_filter = kGCTypeAll); 5832 GCType gc_type_filter = kGCTypeAll);
5807 5833
5808 /** 5834 /**
5809 * This function removes callback which was installed by 5835 * This function removes callback which was installed by
5810 * AddGCPrologueCallback function. 5836 * AddGCPrologueCallback function.
5811 */ 5837 */
5812 void RemoveGCPrologueCallback(GCCallback callback); 5838 void RemoveGCPrologueCallback(GCCallback callback);
5813 5839
5814 /** 5840 /**
5841 * Sets the embedder heap tracer for the isolate.
5842 */
5843 void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
5844
5845 /**
5815 * Enables the host application to receive a notification after a 5846 * Enables the host application to receive a notification after a
5816 * garbage collection. Allocations are allowed in the callback function, 5847 * garbage collection. Allocations are allowed in the callback function,
5817 * but the callback is not re-entrant: if the allocation inside it will 5848 * but the callback is not re-entrant: if the allocation inside it will
5818 * trigger the garbage collection, the callback won't be called again. 5849 * trigger the garbage collection, the callback won't be called again.
5819 * It is possible to specify the GCType filter for your callback. But it is 5850 * It is possible to specify the GCType filter for your callback. But it is
5820 * not possible to register the same callback function two times with 5851 * not possible to register the same callback function two times with
5821 * different GCType filters. 5852 * different GCType filters.
5822 */ 5853 */
5823 void AddGCEpilogueCallback(GCCallback callback, 5854 void AddGCEpilogueCallback(GCCallback callback,
5824 GCType gc_type_filter = kGCTypeAll); 5855 GCType gc_type_filter = kGCTypeAll);
(...skipping 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after
8670 */ 8701 */
8671 8702
8672 8703
8673 } // namespace v8 8704 } // namespace v8
8674 8705
8675 8706
8676 #undef TYPE_CHECK 8707 #undef TYPE_CHECK
8677 8708
8678 8709
8679 #endif // INCLUDE_V8_H_ 8710 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698