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/html/HTMLCanvasElement.h" | 29 #include "core/html/HTMLCanvasElement.h" |
| 30 #include "platform/heap/Handle.h" |
30 #include "wtf/HashSet.h" | 31 #include "wtf/HashSet.h" |
31 #include "wtf/Noncopyable.h" | 32 #include "wtf/Noncopyable.h" |
32 #include "wtf/text/StringHash.h" | 33 #include "wtf/text/StringHash.h" |
33 | 34 |
34 namespace blink { class WebLayer; } | 35 namespace blink { class WebLayer; } |
35 | 36 |
36 namespace WebCore { | 37 namespace WebCore { |
37 | 38 |
38 class HTMLCanvasElement; | 39 class HTMLCanvasElement; |
39 class KURL; | 40 class KURL; |
40 class WebGLObject; | 41 class WebGLObject; |
41 | 42 |
42 class CanvasRenderingContext { | 43 class CanvasRenderingContext : public NoBaseWillBeGarbageCollectedFinalized<Canv
asRenderingContext> { |
43 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); WTF_MAKE_FAST_ALLOCATED; | 44 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); |
| 45 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
44 public: | 46 public: |
45 virtual ~CanvasRenderingContext() { } | 47 virtual ~CanvasRenderingContext() { } |
46 | 48 |
| 49 #if !ENABLE(OILPAN) |
47 void ref() { m_canvas->ref(); } | 50 void ref() { m_canvas->ref(); } |
48 void deref() { m_canvas->deref(); } | 51 void deref() { m_canvas->deref(); } |
| 52 #endif |
| 53 |
49 HTMLCanvasElement* canvas() const { return m_canvas; } | 54 HTMLCanvasElement* canvas() const { return m_canvas; } |
50 | 55 |
51 virtual bool is2d() const { return false; } | 56 virtual bool is2d() const { return false; } |
52 virtual bool is3d() const { return false; } | 57 virtual bool is3d() const { return false; } |
53 virtual bool isAccelerated() const { return false; } | 58 virtual bool isAccelerated() const { return false; } |
54 virtual bool hasAlpha() const { return true; } | 59 virtual bool hasAlpha() const { return true; } |
55 | 60 |
56 virtual void paintRenderingResultsToCanvas() {} | 61 virtual void paintRenderingResultsToCanvas() {} |
57 | 62 |
58 virtual blink::WebLayer* platformLayer() const { return 0; } | 63 virtual blink::WebLayer* platformLayer() const { return 0; } |
| 64 |
| 65 virtual void trace(Visitor* visitor) { visitor->trace(m_canvas); } |
| 66 |
59 protected: | 67 protected: |
60 CanvasRenderingContext(HTMLCanvasElement*); | 68 CanvasRenderingContext(HTMLCanvasElement*); |
61 | 69 |
62 private: | 70 private: |
63 HTMLCanvasElement* m_canvas; | 71 RawPtrWillBeMember<HTMLCanvasElement> m_canvas; |
64 }; | 72 }; |
65 | 73 |
66 } // namespace WebCore | 74 } // namespace WebCore |
67 | 75 |
68 #endif | 76 #endif |
OLD | NEW |