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. |
| 629 if (RuntimeEnabledFeatures::webVREnabled() || |
| 630 OriginTrials::webVREnabled(scriptState->getExecutionContext())) { |
| 631 contextAttributes.supportOwnOffscreenSurface = true; |
| 632 } |
| 633 |
624 Platform::GraphicsInfo glInfo; | 634 Platform::GraphicsInfo glInfo; |
625 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; | 635 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; |
626 const auto& url = canvas ? canvas->document().topDocument().url() | 636 const auto& url = canvas ? canvas->document().topDocument().url() |
627 : scriptState->getExecutionContext()->url(); | 637 : scriptState->getExecutionContext()->url(); |
628 if (isMainThread()) { | 638 if (isMainThread()) { |
629 contextProvider = WTF::wrapUnique( | 639 contextProvider = WTF::wrapUnique( |
630 Platform::current()->createOffscreenGraphicsContext3DProvider( | 640 Platform::current()->createOffscreenGraphicsContext3DProvider( |
631 contextAttributes, url, 0, &glInfo)); | 641 contextAttributes, url, 0, &glInfo)); |
632 } else { | 642 } else { |
633 contextProvider = | 643 contextProvider = |
(...skipping 7140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7774 | 7784 |
7775 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7785 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
7776 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7786 HTMLCanvasElementOrOffscreenCanvas& result) const { |
7777 if (canvas()) | 7787 if (canvas()) |
7778 result.setHTMLCanvasElement(canvas()); | 7788 result.setHTMLCanvasElement(canvas()); |
7779 else | 7789 else |
7780 result.setOffscreenCanvas(getOffscreenCanvas()); | 7790 result.setOffscreenCanvas(getOffscreenCanvas()); |
7781 } | 7791 } |
7782 | 7792 |
7783 } // namespace blink | 7793 } // namespace blink |
OLD | NEW |