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

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

Issue 2896773002: [DONT COMMIT] PaintWorklet: Move paintWorklet from 'window' to 'CSS' (Closed)
Patch Set: WIP Created 3 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "modules/csspaint/WindowPaintWorklet.h"
6
7 #include "core/frame/LocalDOMWindow.h"
8 #include "core/frame/LocalFrame.h"
9 #include "modules/csspaint/PaintWorklet.h"
10
11 namespace blink {
12
13 WindowPaintWorklet::WindowPaintWorklet(LocalDOMWindow& window)
14 : Supplement<LocalDOMWindow>(window) {}
15
16 const char* WindowPaintWorklet::SupplementName() {
17 return "WindowPaintWorklet";
18 }
19
20 // static
21 WindowPaintWorklet& WindowPaintWorklet::From(LocalDOMWindow& window) {
22 WindowPaintWorklet* supplement = static_cast<WindowPaintWorklet*>(
23 Supplement<LocalDOMWindow>::From(window, SupplementName()));
24 if (!supplement) {
25 supplement = new WindowPaintWorklet(window);
26 ProvideTo(window, SupplementName(), supplement);
27 }
28 return *supplement;
29 }
30
31 // static
32 Worklet* WindowPaintWorklet::paintWorklet(LocalDOMWindow& window) {
33 return From(window).paintWorklet();
34 }
35
36 PaintWorklet* WindowPaintWorklet::paintWorklet() {
37 if (!paint_worklet_ && GetSupplementable()->GetFrame())
38 paint_worklet_ = PaintWorklet::Create(GetSupplementable()->GetFrame());
39 return paint_worklet_.Get();
40 }
41
42 DEFINE_TRACE(WindowPaintWorklet) {
43 visitor->Trace(paint_worklet_);
44 Supplement<LocalDOMWindow>::Trace(visitor);
45 }
46
47 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698