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 #include "wtf/RefCounted.h" |
sof
2015/08/01 18:49:13
Can be removed.
peria
2015/08/03 09:00:36
Done.
| |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class WebGLExtensionScopedContext : public NoBaseWillBeGarbageCollectedFinalized <WebGLExtensionScopedContext> { | 38 class WebGLExtensionScopedContext : public GarbageCollectedFinalized<WebGLExtens ionScopedContext> { |
sof
2015/08/01 18:49:13
Can't we make this just STACK_ALLOCATED()?
peria
2015/08/03 09:00:36
Done.
| |
39 WTF_MAKE_NONCOPYABLE(WebGLExtensionScopedContext); | 39 WTF_MAKE_NONCOPYABLE(WebGLExtensionScopedContext); |
40 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLExtensionScopedContext); | |
41 public: | 40 public: |
42 WebGLExtensionScopedContext(WebGLExtension*); | 41 WebGLExtensionScopedContext(WebGLExtension*); |
sof
2015/08/01 18:49:13
add explicit
peria
2015/08/03 09:00:36
Done.
| |
43 virtual ~WebGLExtensionScopedContext(); | 42 virtual ~WebGLExtensionScopedContext(); |
44 | 43 |
45 bool isLost() { return !m_context; } | 44 bool isLost() { return !m_context; } |
46 WebGLRenderingContextBase* context() const { return m_context.get(); } | 45 WebGLRenderingContextBase* context() const { return m_context.get(); } |
47 | 46 |
48 DECLARE_VIRTUAL_TRACE(); | 47 DECLARE_VIRTUAL_TRACE(); |
49 | 48 |
50 private: | 49 private: |
51 RefPtrWillBeMember<WebGLRenderingContextBase> m_context; | 50 RefPtrWillBeMember<WebGLRenderingContextBase> m_context; |
52 }; | 51 }; |
53 | 52 |
54 class WebGLExtension : public RefCountedWillBeGarbageCollectedFinalized<WebGLExt ension>, public ScriptWrappable { | 53 class WebGLExtension : public GarbageCollectedFinalized<WebGLExtension>, public ScriptWrappable { |
55 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLExtension); | |
56 public: | 54 public: |
57 virtual ~WebGLExtension(); | 55 virtual ~WebGLExtension(); |
58 virtual WebGLExtensionName name() const = 0; | 56 virtual WebGLExtensionName name() const = 0; |
59 | 57 |
60 // Lose this extension. Passing true = force loss. Some extensions | 58 // Lose this extension. Passing true = force loss. Some extensions |
61 // like WEBGL_lose_context are not normally lost when the context | 59 // like WEBGL_lose_context are not normally lost when the context |
62 // is lost but must be lost when destroying their WebGLRenderingContextBase. | 60 // is lost but must be lost when destroying their WebGLRenderingContextBase. |
63 virtual void lose(bool) | 61 virtual void lose(bool) |
64 { | 62 { |
65 m_context = nullptr; | 63 m_context = nullptr; |
(...skipping 10 matching lines...) Expand all Loading... | |
76 return m_context->canvas(); | 74 return m_context->canvas(); |
77 return nullptr; | 75 return nullptr; |
78 } | 76 } |
79 | 77 |
80 protected: | 78 protected: |
81 explicit WebGLExtension(WebGLRenderingContextBase*); | 79 explicit WebGLExtension(WebGLRenderingContextBase*); |
82 | 80 |
83 private: | 81 private: |
84 friend WebGLExtensionScopedContext; | 82 friend WebGLExtensionScopedContext; |
85 | 83 |
86 RawPtrWillBeWeakMember<WebGLRenderingContextBase> m_context; | 84 RefPtrWillBeWeakMember<WebGLRenderingContextBase> m_context; |
sof
2015/08/01 18:49:13
Could you explain why this needs to be a RefPtr<>
peria
2015/08/03 09:00:36
I reverted this change.
I'm not sure why I did thi
| |
87 }; | 85 }; |
88 | 86 |
89 } // namespace blink | 87 } // namespace blink |
90 | 88 |
91 #endif // WebGLExtension_h | 89 #endif // WebGLExtension_h |
OLD | NEW |