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

Unified Diff: include/v8.h

Issue 2474163002: [api] Remove EmbedderReachableReferenceReporter (Closed)
Patch Set: Remove old api Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/v8-util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index eb1f08a60942d13f71cbb7b9f0e8ab77dcb14451..f93885863a6d5aa098dc2973fdbc6fe4572aaa7d 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -463,16 +463,6 @@ class WeakCallbackInfo {
enum class WeakCallbackType { kParameter, kInternalFields, kFinalizer };
/**
- * A reporter class that embedder will use to report reachable references found
- * by EmbedderHeapTracer.
- */
-class V8_EXPORT EmbedderReachableReferenceReporter {
- public:
- virtual void ReportExternalReference(Value* object) = 0;
- virtual ~EmbedderReachableReferenceReporter() = default;
-};
-
-/**
* An object reference that is independent of any handle scope. Where
* a Local handle only lives as long as the HandleScope in which it was
* allocated, a PersistentBase handle remains valid until it is explicitly
@@ -569,18 +559,11 @@ template <class T> class PersistentBase {
V8_INLINE void ClearWeak() { ClearWeak<void>(); }
/**
- * Deprecated.
- * TODO(hlopko): remove once migration to reporter is finished.
- */
- V8_INLINE void RegisterExternalReference(Isolate* isolate) const {}
-
- /**
* Allows the embedder to tell the v8 garbage collector that a certain object
* is alive. Only allowed when the embedder is asked to trace its heap by
* EmbedderHeapTracer.
*/
- V8_INLINE void RegisterExternalReference(
- EmbedderReachableReferenceReporter* reporter) const;
+ V8_INLINE void RegisterExternalReference(Isolate* isolate) const;
/**
* Marks the reference to this object independent. Garbage collector is free
@@ -6169,11 +6152,11 @@ class V8_EXPORT PersistentHandleVisitor { // NOLINT
enum class MemoryPressureLevel { kNone, kModerate, kCritical };
/**
- * Interface for tracing through the embedder heap. During the v8 garbage
+ * Interface for tracing through the embedder heap. During a v8 garbage
* collection, v8 collects hidden fields of all potential wrappers, and at the
* end of its marking phase iterates the collection and asks the embedder to
- * trace through its heap and use reporter to report each js object reachable
- * from any of the given wrappers.
+ * trace through its heap and use reporter to report each JavaScript object
+ * reachable from any of the given wrappers.
*
* Before the first call to the TraceWrappersFrom function TracePrologue will be
* called. When the garbage collection cycle is finished, TraceEpilogue will be
@@ -6191,30 +6174,26 @@ class V8_EXPORT EmbedderHeapTracer {
};
/**
- * V8 will call this method with internal fields of found wrappers. The
- * embedder is expected to store them in its marking deque and trace
- * reachable wrappers from them when called through |AdvanceTracing|.
+ * Called by v8 to register internal fields of found wrappers.
+ *
+ * The embedder is expected to store them somewhere and trace reachable
+ * wrappers from them when called through |AdvanceTracing|.
*/
virtual void RegisterV8References(
const std::vector<std::pair<void*, void*> >& internal_fields) = 0;
/**
- * Deprecated.
- * TODO(hlopko) Remove once the migration to reporter is finished.
- */
- virtual void TracePrologue() {}
-
- /**
- * V8 will call this method at the beginning of a GC cycle. Embedder is
- * expected to use EmbedderReachableReferenceReporter for reporting all
- * reachable v8 objects.
+ * Called at the beginning of a GC cycle.
*/
- virtual void TracePrologue(EmbedderReachableReferenceReporter* reporter) {}
+ virtual void TracePrologue() = 0;
/**
- * Embedder is expected to trace its heap starting from wrappers reported by
- * RegisterV8References method, and use reporter for all reachable wrappers.
- * Embedder is expected to stop tracing by the given deadline.
+ * Called to to make a tracing step in the embedder.
+ *
+ * The embedder is expected to trace its heap starting from wrappers reported
+ * by RegisterV8References method, and report back all reachable wrappers.
+ * Furthermore, the embedder is expected to stop tracing by the given
+ * deadline.
*
* Returns true if there is still work to do.
*/
@@ -6222,22 +6201,25 @@ class V8_EXPORT EmbedderHeapTracer {
AdvanceTracingActions actions) = 0;
/**
- * V8 will call this method at the end of a GC cycle.
+ * Called at the end of a GC cycle.
*
* Note that allocation is *not* allowed within |TraceEpilogue|.
*/
virtual void TraceEpilogue() = 0;
/**
- * Let embedder know v8 entered final marking pause (no more incremental steps
- * will follow).
+ * Called upon entering the final marking pause. No more incremental marking
+ * steps will follow this call.
*/
- virtual void EnterFinalPause() {}
+ virtual void EnterFinalPause() = 0;
/**
- * Throw away all intermediate data and reset to the initial state.
+ * Called when tracing is aborted.
+ *
+ * The embedder is expected to throw away all intermediate data and reset to
+ * the initial state.
*/
- virtual void AbortTracing() {}
+ virtual void AbortTracing() = 0;
/**
* Returns the number of wrappers that are still to be traced by the embedder.
@@ -7550,6 +7532,9 @@ class V8_EXPORT V8 {
int* index);
static Local<Value> GetEternal(Isolate* isolate, int index);
+ static void RegisterExternallyReferencedObject(internal::Object** object,
+ internal::Isolate* isolate);
+
template <class K, class V, class T>
friend class PersistentValueMapBase;
@@ -8620,10 +8605,11 @@ P* PersistentBase<T>::ClearWeak() {
}
template <class T>
-void PersistentBase<T>::RegisterExternalReference(
- EmbedderReachableReferenceReporter* reporter) const {
+void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const {
if (IsEmpty()) return;
- reporter->ReportExternalReference(this->val_);
+ V8::RegisterExternallyReferencedObject(
+ reinterpret_cast<internal::Object**>(this->val_),
+ reinterpret_cast<internal::Isolate*>(isolate));
}
template <class T>
« no previous file with comments | « no previous file | include/v8-util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698