Commit 018fd4a1 authored by tzik's avatar tzik Committed by Commit Bot

Add a regression test for crbug.com/854639

LifecycleObserver construction used to hit a CFI check failure under the
Oilpan incremental marking. This CL adds a test to confirm it's fixed
and it's not broken again.

Bug: 854639
Change-Id: If2990658921168fe83053facbc3c780607bbff07
Reviewed-on: https://chromium-review.googlesource.com/1123661Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572104}
parent 9170750f
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/lifecycle_notifier.h" #include "third_party/blink/renderer/platform/lifecycle_notifier.h"
#include "third_party/blink/renderer/platform/lifecycle_observer.h" #include "third_party/blink/renderer/platform/lifecycle_observer.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink { namespace blink {
...@@ -135,4 +136,29 @@ TEST(LifecycleContextTest, observerRemovedDuringNotifyDestroyed) { ...@@ -135,4 +136,29 @@ TEST(LifecycleContextTest, observerRemovedDuringNotifyDestroyed) {
EXPECT_TRUE(observer->ContextDestroyedCalled()); EXPECT_TRUE(observer->ContextDestroyedCalled());
} }
// This is a regression test for http://crbug.com/854639.
TEST(LifecycleContextTest, shouldNotHitCFICheckOnIncrementalMarking) {
bool was_enabled = RuntimeEnabledFeatures::HeapIncrementalMarkingEnabled();
RuntimeEnabledFeatures::SetHeapIncrementalMarkingEnabled(true);
ThreadState* thread_state = ThreadState::Current();
thread_state->IncrementalMarkingStart(BlinkGC::GCReason::kTesting);
DummyContext* context = DummyContext::Create();
// This should not cause a CFI check failure.
Persistent<TestingObserver> observer = TestingObserver::Create(context);
EXPECT_FALSE(observer->ContextDestroyedCalled());
context->NotifyContextDestroyed();
EXPECT_TRUE(observer->ContextDestroyedCalled());
context = nullptr;
while (thread_state->GetGCState() ==
ThreadState::kIncrementalMarkingStepScheduled)
thread_state->IncrementalMarkingStep();
thread_state->IncrementalMarkingFinalize();
RuntimeEnabledFeatures::SetHeapIncrementalMarkingEnabled(was_enabled);
}
} // namespace blink } // namespace blink
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