#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include <fstream>
#include <iostream>
#include "base/functional/callback.h"
#include "base/notreached.h"
#include "gin/public/v8_platform.h"
#include "third_party/blink/renderer/platform/bindings/dom_data_store.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/bindings/wrapper_type_info.h"
#include "third_party/blink/renderer/platform/heap/custom_spaces.h"
#include "third_party/blink/renderer/platform/heap/thread_state_storage.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "v8/include/cppgc/heap-consistency.h"
#include "v8/include/v8-cppgc.h"
#include "v8/include/v8-embedder-heap.h"
#include "v8/include/v8-isolate.h"
#include "v8/include/v8-object.h"
#include "v8/include/v8-profiler.h"
#include "v8/include/v8-traced-handle.h"
namespace blink {
namespace {
class BlinkRootsHandler final : public v8::EmbedderRootsHandler { … };
}
ThreadState* ThreadState::AttachMainThread() { … }
ThreadState* ThreadState::AttachMainThreadForTesting(v8::Platform* platform) { … }
ThreadState* ThreadState::AttachCurrentThread() { … }
ThreadState* ThreadState::AttachCurrentThreadForTesting(
v8::Platform* platform) { … }
void ThreadState::DetachCurrentThread() { … }
void ThreadState::AttachToIsolate(v8::Isolate* isolate,
V8BuildEmbedderGraphCallback) { … }
void ThreadState::DetachFromIsolate() { … }
ThreadState::ThreadState(v8::Platform* platform)
: … { … }
ThreadState::~ThreadState() { … }
void ThreadState::CollectAllGarbageForTesting(StackState stack_state) { … }
void ThreadState::CollectGarbageInYoungGenerationForTesting(
StackState stack_state) { … }
namespace {
class CustomSpaceStatisticsReceiverImpl final
: public v8::CustomSpaceStatisticsReceiver { … };
}
void ThreadState::CollectNodeAndCssStatistics(
base::OnceCallback<void(size_t allocated_node_bytes,
size_t allocated_css_bytes)> callback) { … }
void ThreadState::EnableDetachedGarbageCollectionsForTesting() { … }
bool ThreadState::IsIncrementalMarking() { … }
namespace {
class BufferedStream final : public v8::OutputStream { … };
}
void ThreadState::TakeHeapSnapshotForTesting(const char* filename) const { … }
bool ThreadState::IsTakingHeapSnapshot() const { … }
const char* ThreadState::CopyNameForHeapSnapshot(const char* name) const { … }
}