Commit 66938acc authored by Michael Lippautz's avatar Michael Lippautz Committed by Chromium LUCI CQ

platform: More compilation fixes for Oilpan library

- Introduce LivenessBroker
- Fix IWYU
- Fix LSAN scope

Bug: 1056170
Change-Id: I7e685d0833932fa0e3e1a14dcf64e1fc48349461
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2642334
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#846025}
parent ceadb112
......@@ -11,8 +11,6 @@
namespace blink {
class LivenessBroker;
// ActiveScriptWrappableManager (ASWM) is integrated into the garbage collector
// and keeps ActiveScriptWrappable alive as long as they have
// HasPendingActivity() returning true and are attached to a live
......
......@@ -196,10 +196,7 @@ source_set("test_support") {
sources = [ "heap_test_utilities.h" ]
if (enable_blink_heap_use_v8_oilpan) {
sources += [
"v8_wrapper/heap_test_utilities.cc",
"v8_wrapper/heap_test_utilities.h",
]
sources += [ "v8_wrapper/heap_test_utilities.h" ]
} else {
sources += [
"impl/heap_test_utilities.cc",
......
......@@ -975,15 +975,6 @@ void ThreadState::RemoveObserver(BlinkGCObserver* observer) {
observers_.erase(observer);
}
void ThreadState::EnterStaticReferenceRegistrationDisabledScope() {
static_persistent_registration_disabled_count_++;
}
void ThreadState::LeaveStaticReferenceRegistrationDisabledScope() {
DCHECK(static_persistent_registration_disabled_count_);
static_persistent_registration_disabled_count_--;
}
void ThreadState::InvokePreFinalizers() {
DCHECK(CheckThread());
DCHECK(!SweepForbidden());
......
......@@ -461,9 +461,6 @@ class PLATFORM_EXPORT ThreadState final {
gc_forbidden_count_--;
}
void EnterStaticReferenceRegistrationDisabledScope();
void LeaveStaticReferenceRegistrationDisabledScope();
// Performs stand-alone garbage collections considering only C++ objects.
//
// Use the public *ForTesting calls for calling GC in tests.
......@@ -614,7 +611,6 @@ class PLATFORM_EXPORT ThreadState final {
bool forced_scheduled_gc_for_testing_ = false;
size_t no_allocation_count_ = 0;
size_t gc_forbidden_count_ = 0;
size_t static_persistent_registration_disabled_count_ = 0;
GCState gc_state_ = GCState::kNoGCScheduled;
GCPhase gc_phase_ = GCPhase::kNone;
......
......@@ -94,35 +94,6 @@ class ThreadState::HeapPointersOnStackScope final {
ThreadState* const state_;
};
#if defined(LEAK_SANITIZER)
class ThreadState::LsanDisabledScope final {
STACK_ALLOCATED();
DISALLOW_COPY_AND_ASSIGN(LsanDisabledScope);
public:
explicit LsanDisabledScope(ThreadState* thread_state)
: thread_state_(thread_state) {
__lsan_disable();
if (thread_state_)
thread_state_->EnterStaticReferenceRegistrationDisabledScope();
}
~LsanDisabledScope() {
__lsan_enable();
if (thread_state_)
thread_state_->LeaveStaticReferenceRegistrationDisabledScope();
}
private:
ThreadState* const thread_state_;
};
#define LEAK_SANITIZER_DISABLED_SCOPE \
ThreadState::LsanDisabledScope lsan_disabled_scope(ThreadState::Current())
#else
#define LEAK_SANITIZER_DISABLED_SCOPE
#endif
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_IMPL_THREAD_STATE_SCOPES_H_
......@@ -9,6 +9,7 @@
#include "third_party/blink/renderer/platform/wtf/buildflags.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h"
#include "third_party/blink/renderer/platform/wtf/type_traits.h"
#include "third_party/blink/renderer/platform/wtf/vector_traits.h"
#if BUILDFLAG(USE_V8_OILPAN)
#include "third_party/blink/renderer/platform/heap/v8_wrapper/persistent.h"
......
......@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_THREAD_STATE_SCOPES_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_THREAD_STATE_SCOPES_H_
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/buildflags.h"
#if BUILDFLAG(USE_V8_OILPAN)
......@@ -13,4 +14,26 @@
#include "third_party/blink/renderer/platform/heap/impl/thread_state_scopes.h"
#endif // !USE_V8_OILPAN
namespace blink {
#if defined(LEAK_SANITIZER)
class LsanDisabledScope final {
STACK_ALLOCATED();
public:
explicit LsanDisabledScope() { __lsan_disable(); }
~LsanDisabledScope() { __lsan_enable(); }
LsanDisabledScope(const LsanDisabledScope&) = delete;
LsanDisabledScope& operator=(const LsanDisabledScope&) = delete;
};
#define LEAK_SANITIZER_DISABLED_SCOPE LsanDisabledScope lsan_disabled_scope
#else
#define LEAK_SANITIZER_DISABLED_SCOPE
#endif
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_THREAD_STATE_SCOPES_H_
......@@ -8,9 +8,12 @@
#include "third_party/blink/renderer/platform/heap/v8_wrapper/thread_state.h"
#include "v8/include/cppgc/allocation.h"
#include "v8/include/cppgc/garbage-collected.h"
#include "v8/include/cppgc/liveness-broker.h"
namespace blink {
using LivenessBroker = cppgc::LivenessBroker;
template <typename T>
using GarbageCollected = cppgc::GarbageCollected<T>;
......
......@@ -26,6 +26,7 @@
#include <memory>
#include "base/optional.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_client.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h"
......
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