OLD | NEW |
(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 #ifndef CSSPaintDefinition_h |
| 6 #define CSSPaintDefinition_h |
| 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "platform/geometry/IntSize.h" |
| 10 #include "platform/heap/Handle.h" |
| 11 #include <v8.h> |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class Image; |
| 16 class ScriptState; |
| 17 |
| 18 class CSSPaintDefinition final : public RefCountedWillBeGarbageCollectedFinalize
d<CSSPaintDefinition> { |
| 19 public: |
| 20 static PassRefPtrWillBeRawPtr<CSSPaintDefinition> create(ScriptState*, v8::L
ocal<v8::Function> constructor, v8::Local<v8::Function> paint); |
| 21 virtual ~CSSPaintDefinition(); |
| 22 |
| 23 void initialize(v8::Local<v8::Function> constructor, v8::Local<v8::Function>
paint); |
| 24 |
| 25 PassRefPtr<Image> paint(const IntSize&); |
| 26 |
| 27 DEFINE_INLINE_TRACE() { }; |
| 28 |
| 29 private: |
| 30 CSSPaintDefinition(ScriptState*, v8::Local<v8::Function> constructor, v8::Lo
cal<v8::Function> paint); |
| 31 |
| 32 v8::Local<v8::Object> paintInstance(); |
| 33 |
| 34 RefPtr<ScriptState> m_scriptState; |
| 35 |
| 36 ScopedPersistent<v8::Function> m_constructor; |
| 37 ScopedPersistent<v8::Function> m_paint; |
| 38 |
| 39 // At the moment there is only ever one instance of a paint class per type |
| 40 // so we store it here. If this changes, instance should be passed into the |
| 41 // callback. m_instance is lazily constructed. |
| 42 ScopedPersistent<v8::Object> m_instance; |
| 43 }; |
| 44 |
| 45 } // namespace blink |
| 46 |
| 47 #endif // CSSPaintDefinition_h |
OLD | NEW |