Commit 261cd2f5 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[api] Add getter for EmbedderHeapTracer

Bug: chromium:843903
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I93fffd197d1742d0b00e69e0967a9efb47921208
Reviewed-on: https://chromium-review.googlesource.com/1236253Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56102}
parent bb10b70b
...@@ -7685,6 +7685,11 @@ class V8_EXPORT Isolate { ...@@ -7685,6 +7685,11 @@ class V8_EXPORT Isolate {
*/ */
void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer); void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
/*
* Gets the currently active heap tracer for the isolate.
*/
EmbedderHeapTracer* GetEmbedderHeapTracer();
/** /**
* Use for |AtomicsWaitCallback| to indicate the type of event it receives. * Use for |AtomicsWaitCallback| to indicate the type of event it receives.
*/ */
......
...@@ -8094,6 +8094,11 @@ void Isolate::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { ...@@ -8094,6 +8094,11 @@ void Isolate::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
isolate->heap()->SetEmbedderHeapTracer(tracer); isolate->heap()->SetEmbedderHeapTracer(tracer);
} }
EmbedderHeapTracer* Isolate::GetEmbedderHeapTracer() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
return isolate->heap()->GetEmbedderHeapTracer();
}
void Isolate::SetGetExternallyAllocatedMemoryInBytesCallback( void Isolate::SetGetExternallyAllocatedMemoryInBytesCallback(
GetExternallyAllocatedMemoryInBytesCallback callback) { GetExternallyAllocatedMemoryInBytesCallback callback) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
......
...@@ -24,6 +24,8 @@ class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final { ...@@ -24,6 +24,8 @@ class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final {
if (remote_tracer_) remote_tracer_->isolate_ = nullptr; if (remote_tracer_) remote_tracer_->isolate_ = nullptr;
} }
EmbedderHeapTracer* remote_tracer() const { return remote_tracer_; }
void SetRemoteTracer(EmbedderHeapTracer* tracer) { void SetRemoteTracer(EmbedderHeapTracer* tracer) {
if (remote_tracer_) remote_tracer_->isolate_ = nullptr; if (remote_tracer_) remote_tracer_->isolate_ = nullptr;
......
...@@ -4665,6 +4665,10 @@ void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { ...@@ -4665,6 +4665,10 @@ void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
local_embedder_heap_tracer()->SetRemoteTracer(tracer); local_embedder_heap_tracer()->SetRemoteTracer(tracer);
} }
EmbedderHeapTracer* Heap::GetEmbedderHeapTracer() const {
return local_embedder_heap_tracer()->remote_tracer();
}
void Heap::TracePossibleWrapper(JSObject* js_object) { void Heap::TracePossibleWrapper(JSObject* js_object) {
DCHECK(js_object->IsApiWrapper()); DCHECK(js_object->IsApiWrapper());
if (js_object->GetEmbedderFieldCount() >= 2 && if (js_object->GetEmbedderFieldCount() >= 2 &&
......
...@@ -1038,10 +1038,13 @@ class Heap { ...@@ -1038,10 +1038,13 @@ class Heap {
// Embedder heap tracer support. ============================================= // Embedder heap tracer support. =============================================
// =========================================================================== // ===========================================================================
LocalEmbedderHeapTracer* local_embedder_heap_tracer() { LocalEmbedderHeapTracer* local_embedder_heap_tracer() const {
return local_embedder_heap_tracer_; return local_embedder_heap_tracer_;
} }
void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer); void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
EmbedderHeapTracer* GetEmbedderHeapTracer() const;
void TracePossibleWrapper(JSObject* js_object); void TracePossibleWrapper(JSObject* js_object);
void RegisterExternallyReferencedObject(Object** object); void RegisterExternallyReferencedObject(Object** object);
void SetEmbedderStackStateForNextFinalizaton( void SetEmbedderStackStateForNextFinalizaton(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment