| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef CanvasRenderingContext_h | 26 #ifndef CanvasRenderingContext_h |
| 27 #define CanvasRenderingContext_h | 27 #define CanvasRenderingContext_h |
| 28 | 28 |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/dom/ActiveDOMObject.h" | |
| 31 #include "core/html/HTMLCanvasElement.h" | 30 #include "core/html/HTMLCanvasElement.h" |
| 32 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
| 33 #include "wtf/HashSet.h" | 32 #include "wtf/HashSet.h" |
| 34 #include "wtf/Noncopyable.h" | 33 #include "wtf/Noncopyable.h" |
| 35 #include "wtf/text/StringHash.h" | 34 #include "wtf/text/StringHash.h" |
| 36 | 35 |
| 37 class SkCanvas; | 36 class SkCanvas; |
| 38 | 37 |
| 39 namespace blink { class WebLayer; } | 38 namespace blink { class WebLayer; } |
| 40 | 39 |
| 41 namespace blink { | 40 namespace blink { |
| 42 | 41 |
| 43 class CanvasImageSource; | 42 class CanvasImageSource; |
| 44 class HTMLCanvasElement; | 43 class HTMLCanvasElement; |
| 45 class ImageData; | 44 class ImageData; |
| 46 | 45 |
| 47 class CORE_EXPORT CanvasRenderingContext : public NoBaseWillBeGarbageCollectedFi
nalized<CanvasRenderingContext>, public ActiveDOMObject, public ScriptWrappable
{ | 46 class CORE_EXPORT CanvasRenderingContext : public NoBaseWillBeGarbageCollectedFi
nalized<CanvasRenderingContext>, public ScriptWrappable { |
| 48 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); | 47 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); |
| 49 USING_FAST_MALLOC_WILL_BE_REMOVED(CanvasRenderingContext); | 48 USING_FAST_MALLOC_WILL_BE_REMOVED(CanvasRenderingContext); |
| 50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(CanvasRenderingContext); | |
| 51 public: | 49 public: |
| 52 ~CanvasRenderingContext() override { } | 50 virtual ~CanvasRenderingContext() { } |
| 53 | 51 |
| 54 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2
D canvas and the existing | 52 // A Canvas can either be "2D" or "webgl" but never both. If you request a 2
D canvas and the existing |
| 55 // context is already 2D, just return that. If the existing context is WebGL
, then destroy it | 53 // context is already 2D, just return that. If the existing context is WebGL
, then destroy it |
| 56 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a | 54 // before creating a new 2D context. Vice versa when requesting a WebGL canv
as. Requesting a |
| 57 // context with any other type string will destroy any existing context. | 55 // context with any other type string will destroy any existing context. |
| 58 enum ContextType { | 56 enum ContextType { |
| 59 // Do not change assigned numbers of existing items: add new features to
the end of the list. | 57 // Do not change assigned numbers of existing items: add new features to
the end of the list. |
| 60 Context2d = 0, | 58 Context2d = 0, |
| 61 ContextExperimentalWebgl = 2, | 59 ContextExperimentalWebgl = 2, |
| 62 ContextWebgl = 3, | 60 ContextWebgl = 3, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 virtual ImageData* paintRenderingResultsToImageData(SourceDrawingBuffer) { A
SSERT_NOT_REACHED(); return nullptr; } | 116 virtual ImageData* paintRenderingResultsToImageData(SourceDrawingBuffer) { A
SSERT_NOT_REACHED(); return nullptr; } |
| 119 virtual int externallyAllocatedBytesPerPixel() { ASSERT_NOT_REACHED(); retur
n 0; } | 117 virtual int externallyAllocatedBytesPerPixel() { ASSERT_NOT_REACHED(); retur
n 0; } |
| 120 | 118 |
| 121 bool wouldTaintOrigin(CanvasImageSource*); | 119 bool wouldTaintOrigin(CanvasImageSource*); |
| 122 void didMoveToNewDocument(Document*); | 120 void didMoveToNewDocument(Document*); |
| 123 | 121 |
| 124 protected: | 122 protected: |
| 125 CanvasRenderingContext(HTMLCanvasElement*); | 123 CanvasRenderingContext(HTMLCanvasElement*); |
| 126 DECLARE_VIRTUAL_TRACE(); | 124 DECLARE_VIRTUAL_TRACE(); |
| 127 | 125 |
| 128 // ActiveDOMObject notifications | 126 virtual void stop() = 0; |
| 129 bool hasPendingActivity() const final; | |
| 130 void stop() override = 0; | |
| 131 | 127 |
| 132 private: | 128 private: |
| 133 RawPtrWillBeMember<HTMLCanvasElement> m_canvas; | 129 RawPtrWillBeMember<HTMLCanvasElement> m_canvas; |
| 134 HashSet<String> m_cleanURLs; | 130 HashSet<String> m_cleanURLs; |
| 135 HashSet<String> m_dirtyURLs; | 131 HashSet<String> m_dirtyURLs; |
| 136 }; | 132 }; |
| 137 | 133 |
| 138 } // namespace blink | 134 } // namespace blink |
| 139 | 135 |
| 140 #endif | 136 #endif |
| OLD | NEW |