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

Side by Side Diff: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h

Issue 1881563003: Implement OffscreenCanvas.getContext('webgl') (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: offscreenCanvas.getContext('webgl') crashes on worker 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 OffscreenCanvasRenderingContext2D_h 5 #ifndef OffscreenCanvasRenderingContext2D_h
6 #define OffscreenCanvasRenderingContext2D_h 6 #define OffscreenCanvasRenderingContext2D_h
7 7
8 #include "bindings/core/v8/ScriptState.h"
8 #include "core/html/canvas/CanvasContextCreationAttributes.h" 9 #include "core/html/canvas/CanvasContextCreationAttributes.h"
9 #include "modules/canvas2d/BaseRenderingContext2D.h" 10 #include "modules/canvas2d/BaseRenderingContext2D.h"
10 #include "modules/offscreencanvas/OffscreenCanvasRenderingContext.h" 11 #include "modules/offscreencanvas/OffscreenCanvasRenderingContext.h"
11 #include "modules/offscreencanvas/OffscreenCanvasRenderingContextFactory.h" 12 #include "modules/offscreencanvas/OffscreenCanvasRenderingContextFactory.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final : public OffscreenC anvasRenderingContext, public BaseRenderingContext2D { 16 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final : public GarbageCol lectedFinalized<OffscreenCanvasRenderingContext2D>, public OffscreenCanvasRender ingContext, public BaseRenderingContext2D, public ScriptWrappable {
xlai (Olivia) 2016/04/20 20:42:16 Good change to move the ScriptWrappable. So now on
16 DEFINE_WRAPPERTYPEINFO(); 17 DEFINE_WRAPPERTYPEINFO();
17 USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); 18 USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D);
18 public: 19 public:
19 class Factory : public OffscreenCanvasRenderingContextFactory { 20 class Factory : public OffscreenCanvasRenderingContextFactory {
20 public: 21 public:
21 Factory() {} 22 Factory() {}
22 ~Factory() override {} 23 ~Factory() override {}
23 24
24 OffscreenCanvasRenderingContext* create(OffscreenCanvas* canvas, const C anvasContextCreationAttributes& attrs) override 25 OffscreenCanvasRenderingContext* create(ScriptState* scriptState, Offscr eenCanvas* canvas, const CanvasContextCreationAttributes& attrs) override
25 { 26 {
26 return new OffscreenCanvasRenderingContext2D(canvas, attrs); 27 return new OffscreenCanvasRenderingContext2D(canvas, attrs);
27 } 28 }
28 29
29 OffscreenCanvasRenderingContext::ContextType getContextType() const over ride 30 OffscreenCanvasRenderingContext::ContextType getContextType() const over ride
30 { 31 {
31 return OffscreenCanvasRenderingContext::Context2d; 32 return OffscreenCanvasRenderingContext::Context2d;
32 } 33 }
33 34
34 void onError(OffscreenCanvas* canvas, const String& error) override {} 35 void onError(OffscreenCanvas* canvas, const String& error) override {}
35 }; 36 };
36 37
37 // OffscreenCanvasRenderingContext implementation 38 // OffscreenCanvasRenderingContext implementation
38 ~OffscreenCanvasRenderingContext2D() override; 39 ~OffscreenCanvasRenderingContext2D() override;
39 ContextType getContextType() const override { return Context2d; } 40 ContextType getOffscreenCanvasRenderingContextType() const override { return Context2d; }
40 bool is2d() const override { return true; } 41 bool is2d() const override { return true; }
42 void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) final;
41 43
42 // BaseRenderingContext2D implementation 44 // BaseRenderingContext2D implementation
43 bool originClean() const final; 45 bool originClean() const final;
44 void setOriginTainted() final; 46 void setOriginTainted() final;
45 bool wouldTaintOrigin(CanvasImageSource*) final; 47 bool wouldTaintOrigin(CanvasImageSource*) final;
46 48
47 int width() const final; 49 int width() const final;
48 int height() const final; 50 int height() const final;
49 51
50 bool hasImageBuffer() const final; 52 bool hasImageBuffer() const final;
(...skipping 25 matching lines...) Expand all
76 78
77 private: 79 private:
78 bool m_hasAlpha; 80 bool m_hasAlpha;
79 bool m_originClean = true; 81 bool m_originClean = true;
80 OwnPtr<ImageBuffer> m_imageBuffer; 82 OwnPtr<ImageBuffer> m_imageBuffer;
81 }; 83 };
82 84
83 } // namespace blink 85 } // namespace blink
84 86
85 #endif // OffscreenCanvasRenderingContext2D_h 87 #endif // OffscreenCanvasRenderingContext2D_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698