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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.h

Issue 2029163002: Worklets - Change inheritance heirarchy of WorkletGlobalScope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase. Created 4 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
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 PaintWorkletGlobalScope_h 5 #ifndef PaintWorkletGlobalScope_h
6 #define PaintWorkletGlobalScope_h 6 #define PaintWorkletGlobalScope_h
7 7
8 #include "bindings/core/v8/ScriptValue.h" 8 #include "bindings/core/v8/ScriptValue.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/workers/MainThreadWorkletGlobalScope.h"
10 #include "modules/ModulesExport.h" 11 #include "modules/ModulesExport.h"
11 #include "modules/worklet/WorkletGlobalScope.h"
12 #include "platform/graphics/ImageBuffer.h" 12 #include "platform/graphics/ImageBuffer.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class CSSPaintDefinition; 16 class CSSPaintDefinition;
17 class CSSPaintImageGeneratorImpl; 17 class CSSPaintImageGeneratorImpl;
18 class ExceptionState; 18 class ExceptionState;
19 19
20 class MODULES_EXPORT PaintWorkletGlobalScope : public WorkletGlobalScope { 20 class MODULES_EXPORT PaintWorkletGlobalScope final : public MainThreadWorkletGlo balScope {
21 DEFINE_WRAPPERTYPEINFO(); 21 DEFINE_WRAPPERTYPEINFO();
22 USING_GARBAGE_COLLECTED_MIXIN(PaintWorkletGlobalScope);
22 public: 23 public:
23 static PaintWorkletGlobalScope* create(LocalFrame*, const KURL&, const Strin g& userAgent, PassRefPtr<SecurityOrigin>, v8::Isolate*); 24 static PaintWorkletGlobalScope* create(LocalFrame*, const KURL&, const Strin g& userAgent, PassRefPtr<SecurityOrigin>, v8::Isolate*);
24 ~PaintWorkletGlobalScope() override; 25 ~PaintWorkletGlobalScope() override;
25 void dispose() override; 26 void dispose() final;
26 27
27 bool isPaintWorkletGlobalScope() const final { return true; } 28 bool isPaintWorkletGlobalScope() const final { return true; }
28 void registerPaint(const String& name, const ScriptValue& ctor, ExceptionSta te&); 29 void registerPaint(const String& name, const ScriptValue& ctor, ExceptionSta te&);
29 30
30 CSSPaintDefinition* findDefinition(const String& name); 31 CSSPaintDefinition* findDefinition(const String& name);
31 void addPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*); 32 void addPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*);
32 33
33 DECLARE_VIRTUAL_TRACE(); 34 DECLARE_VIRTUAL_TRACE();
34 35
35 private: 36 private:
36 PaintWorkletGlobalScope(LocalFrame*, const KURL&, const String& userAgent, P assRefPtr<SecurityOrigin>, v8::Isolate*); 37 PaintWorkletGlobalScope(LocalFrame*, const KURL&, const String& userAgent, P assRefPtr<SecurityOrigin>, v8::Isolate*);
37 38
38 typedef HeapHashMap<String, Member<CSSPaintDefinition>> DefinitionMap; 39 typedef HeapHashMap<String, Member<CSSPaintDefinition>> DefinitionMap;
39 DefinitionMap m_paintDefinitions; 40 DefinitionMap m_paintDefinitions;
40 41
41 // The map of CSSPaintImageGeneratorImpl which are waiting for a 42 // The map of CSSPaintImageGeneratorImpl which are waiting for a
42 // CSSPaintDefinition to be registered. The global scope is expected to 43 // CSSPaintDefinition to be registered. The global scope is expected to
43 // outlive the generators hence are held onto with a WeakMember. 44 // outlive the generators hence are held onto with a WeakMember.
44 typedef HeapHashSet<WeakMember<CSSPaintImageGeneratorImpl>> GeneratorHashSet ; 45 typedef HeapHashSet<WeakMember<CSSPaintImageGeneratorImpl>> GeneratorHashSet ;
45 typedef HeapHashMap<String, Member<GeneratorHashSet>> PendingGeneratorMap; 46 typedef HeapHashMap<String, Member<GeneratorHashSet>> PendingGeneratorMap;
46 PendingGeneratorMap m_pendingGenerators; 47 PendingGeneratorMap m_pendingGenerators;
47 }; 48 };
48 49
49 DEFINE_TYPE_CASTS(PaintWorkletGlobalScope, ExecutionContext, context, context->i sPaintWorkletGlobalScope(), context.isPaintWorkletGlobalScope()); 50 DEFINE_TYPE_CASTS(PaintWorkletGlobalScope, ExecutionContext, context, context->i sPaintWorkletGlobalScope(), context.isPaintWorkletGlobalScope());
50 51
51 } // namespace blink 52 } // namespace blink
52 53
53 #endif // PaintWorkletGlobalScope_h 54 #endif // PaintWorkletGlobalScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698