Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
| 41 #include "core/html/HTMLCanvasElement.h" | 41 #include "core/html/HTMLCanvasElement.h" |
| 42 #include "core/html/HTMLImageElement.h" | 42 #include "core/html/HTMLImageElement.h" |
| 43 #include "core/html/HTMLVideoElement.h" | 43 #include "core/html/HTMLVideoElement.h" |
| 44 #include "core/html/ImageData.h" | 44 #include "core/html/ImageData.h" |
| 45 #include "core/inspector/ConsoleMessage.h" | 45 #include "core/inspector/ConsoleMessage.h" |
| 46 #include "core/inspector/InspectorInstrumentation.h" | 46 #include "core/inspector/InspectorInstrumentation.h" |
| 47 #include "core/layout/LayoutBox.h" | 47 #include "core/layout/LayoutBox.h" |
| 48 #include "core/loader/FrameLoader.h" | 48 #include "core/loader/FrameLoader.h" |
| 49 #include "core/loader/FrameLoaderClient.h" | 49 #include "core/loader/FrameLoaderClient.h" |
| 50 #include "core/origin_trials/OriginTrials.h" | |
| 50 #include "gpu/command_buffer/client/gles2_interface.h" | 51 #include "gpu/command_buffer/client/gles2_interface.h" |
| 51 #include "modules/webgl/ANGLEInstancedArrays.h" | 52 #include "modules/webgl/ANGLEInstancedArrays.h" |
| 52 #include "modules/webgl/EXTBlendMinMax.h" | 53 #include "modules/webgl/EXTBlendMinMax.h" |
| 53 #include "modules/webgl/EXTFragDepth.h" | 54 #include "modules/webgl/EXTFragDepth.h" |
| 54 #include "modules/webgl/EXTShaderTextureLOD.h" | 55 #include "modules/webgl/EXTShaderTextureLOD.h" |
| 55 #include "modules/webgl/EXTTextureFilterAnisotropic.h" | 56 #include "modules/webgl/EXTTextureFilterAnisotropic.h" |
| 56 #include "modules/webgl/GLStringQuery.h" | 57 #include "modules/webgl/GLStringQuery.h" |
| 57 #include "modules/webgl/OESElementIndexUint.h" | 58 #include "modules/webgl/OESElementIndexUint.h" |
| 58 #include "modules/webgl/OESStandardDerivatives.h" | 59 #include "modules/webgl/OESStandardDerivatives.h" |
| 59 #include "modules/webgl/OESTextureFloat.h" | 60 #include "modules/webgl/OESTextureFloat.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 ScriptState* scriptState, | 591 ScriptState* scriptState, |
| 591 const CanvasContextCreationAttributes& attributes, | 592 const CanvasContextCreationAttributes& attributes, |
| 592 unsigned webGLVersion) { | 593 unsigned webGLVersion) { |
| 593 // Exactly one of these must be provided. | 594 // Exactly one of these must be provided. |
| 594 DCHECK_EQ(!canvas, !!scriptState); | 595 DCHECK_EQ(!canvas, !!scriptState); |
| 595 // The canvas is only given on the main thread. | 596 // The canvas is only given on the main thread. |
| 596 DCHECK(!canvas || isMainThread()); | 597 DCHECK(!canvas || isMainThread()); |
| 597 | 598 |
| 598 Platform::ContextAttributes contextAttributes = | 599 Platform::ContextAttributes contextAttributes = |
| 599 toPlatformContextAttributes(attributes, webGLVersion); | 600 toPlatformContextAttributes(attributes, webGLVersion); |
| 601 | |
| 602 // If there's a possibility this context may be used with WebVR make sure it | |
| 603 // is created with an offscreen surface that can be swapped out for a | |
| 604 // VR-specific surface if needed. | |
| 605 ExecutionContext* executionContext = | |
| 606 canvas ? &canvas->document() : scriptState->getExecutionContext(); | |
| 607 if (RuntimeEnabledFeatures::webVREnabled() || | |
| 608 OriginTrials::webVREnabled(executionContext)) { | |
| 609 contextAttributes.ownOffscreenSurface = true; | |
|
Ken Russell (switch to Gerrit)
2016/11/29 05:09:06
I haven't reviewed the rest of the patch in depth,
klausw
2017/01/05 02:17:43
For context, the point of this change is to prepar
| |
| 610 } | |
| 611 | |
| 600 Platform::GraphicsInfo glInfo; | 612 Platform::GraphicsInfo glInfo; |
| 601 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; | 613 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; |
| 602 if (isMainThread()) { | 614 if (isMainThread()) { |
| 603 const auto& url = canvas ? canvas->document().topDocument().url() | 615 const auto& url = canvas ? canvas->document().topDocument().url() |
| 604 : scriptState->getExecutionContext()->url(); | 616 : scriptState->getExecutionContext()->url(); |
| 605 contextProvider = wrapUnique( | 617 contextProvider = wrapUnique( |
| 606 Platform::current()->createOffscreenGraphicsContext3DProvider( | 618 Platform::current()->createOffscreenGraphicsContext3DProvider( |
| 607 contextAttributes, url, 0, &glInfo)); | 619 contextAttributes, url, 0, &glInfo)); |
| 608 } else { | 620 } else { |
| 609 contextProvider = createContextProviderOnWorkerThread(contextAttributes, | 621 contextProvider = createContextProviderOnWorkerThread(contextAttributes, |
| (...skipping 7050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7660 | 7672 |
| 7661 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7673 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7662 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7674 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7663 if (canvas()) | 7675 if (canvas()) |
| 7664 result.setHTMLCanvasElement(canvas()); | 7676 result.setHTMLCanvasElement(canvas()); |
| 7665 else | 7677 else |
| 7666 result.setOffscreenCanvas(getOffscreenCanvas()); | 7678 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7667 } | 7679 } |
| 7668 | 7680 |
| 7669 } // namespace blink | 7681 } // namespace blink |
| OLD | NEW |