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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp

Issue 2853743002: Worklet: Introduce PaintWorkletGlobalScopeProxy (Closed)
Patch Set: address review comments Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 13 matching lines...) Expand all
24 PaintWorklet* GetPaintWorklet() { 24 PaintWorklet* GetPaintWorklet() {
25 return WindowPaintWorklet::From(*page_->GetFrame().DomWindow()) 25 return WindowPaintWorklet::From(*page_->GetFrame().DomWindow())
26 .paintWorklet(); 26 .paintWorklet();
27 } 27 }
28 28
29 protected: 29 protected:
30 std::unique_ptr<DummyPageHolder> page_; 30 std::unique_ptr<DummyPageHolder> page_;
31 }; 31 };
32 32
33 TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) { 33 TEST_F(PaintWorkletTest, GarbageCollectionOfCSSPaintDefinition) {
34 PaintWorkletGlobalScope* global_scope = 34 PaintWorkletGlobalScopeProxy* proxy = PaintWorkletGlobalScopeProxy::From(
35 GetPaintWorklet()->GetWorkletGlobalScopeProxy(); 35 GetPaintWorklet()->GetWorkletGlobalScopeProxy());
36 PaintWorkletGlobalScope* global_scope = proxy->global_scope();
36 global_scope->ScriptController()->Evaluate( 37 global_scope->ScriptController()->Evaluate(
37 ScriptSourceCode("registerPaint('foo', class { paint() { } });")); 38 ScriptSourceCode("registerPaint('foo', class { paint() { } });"));
38 39
39 CSSPaintDefinition* definition = global_scope->FindDefinition("foo"); 40 CSSPaintDefinition* definition = global_scope->FindDefinition("foo");
40 ASSERT(definition); 41 ASSERT(definition);
41 42
42 v8::Isolate* isolate = 43 v8::Isolate* isolate =
43 global_scope->ScriptController()->GetScriptState()->GetIsolate(); 44 global_scope->ScriptController()->GetScriptState()->GetIsolate();
44 ASSERT(isolate); 45 ASSERT(isolate);
45 46
(...skipping 15 matching lines...) Expand all
61 // Delete the page & associated objects. 62 // Delete the page & associated objects.
62 page_.reset(); 63 page_.reset();
63 64
64 // Run a GC, the persistent should have been collected. 65 // Run a GC, the persistent should have been collected.
65 ThreadState::Current()->CollectAllGarbage(); 66 ThreadState::Current()->CollectAllGarbage();
66 V8GCController::CollectAllGarbageForTesting(isolate); 67 V8GCController::CollectAllGarbageForTesting(isolate);
67 ASSERT(handle.IsEmpty()); 68 ASSERT(handle.IsEmpty());
68 } 69 }
69 70
70 } // namespace blink 71 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScopeProxy.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698