| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bindings/core/v8/ScriptPromiseResolver.h" | 5 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptFunction.h" | 7 #include "bindings/core/v8/ScriptFunction.h" |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 ScriptPromiseResolver* resolver = nullptr; | 274 ScriptPromiseResolver* resolver = nullptr; |
| 275 { | 275 { |
| 276 ScriptState::Scope scope(getScriptState()); | 276 ScriptState::Scope scope(getScriptState()); |
| 277 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState()); | 277 resolver = ScriptPromiseResolverKeepAlive::create(getScriptState()); |
| 278 } | 278 } |
| 279 resolver->keepAliveWhilePending(); | 279 resolver->keepAliveWhilePending(); |
| 280 ThreadState::current()->collectGarbage( | 280 ThreadState::current()->collectGarbage( |
| 281 BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC); | 281 BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC); |
| 282 ASSERT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); | 282 ASSERT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); |
| 283 | 283 |
| 284 getExecutionContext()->suspendActiveDOMObjects(); | 284 getExecutionContext()->suspendSuspendableObjects(); |
| 285 resolver->resolve("hello"); | 285 resolver->resolve("hello"); |
| 286 ThreadState::current()->collectGarbage( | 286 ThreadState::current()->collectGarbage( |
| 287 BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC); | 287 BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC); |
| 288 EXPECT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); | 288 EXPECT_TRUE(ScriptPromiseResolverKeepAlive::isAlive()); |
| 289 | 289 |
| 290 getExecutionContext()->notifyContextDestroyed(); | 290 getExecutionContext()->notifyContextDestroyed(); |
| 291 ThreadState::current()->collectGarbage( | 291 ThreadState::current()->collectGarbage( |
| 292 BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC); | 292 BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, BlinkGC::ForcedGC); |
| 293 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive()); | 293 EXPECT_FALSE(ScriptPromiseResolverKeepAlive::isAlive()); |
| 294 } | 294 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 resolver->reject(); | 337 resolver->reject(); |
| 338 v8::MicrotasksScope::PerformCheckpoint(isolate()); | 338 v8::MicrotasksScope::PerformCheckpoint(isolate()); |
| 339 | 339 |
| 340 EXPECT_EQ(String(), onFulfilled); | 340 EXPECT_EQ(String(), onFulfilled); |
| 341 EXPECT_EQ("undefined", onRejected); | 341 EXPECT_EQ("undefined", onRejected); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace | 344 } // namespace |
| 345 | 345 |
| 346 } // namespace blink | 346 } // namespace blink |
| OLD | NEW |