[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/1236253
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56102}
This commit is contained in:
Michael Lippautz 2018-09-20 15:10:01 +02:00 committed by Commit Bot
parent bb10b70b91
commit 261cd2f539
5 changed files with 20 additions and 1 deletions

View File

@ -7685,6 +7685,11 @@ class V8_EXPORT Isolate {
*/
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.
*/

View File

@ -8094,6 +8094,11 @@ void Isolate::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
isolate->heap()->SetEmbedderHeapTracer(tracer);
}
EmbedderHeapTracer* Isolate::GetEmbedderHeapTracer() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
return isolate->heap()->GetEmbedderHeapTracer();
}
void Isolate::SetGetExternallyAllocatedMemoryInBytesCallback(
GetExternallyAllocatedMemoryInBytesCallback callback) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);

View File

@ -24,6 +24,8 @@ class V8_EXPORT_PRIVATE LocalEmbedderHeapTracer final {
if (remote_tracer_) remote_tracer_->isolate_ = nullptr;
}
EmbedderHeapTracer* remote_tracer() const { return remote_tracer_; }
void SetRemoteTracer(EmbedderHeapTracer* tracer) {
if (remote_tracer_) remote_tracer_->isolate_ = nullptr;

View File

@ -4665,6 +4665,10 @@ void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
local_embedder_heap_tracer()->SetRemoteTracer(tracer);
}
EmbedderHeapTracer* Heap::GetEmbedderHeapTracer() const {
return local_embedder_heap_tracer()->remote_tracer();
}
void Heap::TracePossibleWrapper(JSObject* js_object) {
DCHECK(js_object->IsApiWrapper());
if (js_object->GetEmbedderFieldCount() >= 2 &&

View File

@ -1038,10 +1038,13 @@ class Heap {
// Embedder heap tracer support. =============================================
// ===========================================================================
LocalEmbedderHeapTracer* local_embedder_heap_tracer() {
LocalEmbedderHeapTracer* local_embedder_heap_tracer() const {
return local_embedder_heap_tracer_;
}
void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
EmbedderHeapTracer* GetEmbedderHeapTracer() const;
void TracePossibleWrapper(JSObject* js_object);
void RegisterExternallyReferencedObject(Object** object);
void SetEmbedderStackStateForNextFinalizaton(