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/CSSPaintDefinition.h

Issue 1834843002: [WIP] Plumbing for paint Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 #ifndef CSSPaintDefinition_h 5 #ifndef CSSPaintDefinition_h
6 #define CSSPaintDefinition_h 6 #define CSSPaintDefinition_h
7 7
8 #include "bindings/core/v8/ScopedPersistent.h" 8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "platform/geometry/IntSize.h" 9 #include "platform/geometry/IntSize.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include <v8.h> 11 #include <v8.h>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class Image;
15 class ScriptState; 16 class ScriptState;
16 17
17 class CSSPaintDefinition final : public GarbageCollectedFinalized<CSSPaintDefini tion> { 18 class CSSPaintDefinition final : public GarbageCollectedFinalized<CSSPaintDefini tion> {
18 public: 19 public:
19 static RawPtr<CSSPaintDefinition> create(ScriptState*, v8::Local<v8::Functio n> constructor, v8::Local<v8::Function> paint); 20 static RawPtr<CSSPaintDefinition> create(ScriptState*, v8::Local<v8::Functio n> constructor, v8::Local<v8::Function> paint);
20 virtual ~CSSPaintDefinition(); 21 virtual ~CSSPaintDefinition();
21 22
23 PassRefPtr<Image> paint(const IntSize&);
24 v8::Local<v8::Object> paintInstance();
25 ScriptState* getScriptState() const { return m_scriptState.get(); }
26
22 v8::Local<v8::Function> paintFunctionForTesting(v8::Isolate* isolate) { retu rn m_paint.newLocal(isolate); } 27 v8::Local<v8::Function> paintFunctionForTesting(v8::Isolate* isolate) { retu rn m_paint.newLocal(isolate); }
23 28
24 DEFINE_INLINE_TRACE() { }; 29 DEFINE_INLINE_TRACE() { };
25 30
26 private: 31 private:
27 CSSPaintDefinition(ScriptState*, v8::Local<v8::Function> constructor, v8::Lo cal<v8::Function> paint); 32 CSSPaintDefinition(ScriptState*, v8::Local<v8::Function> constructor, v8::Lo cal<v8::Function> paint);
28 33
34
29 RefPtr<ScriptState> m_scriptState; 35 RefPtr<ScriptState> m_scriptState;
30 36
31 // This object keeps the constructor and paint functions alive. This object 37 // This object keeps the constructor and paint functions alive. This object
32 // needs to be destroyed to break a reference cycle between it and the 38 // needs to be destroyed to break a reference cycle between it and the
33 // PaintWorkletGlobalScope. 39 // PaintWorkletGlobalScope.
34 ScopedPersistent<v8::Function> m_constructor; 40 ScopedPersistent<v8::Function> m_constructor;
35 ScopedPersistent<v8::Function> m_paint; 41 ScopedPersistent<v8::Function> m_paint;
42
43 // At the moment there is only ever one instance of a paint class per type
44 // so we store it here. If this changes, instance should be passed into the
45 // callback. m_instance is lazily constructed.
46 ScopedPersistent<v8::Object> m_instance;
36 }; 47 };
37 48
38 } // namespace blink 49 } // namespace blink
39 50
40 #endif // CSSPaintDefinition_h 51 #endif // CSSPaintDefinition_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698