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

Side by Side Diff: include/v8.h

Issue 1815153002: Introduce EmbedderHeapTracer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix formatting 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 (*GCAliveHandleCallback)(Persistent<Object>* handle,
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 why not add a new method on PersistentBase?
Marcel Hlopko 2016/03/21 14:29:58 Done.
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 V8_EXPORT EmbedderHeapTracer { // NOLINT
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 what is // NOLINT needed for? since the class doe
Marcel Hlopko 2016/03/21 14:29:58 Done.
5365 public:
5366 virtual ~EmbedderHeapTracer() {}
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 should this be protected?
5367 virtual void TraceWrappablesFrom(Isolate* isolate, Persistent<Object>* value,
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 Do you expect this method to return immediately? D
Marcel Hlopko 2016/03/21 14:29:58 I added the comment, made the method pure virtual.
5368 GCAliveHandleCallback callback) {}
5369 /**
5370 * V8 allocation is *not* allowed in the `ClearTracingMarks`.
5371 */
5372 virtual void ClearTracingMarks(Isolate* isolate) {}
5373 };
5353 5374
5354 /** 5375 /**
5355 * Isolate represents an isolated instance of the V8 engine. V8 isolates have 5376 * 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 5377 * 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 5378 * 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 5379 * 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 5380 * thread at any given time. The Locker/Unlocker API must be used to
5360 * synchronize. 5381 * synchronize.
5361 */ 5382 */
5362 class V8_EXPORT Isolate { 5383 class V8_EXPORT Isolate {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
5805 void AddGCPrologueCallback(GCCallback callback, 5826 void AddGCPrologueCallback(GCCallback callback,
5806 GCType gc_type_filter = kGCTypeAll); 5827 GCType gc_type_filter = kGCTypeAll);
5807 5828
5808 /** 5829 /**
5809 * This function removes callback which was installed by 5830 * This function removes callback which was installed by
5810 * AddGCPrologueCallback function. 5831 * AddGCPrologueCallback function.
5811 */ 5832 */
5812 void RemoveGCPrologueCallback(GCCallback callback); 5833 void RemoveGCPrologueCallback(GCCallback callback);
5813 5834
5814 /** 5835 /**
5836 * Sets the embedder heap tracer for the isolate.
5837 */
5838 void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
5839
5840 /**
5841 * This function removes the tracer installed by `SetEmbedderHeapTracer`
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 please no backticks you could require the Embedde
Marcel Hlopko 2016/03/21 14:29:58 I will gladly remove the method, I don't think it
5842 * function.
5843 */
5844 void UnsetEmbedderHeapTracer();
5845
5846 /**
5815 * Enables the host application to receive a notification after a 5847 * Enables the host application to receive a notification after a
5816 * garbage collection. Allocations are allowed in the callback function, 5848 * garbage collection. Allocations are allowed in the callback function,
5817 * but the callback is not re-entrant: if the allocation inside it will 5849 * 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. 5850 * 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 5851 * 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 5852 * not possible to register the same callback function two times with
5821 * different GCType filters. 5853 * different GCType filters.
5822 */ 5854 */
5823 void AddGCEpilogueCallback(GCCallback callback, 5855 void AddGCEpilogueCallback(GCCallback callback,
5824 GCType gc_type_filter = kGCTypeAll); 5856 GCType gc_type_filter = kGCTypeAll);
(...skipping 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after
8670 */ 8702 */
8671 8703
8672 8704
8673 } // namespace v8 8705 } // namespace v8
8674 8706
8675 8707
8676 #undef TYPE_CHECK 8708 #undef TYPE_CHECK
8677 8709
8678 8710
8679 #endif // INCLUDE_V8_H_ 8711 #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