Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2628963002: Revert of Enable creation of offscreen contexts which own their backing surface. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"
50 #include "gpu/command_buffer/client/gles2_interface.h" 49 #include "gpu/command_buffer/client/gles2_interface.h"
51 #include "modules/webgl/ANGLEInstancedArrays.h" 50 #include "modules/webgl/ANGLEInstancedArrays.h"
52 #include "modules/webgl/EXTBlendMinMax.h" 51 #include "modules/webgl/EXTBlendMinMax.h"
53 #include "modules/webgl/EXTFragDepth.h" 52 #include "modules/webgl/EXTFragDepth.h"
54 #include "modules/webgl/EXTShaderTextureLOD.h" 53 #include "modules/webgl/EXTShaderTextureLOD.h"
55 #include "modules/webgl/EXTTextureFilterAnisotropic.h" 54 #include "modules/webgl/EXTTextureFilterAnisotropic.h"
56 #include "modules/webgl/GLStringQuery.h" 55 #include "modules/webgl/GLStringQuery.h"
57 #include "modules/webgl/OESElementIndexUint.h" 56 #include "modules/webgl/OESElementIndexUint.h"
58 #include "modules/webgl/OESStandardDerivatives.h" 57 #include "modules/webgl/OESStandardDerivatives.h"
59 #include "modules/webgl/OESTextureFloat.h" 58 #include "modules/webgl/OESTextureFloat.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 ScriptState* scriptState, 616 ScriptState* scriptState,
618 const CanvasContextCreationAttributes& attributes, 617 const CanvasContextCreationAttributes& attributes,
619 unsigned webGLVersion) { 618 unsigned webGLVersion) {
620 // Exactly one of these must be provided. 619 // Exactly one of these must be provided.
621 DCHECK_EQ(!canvas, !!scriptState); 620 DCHECK_EQ(!canvas, !!scriptState);
622 // The canvas is only given on the main thread. 621 // The canvas is only given on the main thread.
623 DCHECK(!canvas || isMainThread()); 622 DCHECK(!canvas || isMainThread());
624 623
625 Platform::ContextAttributes contextAttributes = 624 Platform::ContextAttributes contextAttributes =
626 toPlatformContextAttributes(attributes, webGLVersion); 625 toPlatformContextAttributes(attributes, webGLVersion);
627
628 // If there's a possibility this context may be used with WebVR make sure it
629 // is created with an offscreen surface that can be swapped out for a
630 // VR-specific surface if needed. We can only check the origin trial
631 // if called with a scriptState, not for a canvas.
632 if (RuntimeEnabledFeatures::webVREnabled() ||
633 (scriptState &&
634 OriginTrials::webVREnabled(scriptState->getExecutionContext()))) {
635 contextAttributes.supportOwnOffscreenSurface = true;
636 }
637
638 Platform::GraphicsInfo glInfo; 626 Platform::GraphicsInfo glInfo;
639 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider; 627 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider;
640 const auto& url = canvas ? canvas->document().topDocument().url() 628 const auto& url = canvas ? canvas->document().topDocument().url()
641 : scriptState->getExecutionContext()->url(); 629 : scriptState->getExecutionContext()->url();
642 if (isMainThread()) { 630 if (isMainThread()) {
643 contextProvider = WTF::wrapUnique( 631 contextProvider = WTF::wrapUnique(
644 Platform::current()->createOffscreenGraphicsContext3DProvider( 632 Platform::current()->createOffscreenGraphicsContext3DProvider(
645 contextAttributes, url, 0, &glInfo)); 633 contextAttributes, url, 0, &glInfo));
646 } else { 634 } else {
647 contextProvider = 635 contextProvider =
(...skipping 7159 matching lines...) Expand 10 before | Expand all | Expand 10 after
7807 7795
7808 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7796 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7809 HTMLCanvasElementOrOffscreenCanvas& result) const { 7797 HTMLCanvasElementOrOffscreenCanvas& result) const {
7810 if (canvas()) 7798 if (canvas())
7811 result.setHTMLCanvasElement(canvas()); 7799 result.setHTMLCanvasElement(canvas());
7812 else 7800 else
7813 result.setOffscreenCanvas(offscreenCanvas()); 7801 result.setOffscreenCanvas(offscreenCanvas());
7814 } 7802 }
7815 7803
7816 } // namespace blink 7804 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698