| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/csspaint/PaintWorklet.h" | 5 #include "modules/csspaint/PaintWorklet.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
| 8 #include "bindings/core/v8/V8GCController.h" | 8 #include "bindings/core/v8/V8GCController.h" |
| 9 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 9 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/testing/DummyPageHolder.h" | 11 #include "core/testing/DummyPageHolder.h" |
| 12 #include "modules/csspaint/CSSPaintDefinition.h" | 12 #include "modules/csspaint/CSSPaintDefinition.h" |
| 13 #include "modules/csspaint/PaintWorkletGlobalScope.h" | 13 #include "modules/csspaint/PaintWorkletGlobalScope.h" |
| 14 #include "modules/csspaint/WindowPaintWorklet.h" | 14 #include "modules/csspaint/WindowPaintWorklet.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include <memory> | 16 #include <memory> |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class PaintWorkletTest : public testing::Test { | 20 class PaintWorkletTest : public testing::Test { |
| 21 public: | 21 public: |
| 22 PaintWorkletTest() : m_page(DummyPageHolder::create()) {} | 22 PaintWorkletTest() : m_page(DummyPageHolder::create()) {} |
| 23 | 23 |
| 24 PaintWorklet* paintWorklet() { | 24 PaintWorklet* paintWorklet() { |
| 25 return WindowPaintWorklet::from(*m_page->frame().localDOMWindow()) | 25 return WindowPaintWorklet::from(*m_page->frame().domWindow()) |
| 26 .paintWorklet(); | 26 .paintWorklet(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 std::unique_ptr<DummyPageHolder> m_page; | 30 std::unique_ptr<DummyPageHolder> m_page; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) { | 33 TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) { |
| 34 PaintWorkletGlobalScope* globalScope = | 34 PaintWorkletGlobalScope* globalScope = |
| 35 paintWorklet()->workletGlobalScopeProxy(); | 35 paintWorklet()->workletGlobalScopeProxy(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 61 // Delete the page & associated objects. | 61 // Delete the page & associated objects. |
| 62 m_page.reset(); | 62 m_page.reset(); |
| 63 | 63 |
| 64 // Run a GC, the persistent should have been collected. | 64 // Run a GC, the persistent should have been collected. |
| 65 ThreadState::current()->collectAllGarbage(); | 65 ThreadState::current()->collectAllGarbage(); |
| 66 V8GCController::collectAllGarbageForTesting(isolate); | 66 V8GCController::collectAllGarbageForTesting(isolate); |
| 67 ASSERT(handle.isEmpty()); | 67 ASSERT(handle.isEmpty()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // naespace blink | 70 } // naespace blink |
| OLD | NEW |