| 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 28 matching lines...) Expand all Loading... |
| 39 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
| 40 #include "core/html/HTMLCanvasElement.h" | 40 #include "core/html/HTMLCanvasElement.h" |
| 41 #include "core/html/HTMLImageElement.h" | 41 #include "core/html/HTMLImageElement.h" |
| 42 #include "core/html/HTMLVideoElement.h" | 42 #include "core/html/HTMLVideoElement.h" |
| 43 #include "core/html/ImageData.h" | 43 #include "core/html/ImageData.h" |
| 44 #include "core/inspector/ConsoleMessage.h" | 44 #include "core/inspector/ConsoleMessage.h" |
| 45 #include "core/inspector/InspectorInstrumentation.h" | 45 #include "core/inspector/InspectorInstrumentation.h" |
| 46 #include "core/layout/LayoutBox.h" | 46 #include "core/layout/LayoutBox.h" |
| 47 #include "core/loader/FrameLoader.h" | 47 #include "core/loader/FrameLoader.h" |
| 48 #include "core/loader/FrameLoaderClient.h" | 48 #include "core/loader/FrameLoaderClient.h" |
| 49 #include "core/origin_trials/OriginTrials.h" |
| 49 #include "gpu/command_buffer/client/gles2_interface.h" | 50 #include "gpu/command_buffer/client/gles2_interface.h" |
| 50 #include "modules/webgl/ANGLEInstancedArrays.h" | 51 #include "modules/webgl/ANGLEInstancedArrays.h" |
| 51 #include "modules/webgl/EXTBlendMinMax.h" | 52 #include "modules/webgl/EXTBlendMinMax.h" |
| 52 #include "modules/webgl/EXTFragDepth.h" | 53 #include "modules/webgl/EXTFragDepth.h" |
| 53 #include "modules/webgl/EXTShaderTextureLOD.h" | 54 #include "modules/webgl/EXTShaderTextureLOD.h" |
| 54 #include "modules/webgl/EXTTextureFilterAnisotropic.h" | 55 #include "modules/webgl/EXTTextureFilterAnisotropic.h" |
| 55 #include "modules/webgl/GLStringQuery.h" | 56 #include "modules/webgl/GLStringQuery.h" |
| 56 #include "modules/webgl/OESElementIndexUint.h" | 57 #include "modules/webgl/OESElementIndexUint.h" |
| 57 #include "modules/webgl/OESStandardDerivatives.h" | 58 #include "modules/webgl/OESStandardDerivatives.h" |
| 58 #include "modules/webgl/OESTextureFloat.h" | 59 #include "modules/webgl/OESTextureFloat.h" |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 ScriptState* scriptState, | 615 ScriptState* scriptState, |
| 615 const CanvasContextCreationAttributes& attributes, | 616 const CanvasContextCreationAttributes& attributes, |
| 616 unsigned webGLVersion) { | 617 unsigned webGLVersion) { |
| 617 // Exactly one of these must be provided. | 618 // Exactly one of these must be provided. |
| 618 DCHECK_EQ(!canvas, !!scriptState); | 619 DCHECK_EQ(!canvas, !!scriptState); |
| 619 // The canvas is only given on the main thread. | 620 // The canvas is only given on the main thread. |
| 620 DCHECK(!canvas || isMainThread()); | 621 DCHECK(!canvas || isMainThread()); |
| 621 | 622 |
| 622 Platform::ContextAttributes contextAttributes = | 623 Platform::ContextAttributes contextAttributes = |
| 623 toPlatformContextAttributes(attributes, webGLVersion); | 624 toPlatformContextAttributes(attributes, webGLVersion); |
| 625 |
| 626 // If there's a possibility this context may be used with WebVR make sure it |
| 627 // is created with an offscreen surface that can be swapped out for a |
| 628 // VR-specific surface if needed. We can only check the origin trial |
| 629 // if called with a scriptState, not for a canvas. |
| 630 if (RuntimeEnabledFeatures::webVREnabled() || |
| 631 (scriptState && |
| 632 OriginTrials::webVREnabled(scriptState->getExecutionContext()))) { |
| 633 contextAttributes.supportOwnOffscreenSurface = true; |
| 634 } |
| 635 |
| 624 Platform::GraphicsInfo glInfo; | 636 Platform::GraphicsInfo glInfo; |
| 625 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; | 637 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; |
| 626 const auto& url = canvas ? canvas->document().topDocument().url() | 638 const auto& url = canvas ? canvas->document().topDocument().url() |
| 627 : scriptState->getExecutionContext()->url(); | 639 : scriptState->getExecutionContext()->url(); |
| 628 if (isMainThread()) { | 640 if (isMainThread()) { |
| 629 contextProvider = WTF::wrapUnique( | 641 contextProvider = WTF::wrapUnique( |
| 630 Platform::current()->createOffscreenGraphicsContext3DProvider( | 642 Platform::current()->createOffscreenGraphicsContext3DProvider( |
| 631 contextAttributes, url, 0, &glInfo)); | 643 contextAttributes, url, 0, &glInfo)); |
| 632 } else { | 644 } else { |
| 633 contextProvider = | 645 contextProvider = |
| (...skipping 7140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7774 | 7786 |
| 7775 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7787 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7776 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7788 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7777 if (canvas()) | 7789 if (canvas()) |
| 7778 result.setHTMLCanvasElement(canvas()); | 7790 result.setHTMLCanvasElement(canvas()); |
| 7779 else | 7791 else |
| 7780 result.setOffscreenCanvas(getOffscreenCanvas()); | 7792 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7781 } | 7793 } |
| 7782 | 7794 |
| 7783 } // namespace blink | 7795 } // namespace blink |
| OLD | NEW |