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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h

Issue 2490443002: Make OffscreenCanvas an EventTarget (Closed)
Patch Set: tests added Created 4 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 584
585 PassRefPtr<Image> getImage(AccelerationHint, SnapshotReason) const override; 585 PassRefPtr<Image> getImage(AccelerationHint, SnapshotReason) const override;
586 ImageData* toImageData(SnapshotReason) const override; 586 ImageData* toImageData(SnapshotReason) const override;
587 void setFilterQuality(SkFilterQuality) override; 587 void setFilterQuality(SkFilterQuality) override;
588 bool isWebGL2OrHigher() { return version() >= 2; } 588 bool isWebGL2OrHigher() { return version() >= 2; }
589 589
590 void getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffscreenCanvas&) const; 590 void getHTMLOrOffscreenCanvas(HTMLCanvasElementOrOffscreenCanvas&) const;
591 591
592 void commit(ScriptState*, ExceptionState&); 592 void commit(ScriptState*, ExceptionState&);
593 593
594 ExecutionContext* getExecutionContext() final {
595 return m_executionContext.get();
596 }
597
594 protected: 598 protected:
595 friend class EXTDisjointTimerQuery; 599 friend class EXTDisjointTimerQuery;
596 friend class EXTDisjointTimerQueryWebGL2; 600 friend class EXTDisjointTimerQueryWebGL2;
597 friend class WebGLDrawBuffers; 601 friend class WebGLDrawBuffers;
598 friend class WebGLFramebuffer; 602 friend class WebGLFramebuffer;
599 friend class WebGLObject; 603 friend class WebGLObject;
600 friend class WebGLContextObject; 604 friend class WebGLContextObject;
601 friend class OESVertexArrayObject; 605 friend class OESVertexArrayObject;
602 friend class WebGLDebugShaders; 606 friend class WebGLDebugShaders;
603 friend class WebGLCompressedTextureASTC; 607 friend class WebGLCompressedTextureASTC;
(...skipping 11 matching lines...) Expand all
615 // To allow V8WebGL[2]RenderingContext to call visitChildDOMWrappers. 619 // To allow V8WebGL[2]RenderingContext to call visitChildDOMWrappers.
616 friend class V8WebGLRenderingContext; 620 friend class V8WebGLRenderingContext;
617 621
618 WebGLRenderingContextBase(HTMLCanvasElement*, 622 WebGLRenderingContextBase(HTMLCanvasElement*,
619 std::unique_ptr<WebGraphicsContext3DProvider>, 623 std::unique_ptr<WebGraphicsContext3DProvider>,
620 const CanvasContextCreationAttributes&, 624 const CanvasContextCreationAttributes&,
621 unsigned); 625 unsigned);
622 WebGLRenderingContextBase(OffscreenCanvas*, 626 WebGLRenderingContextBase(OffscreenCanvas*,
623 std::unique_ptr<WebGraphicsContext3DProvider>, 627 std::unique_ptr<WebGraphicsContext3DProvider>,
624 const CanvasContextCreationAttributes&, 628 const CanvasContextCreationAttributes&,
629 ExecutionContext*,
625 unsigned); 630 unsigned);
626 PassRefPtr<DrawingBuffer> createDrawingBuffer( 631 PassRefPtr<DrawingBuffer> createDrawingBuffer(
627 std::unique_ptr<WebGraphicsContext3DProvider>, 632 std::unique_ptr<WebGraphicsContext3DProvider>,
628 DrawingBuffer::ChromiumImageUsage); 633 DrawingBuffer::ChromiumImageUsage);
629 void setupFlags(); 634 void setupFlags();
630 635
631 // CanvasRenderingContext implementation. 636 // CanvasRenderingContext implementation.
632 bool is3d() const override { return true; } 637 bool is3d() const override { return true; }
633 bool isAccelerated() const override { return true; } 638 bool isAccelerated() const override { return true; }
634 void setIsHidden(bool) override; 639 void setIsHidden(bool) override;
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 GLenum format, 1577 GLenum format,
1573 GLenum type, 1578 GLenum type,
1574 DOMArrayBufferView* pixels, 1579 DOMArrayBufferView* pixels,
1575 GLuint offset); 1580 GLuint offset);
1576 1581
1577 private: 1582 private:
1578 WebGLRenderingContextBase(HTMLCanvasElement*, 1583 WebGLRenderingContextBase(HTMLCanvasElement*,
1579 OffscreenCanvas*, 1584 OffscreenCanvas*,
1580 std::unique_ptr<WebGraphicsContext3DProvider>, 1585 std::unique_ptr<WebGraphicsContext3DProvider>,
1581 const CanvasContextCreationAttributes&, 1586 const CanvasContextCreationAttributes&,
1587 ExecutionContext*,
1582 unsigned); 1588 unsigned);
1583 static std::unique_ptr<WebGraphicsContext3DProvider> 1589 static std::unique_ptr<WebGraphicsContext3DProvider>
1584 createContextProviderInternal(HTMLCanvasElement*, 1590 createContextProviderInternal(HTMLCanvasElement*,
1585 ScriptState*, 1591 ScriptState*,
1586 const CanvasContextCreationAttributes&, 1592 const CanvasContextCreationAttributes&,
1587 unsigned); 1593 unsigned);
1588 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint); 1594 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint);
1589 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool); 1595 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool);
1590 1596
1591 const unsigned m_version; 1597 const unsigned m_version;
1592 1598
1599 Member<ExecutionContext> m_executionContext;
Justin Novosad 2016/11/14 16:41:00 Storing this in the rendering context is unnecessa
xidachen 2016/11/14 18:48:12 Done. It does make things much simpler.
1600
1593 bool isPaintable() const final { return drawingBuffer(); } 1601 bool isPaintable() const final { return drawingBuffer(); }
1594 }; 1602 };
1595 1603
1596 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, 1604 DEFINE_TYPE_CASTS(WebGLRenderingContextBase,
1597 CanvasRenderingContext, 1605 CanvasRenderingContext,
1598 context, 1606 context,
1599 context->is3d(), 1607 context->is3d(),
1600 context.is3d()); 1608 context.is3d());
1601 1609
1602 } // namespace blink 1610 } // namespace blink
1603 1611
1604 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS( 1612 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(
1605 blink::WebGLRenderingContextBase::TextureUnitState); 1613 blink::WebGLRenderingContextBase::TextureUnitState);
1606 1614
1607 #endif // WebGLRenderingContextBase_h 1615 #endif // WebGLRenderingContextBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698