| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebGraphicsContext3D_h | 31 #ifndef WebGraphicsContext3D_h |
| 32 #define WebGraphicsContext3D_h | 32 #define WebGraphicsContext3D_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | |
| 35 #include "WebNonCopyable.h" | 34 #include "WebNonCopyable.h" |
| 36 #include "WebString.h" | |
| 37 | |
| 38 namespace gpu { | |
| 39 namespace gles2 { | |
| 40 class GLES2Interface; | |
| 41 } | |
| 42 } | |
| 43 | |
| 44 struct GrGLInterface; | |
| 45 | 35 |
| 46 namespace blink { | 36 namespace blink { |
| 37 class WebString; |
| 47 | 38 |
| 48 // This interface abstracts the operations performed by the | 39 // This interface abstracts the operations performed by the |
| 49 // GraphicsContext3D in order to implement WebGL. Nearly all of the | 40 // GraphicsContext3D in order to implement WebGL. Nearly all of the |
| 50 // methods exposed on this interface map directly to entry points in | 41 // methods exposed on this interface map directly to entry points in |
| 51 // the OpenGL ES 2.0 API. | 42 // the OpenGL ES 2.0 API. |
| 52 class WebGraphicsContext3D : public WebNonCopyable { | 43 class WebGraphicsContext3D : public WebNonCopyable { |
| 53 public: | 44 public: |
| 54 // Context creation attributes. | |
| 55 struct Attributes { | |
| 56 bool shareResources = true; | |
| 57 bool preferDiscreteGPU = false; | |
| 58 bool noAutomaticFlushes = false; | |
| 59 bool failIfMajorPerformanceCaveat = false; | |
| 60 unsigned webGLVersion = 0; | |
| 61 // FIXME: ideally this would be a WebURL, but it is currently not | |
| 62 // possible to pass a WebURL by value across the WebKit API boundary. | |
| 63 // See https://bugs.webkit.org/show_bug.cgi?id=103793#c13 . | |
| 64 WebString topDocumentURL; | |
| 65 }; | |
| 66 | |
| 67 class WebGraphicsContextLostCallback { | 45 class WebGraphicsContextLostCallback { |
| 68 public: | 46 public: |
| 69 virtual void onContextLost() = 0; | 47 virtual void onContextLost() = 0; |
| 70 | 48 |
| 71 protected: | 49 protected: |
| 72 virtual ~WebGraphicsContextLostCallback() { } | 50 virtual ~WebGraphicsContextLostCallback() { } |
| 73 }; | 51 }; |
| 74 | 52 |
| 75 class WebGraphicsErrorMessageCallback { | 53 class WebGraphicsErrorMessageCallback { |
| 76 public: | 54 public: |
| 77 virtual void onErrorMessage(const WebString&, int) = 0; | 55 virtual void onErrorMessage(const WebString&, int) = 0; |
| 78 | 56 |
| 79 protected: | 57 protected: |
| 80 virtual ~WebGraphicsErrorMessageCallback() { } | 58 virtual ~WebGraphicsErrorMessageCallback() { } |
| 81 }; | 59 }; |
| 82 | 60 |
| 83 // This destructor needs to be public so that using classes can destroy inst
ances if initialization fails. | 61 // This destructor needs to be public so that using classes can destroy inst
ances if initialization fails. |
| 84 virtual ~WebGraphicsContext3D() { } | 62 virtual ~WebGraphicsContext3D() { } |
| 85 | 63 |
| 86 virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callba
ck) { } | 64 virtual void setErrorMessageCallback(WebGraphicsErrorMessageCallback* callba
ck) { } |
| 87 }; | 65 }; |
| 88 | 66 |
| 89 } // namespace blink | 67 } // namespace blink |
| 90 | 68 |
| 91 #endif | 69 #endif |
| OLD | NEW |