OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #ifndef WebGLExtension_h | 26 #ifndef WebGLExtension_h |
27 #define WebGLExtension_h | 27 #define WebGLExtension_h |
28 | 28 |
29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
30 #include "core/html/HTMLCanvasElement.h" | 30 #include "core/html/HTMLCanvasElement.h" |
31 #include "modules/webgl/WebGLExtensionName.h" | 31 #include "modules/webgl/WebGLExtensionName.h" |
32 #include "modules/webgl/WebGLRenderingContextBase.h" | 32 #include "modules/webgl/WebGLRenderingContextBase.h" |
33 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
| 34 #include "wtf/RefCounted.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class WebGLExtensionScopedContext final { | 38 class WebGLExtensionScopedContext : public NoBaseWillBeGarbageCollectedFinalized
<WebGLExtensionScopedContext> { |
38 STACK_ALLOCATED(); | |
39 WTF_MAKE_NONCOPYABLE(WebGLExtensionScopedContext); | 39 WTF_MAKE_NONCOPYABLE(WebGLExtensionScopedContext); |
| 40 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLExtensionScopedContext); |
40 public: | 41 public: |
41 explicit WebGLExtensionScopedContext(WebGLExtension*); | 42 WebGLExtensionScopedContext(WebGLExtension*); |
42 ~WebGLExtensionScopedContext(); | 43 virtual ~WebGLExtensionScopedContext(); |
43 | 44 |
44 bool isLost() const { return !m_context; } | 45 bool isLost() { return !m_context; } |
45 WebGLRenderingContextBase* context() const { return m_context.get(); } | 46 WebGLRenderingContextBase* context() const { return m_context.get(); } |
46 | 47 |
| 48 DECLARE_VIRTUAL_TRACE(); |
| 49 |
47 private: | 50 private: |
48 RefPtrWillBeMember<WebGLRenderingContextBase> m_context; | 51 RefPtrWillBeMember<WebGLRenderingContextBase> m_context; |
49 }; | 52 }; |
50 | 53 |
51 class WebGLExtension : public GarbageCollectedFinalized<WebGLExtension>, public
ScriptWrappable { | 54 class WebGLExtension : public RefCountedWillBeGarbageCollectedFinalized<WebGLExt
ension>, public ScriptWrappable { |
| 55 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLExtension); |
52 public: | 56 public: |
53 virtual ~WebGLExtension(); | 57 virtual ~WebGLExtension(); |
54 virtual WebGLExtensionName name() const = 0; | 58 virtual WebGLExtensionName name() const = 0; |
55 | 59 |
56 // Lose this extension. Passing true = force loss. Some extensions | 60 // Lose this extension. Passing true = force loss. Some extensions |
57 // like WEBGL_lose_context are not normally lost when the context | 61 // like WEBGL_lose_context are not normally lost when the context |
58 // is lost but must be lost when destroying their WebGLRenderingContextBase. | 62 // is lost but must be lost when destroying their WebGLRenderingContextBase. |
59 virtual void lose(bool) | 63 virtual void lose(bool) |
60 { | 64 { |
61 m_context = nullptr; | 65 m_context = nullptr; |
(...skipping 16 matching lines...) Expand all Loading... |
78 | 82 |
79 private: | 83 private: |
80 friend WebGLExtensionScopedContext; | 84 friend WebGLExtensionScopedContext; |
81 | 85 |
82 RawPtrWillBeWeakMember<WebGLRenderingContextBase> m_context; | 86 RawPtrWillBeWeakMember<WebGLRenderingContextBase> m_context; |
83 }; | 87 }; |
84 | 88 |
85 } // namespace blink | 89 } // namespace blink |
86 | 90 |
87 #endif // WebGLExtension_h | 91 #endif // WebGLExtension_h |
OLD | NEW |