| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "bindings/core/v8/ExceptionMessages.h" | 28 #include "bindings/core/v8/ExceptionMessages.h" |
| 29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
| 30 #include "bindings/core/v8/ScriptWrappableVisitor.h" | 30 #include "bindings/core/v8/ScriptWrappableVisitor.h" |
| 31 #include "bindings/core/v8/V8BindingMacros.h" | 31 #include "bindings/core/v8/V8BindingMacros.h" |
| 32 #include "bindings/modules/v8/HTMLCanvasElementOrOffscreenCanvas.h" | 32 #include "bindings/modules/v8/HTMLCanvasElementOrOffscreenCanvas.h" |
| 33 #include "bindings/modules/v8/WebGLAny.h" | 33 #include "bindings/modules/v8/WebGLAny.h" |
| 34 #include "core/dom/DOMArrayBuffer.h" | 34 #include "core/dom/DOMArrayBuffer.h" |
| 35 #include "core/dom/DOMTypedArray.h" | 35 #include "core/dom/DOMTypedArray.h" |
| 36 #include "core/dom/FlexibleArrayBufferView.h" | 36 #include "core/dom/FlexibleArrayBufferView.h" |
| 37 #include "core/dom/TaskRunnerHelper.h" |
| 37 #include "core/frame/ImageBitmap.h" | 38 #include "core/frame/ImageBitmap.h" |
| 38 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
| 39 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
| 40 #include "core/html/HTMLCanvasElement.h" | 41 #include "core/html/HTMLCanvasElement.h" |
| 41 #include "core/html/HTMLImageElement.h" | 42 #include "core/html/HTMLImageElement.h" |
| 42 #include "core/html/HTMLVideoElement.h" | 43 #include "core/html/HTMLVideoElement.h" |
| 43 #include "core/html/ImageData.h" | 44 #include "core/html/ImageData.h" |
| 44 #include "core/inspector/ConsoleMessage.h" | 45 #include "core/inspector/ConsoleMessage.h" |
| 45 #include "core/inspector/InspectorInstrumentation.h" | 46 #include "core/inspector/InspectorInstrumentation.h" |
| 46 #include "core/layout/LayoutBox.h" | 47 #include "core/layout/LayoutBox.h" |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 } | 1033 } |
| 1033 } | 1034 } |
| 1034 | 1035 |
| 1035 } // namespace | 1036 } // namespace |
| 1036 | 1037 |
| 1037 WebGLRenderingContextBase::WebGLRenderingContextBase( | 1038 WebGLRenderingContextBase::WebGLRenderingContextBase( |
| 1038 OffscreenCanvas* passedOffscreenCanvas, | 1039 OffscreenCanvas* passedOffscreenCanvas, |
| 1039 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 1040 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
| 1040 const CanvasContextCreationAttributes& requestedAttributes, | 1041 const CanvasContextCreationAttributes& requestedAttributes, |
| 1041 unsigned version) | 1042 unsigned version) |
| 1042 : WebGLRenderingContextBase(nullptr, | 1043 : WebGLRenderingContextBase( |
| 1043 passedOffscreenCanvas, | 1044 nullptr, |
| 1044 std::move(contextProvider), | 1045 passedOffscreenCanvas, |
| 1045 requestedAttributes, | 1046 TaskRunnerHelper::get(TaskType::WebGL, |
| 1046 version) {} | 1047 passedOffscreenCanvas->getExecutionContext()), |
| 1048 std::move(contextProvider), |
| 1049 requestedAttributes, |
| 1050 version) {} |
| 1047 | 1051 |
| 1048 WebGLRenderingContextBase::WebGLRenderingContextBase( | 1052 WebGLRenderingContextBase::WebGLRenderingContextBase( |
| 1049 HTMLCanvasElement* passedCanvas, | 1053 HTMLCanvasElement* passedCanvas, |
| 1050 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 1054 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
| 1051 const CanvasContextCreationAttributes& requestedAttributes, | 1055 const CanvasContextCreationAttributes& requestedAttributes, |
| 1052 unsigned version) | 1056 unsigned version) |
| 1053 : WebGLRenderingContextBase(passedCanvas, | 1057 : WebGLRenderingContextBase( |
| 1054 nullptr, | 1058 passedCanvas, |
| 1055 std::move(contextProvider), | 1059 nullptr, |
| 1056 requestedAttributes, | 1060 TaskRunnerHelper::get(TaskType::WebGL, &passedCanvas->document()), |
| 1057 version) {} | 1061 std::move(contextProvider), |
| 1062 requestedAttributes, |
| 1063 version) {} |
| 1058 | 1064 |
| 1059 WebGLRenderingContextBase::WebGLRenderingContextBase( | 1065 WebGLRenderingContextBase::WebGLRenderingContextBase( |
| 1060 HTMLCanvasElement* passedCanvas, | 1066 HTMLCanvasElement* passedCanvas, |
| 1061 OffscreenCanvas* passedOffscreenCanvas, | 1067 OffscreenCanvas* passedOffscreenCanvas, |
| 1068 RefPtr<WebTaskRunner> taskRunner, |
| 1062 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 1069 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
| 1063 const CanvasContextCreationAttributes& requestedAttributes, | 1070 const CanvasContextCreationAttributes& requestedAttributes, |
| 1064 unsigned version) | 1071 unsigned version) |
| 1065 : CanvasRenderingContext(passedCanvas, | 1072 : CanvasRenderingContext(passedCanvas, |
| 1066 passedOffscreenCanvas, | 1073 passedOffscreenCanvas, |
| 1067 requestedAttributes), | 1074 requestedAttributes), |
| 1068 m_contextGroup(this, new WebGLContextGroup()), | 1075 m_contextGroup(this, new WebGLContextGroup()), |
| 1069 m_isHidden(false), | 1076 m_isHidden(false), |
| 1070 m_contextLostMode(NotLostContext), | 1077 m_contextLostMode(NotLostContext), |
| 1071 m_autoRecoveryMethod(Manual), | 1078 m_autoRecoveryMethod(Manual), |
| 1072 m_dispatchContextLostEventTimer( | 1079 m_dispatchContextLostEventTimer( |
| 1080 taskRunner, |
| 1073 this, | 1081 this, |
| 1074 &WebGLRenderingContextBase::dispatchContextLostEvent), | 1082 &WebGLRenderingContextBase::dispatchContextLostEvent), |
| 1075 m_restoreAllowed(false), | 1083 m_restoreAllowed(false), |
| 1076 m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext), | 1084 m_restoreTimer(taskRunner, |
| 1085 this, |
| 1086 &WebGLRenderingContextBase::maybeRestoreContext), |
| 1077 m_boundArrayBuffer(this, nullptr), | 1087 m_boundArrayBuffer(this, nullptr), |
| 1078 m_boundVertexArrayObject(this, nullptr), | 1088 m_boundVertexArrayObject(this, nullptr), |
| 1079 m_currentProgram(this, nullptr), | 1089 m_currentProgram(this, nullptr), |
| 1080 m_framebufferBinding(this, nullptr), | 1090 m_framebufferBinding(this, nullptr), |
| 1081 m_renderbufferBinding(this, nullptr), | 1091 m_renderbufferBinding(this, nullptr), |
| 1082 m_generatedImageCache(4), | 1092 m_generatedImageCache(4), |
| 1083 m_synthesizedErrorsToConsole(true), | 1093 m_synthesizedErrorsToConsole(true), |
| 1084 m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole), | 1094 m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole), |
| 1085 m_onePlusMaxNonDefaultTextureUnit(0), | 1095 m_onePlusMaxNonDefaultTextureUnit(0), |
| 1086 m_isWebGL2FormatsTypesAdded(false), | 1096 m_isWebGL2FormatsTypesAdded(false), |
| (...skipping 6751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7838 | 7848 |
| 7839 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7849 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7840 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7850 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7841 if (canvas()) | 7851 if (canvas()) |
| 7842 result.setHTMLCanvasElement(canvas()); | 7852 result.setHTMLCanvasElement(canvas()); |
| 7843 else | 7853 else |
| 7844 result.setOffscreenCanvas(offscreenCanvas()); | 7854 result.setOffscreenCanvas(offscreenCanvas()); |
| 7845 } | 7855 } |
| 7846 | 7856 |
| 7847 } // namespace blink | 7857 } // namespace blink |
| OLD | NEW |