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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 const CanvasContextCreationAttributes& attributes, | 671 const CanvasContextCreationAttributes& attributes, |
672 unsigned webGLVersion) { | 672 unsigned webGLVersion) { |
673 return createContextProviderInternal(nullptr, scriptState, attributes, | 673 return createContextProviderInternal(nullptr, scriptState, attributes, |
674 webGLVersion); | 674 webGLVersion); |
675 } | 675 } |
676 | 676 |
677 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() { | 677 void WebGLRenderingContextBase::forceNextWebGLContextCreationToFail() { |
678 shouldFailContextCreationForTesting = true; | 678 shouldFailContextCreationForTesting = true; |
679 } | 679 } |
680 | 680 |
681 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase() { | 681 ImageBitmap* WebGLRenderingContextBase::transferToImageBitmapBase( |
| 682 ScriptState* scriptState) { |
| 683 UseCounter::Feature feature = |
| 684 UseCounter::OffscreenCanvasTransferToImageBitmapWebGL; |
| 685 UseCounter::count(scriptState->getExecutionContext(), feature); |
682 if (!drawingBuffer()) | 686 if (!drawingBuffer()) |
683 return nullptr; | 687 return nullptr; |
684 return ImageBitmap::create(drawingBuffer()->transferToStaticBitmapImage()); | 688 return ImageBitmap::create(drawingBuffer()->transferToStaticBitmapImage()); |
685 } | 689 } |
686 | 690 |
687 void WebGLRenderingContextBase::commit(ExceptionState& exceptionState) { | 691 void WebGLRenderingContextBase::commit(ScriptState* scriptState, |
| 692 ExceptionState& exceptionState) { |
| 693 UseCounter::Feature feature = UseCounter::OffscreenCanvasCommitWebGL; |
| 694 UseCounter::count(scriptState->getExecutionContext(), feature); |
688 if (!getOffscreenCanvas()) { | 695 if (!getOffscreenCanvas()) { |
689 exceptionState.throwDOMException(InvalidStateError, | 696 exceptionState.throwDOMException(InvalidStateError, |
690 "Commit() was called on a rendering " | 697 "Commit() was called on a rendering " |
691 "context that was not created from an " | 698 "context that was not created from an " |
692 "OffscreenCanvas."); | 699 "OffscreenCanvas."); |
693 return; | 700 return; |
694 } | 701 } |
695 // no HTMLCanvas associated, thrown InvalidStateError | 702 // no HTMLCanvas associated, thrown InvalidStateError |
696 if (getOffscreenCanvas()->getAssociatedCanvasId() == -1) { | 703 if (getOffscreenCanvas()->getAssociatedCanvasId() == -1) { |
697 exceptionState.throwDOMException(InvalidStateError, | 704 exceptionState.throwDOMException(InvalidStateError, |
(...skipping 6842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7540 | 7547 |
7541 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7548 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
7542 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7549 HTMLCanvasElementOrOffscreenCanvas& result) const { |
7543 if (canvas()) | 7550 if (canvas()) |
7544 result.setHTMLCanvasElement(canvas()); | 7551 result.setHTMLCanvasElement(canvas()); |
7545 else | 7552 else |
7546 result.setOffscreenCanvas(getOffscreenCanvas()); | 7553 result.setOffscreenCanvas(getOffscreenCanvas()); |
7547 } | 7554 } |
7548 | 7555 |
7549 } // namespace blink | 7556 } // namespace blink |
OLD | NEW |