Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: Source/bindings/core/v8/ScriptPromisePropertyTest.cpp

Issue 1322673003: Do not run GC in ScriptPromisePropertyBase::destroyContext(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
diff --git a/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp b/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
index 0d6f95941e77e5147e5ab221ec08ebbc80ce7ed7..251ef477c75ca8455c6ad32ef72235c211e72f00 100644
--- a/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
+++ b/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp
@@ -131,7 +131,7 @@ public:
virtual ~ScriptPromisePropertyTestBase()
{
- ScriptPromisePropertyTestBase::destroyContext();
+ destroyContext();
}
Document& document() { return m_page->document(); }
@@ -142,15 +142,13 @@ public:
DOMWrapperWorld& otherWorld() { return m_otherScriptState->world(); }
ScriptState* currentScriptState() { return ScriptState::current(isolate()); }
- virtual void destroyContext()
+ void destroyContext()
{
m_page.clear();
if (m_otherScriptState) {
m_otherScriptState->disposePerContextData();
m_otherScriptState = nullptr;
}
- gc();
- Heap::collectAllGarbage();
}
void gc() { V8GCController::collectGarbage(v8::Isolate::GetCurrent()); }
@@ -188,12 +186,6 @@ public:
Property* property() { return m_holder->property(); }
ScriptPromise promise(DOMWrapperWorld& world) { return property()->promise(world); }
- void destroyContext() override
- {
- m_holder = nullptr;
- ScriptPromisePropertyTestBase::destroyContext();
- }
-
private:
Persistent<GarbageCollectedHolder> m_holder;
};
@@ -362,29 +354,26 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reject_RejectsScriptPromise)
TEST_F(ScriptPromisePropertyGarbageCollectedTest, Promise_DeadContext)
{
- Persistent<Property> property = this->property();
- property->resolve(new GarbageCollectedScriptWrappable("value"));
- EXPECT_EQ(Property::Resolved, property->state());
+ property()->resolve(new GarbageCollectedScriptWrappable("value"));
+ EXPECT_EQ(Property::Resolved, property()->state());
destroyContext();
- EXPECT_TRUE(property->promise(DOMWrapperWorld::mainWorld()).isEmpty());
+ EXPECT_TRUE(property()->promise(DOMWrapperWorld::mainWorld()).isEmpty());
}
TEST_F(ScriptPromisePropertyGarbageCollectedTest, Resolve_DeadContext)
{
- Persistent<Property> property = this->property();
-
{
ScriptState::Scope scope(mainScriptState());
- property->promise(DOMWrapperWorld::mainWorld()).then(notReached(currentScriptState()), notReached(currentScriptState()));
+ property()->promise(DOMWrapperWorld::mainWorld()).then(notReached(currentScriptState()), notReached(currentScriptState()));
}
destroyContext();
- EXPECT_TRUE(!property->executionContext() || property->executionContext()->activeDOMObjectsAreStopped());
+ EXPECT_TRUE(!property()->executionContext() || property()->executionContext()->activeDOMObjectsAreStopped());
- property->resolve(new GarbageCollectedScriptWrappable("value"));
- EXPECT_EQ(Property::Pending, property->state());
+ property()->resolve(new GarbageCollectedScriptWrappable("value"));
+ EXPECT_EQ(Property::Pending, property()->state());
v8::Isolate::GetCurrent()->RunMicrotasks();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698