OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef WebGLContextGroup_h | 26 #ifndef WebGLContextGroup_h |
27 #define WebGLContextGroup_h | 27 #define WebGLContextGroup_h |
28 | 28 |
29 #include "core/html/canvas/WebGLRenderingContextBase.h" | 29 #include "core/html/canvas/WebGLRenderingContextBase.h" |
30 #include "wtf/HashSet.h" | 30 #include "wtf/HashSet.h" |
31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
32 #include "wtf/RefCounted.h" | 32 #include "wtf/RefCounted.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
| 35 |
35 class WebGraphicsContext3D; | 36 class WebGraphicsContext3D; |
36 } | |
37 | |
38 namespace blink { | |
39 | |
40 class WebGLSharedObject; | 37 class WebGLSharedObject; |
41 class WebGLRenderingContextBase; | 38 class WebGLRenderingContextBase; |
42 | 39 |
43 typedef int ExceptionCode; | |
44 | |
45 class WebGLContextGroup final : public RefCounted<WebGLContextGroup> { | 40 class WebGLContextGroup final : public RefCounted<WebGLContextGroup> { |
46 public: | 41 public: |
47 static PassRefPtr<WebGLContextGroup> create(); | 42 static PassRefPtr<WebGLContextGroup> create(); |
48 ~WebGLContextGroup(); | 43 ~WebGLContextGroup(); |
49 | 44 |
50 void addContext(WebGLRenderingContextBase*); | 45 void addContext(WebGLRenderingContextBase*); |
51 void removeContext(WebGLRenderingContextBase*); | 46 void removeContext(WebGLRenderingContextBase*); |
52 | 47 |
53 void addObject(WebGLSharedObject*); | 48 void addObject(WebGLSharedObject*); |
54 void removeObject(WebGLSharedObject*); | 49 void removeObject(WebGLSharedObject*); |
55 | 50 |
56 WebGraphicsContext3D* getAWebGraphicsContext3D(); | 51 WebGraphicsContext3D* getAWebGraphicsContext3D(); |
57 | 52 |
58 void loseContextGroup(WebGLRenderingContextBase::LostContextMode, WebGLRende
ringContextBase::AutoRecoveryMethod); | 53 void loseContextGroup(WebGLRenderingContextBase::LostContextMode, WebGLRende
ringContextBase::AutoRecoveryMethod); |
59 | 54 |
| 55 #if ENABLE(OILPAN) && defined(ADDRESS_SANITIZER) |
| 56 void poisonContext(bool); |
| 57 void poisonObject(WebGLSharedObject*, bool); |
| 58 |
| 59 class UnpoisonScope final { |
| 60 STACK_ALLOCATED(); |
| 61 public: |
| 62 UnpoisonScope(WebGLContextGroup*); |
| 63 UnpoisonScope(WebGLContextGroup*, WebGLSharedObject*); |
| 64 ~UnpoisonScope(); |
| 65 |
| 66 private: |
| 67 Member<WebGLContextGroup> m_context; |
| 68 Member<WebGLSharedObject> m_object; |
| 69 }; |
| 70 #endif |
| 71 |
60 private: | 72 private: |
61 friend class WebGLObject; | 73 friend class WebGLObject; |
62 | 74 |
63 WebGLContextGroup(); | 75 WebGLContextGroup(); |
64 | 76 |
65 void detachAndRemoveAllObjects(); | 77 void detachAndRemoveAllObjects(); |
66 | 78 |
67 // FIXME: Oilpan: this object is not on the heap, but keeps bare | 79 // FIXME: Oilpan: this object is not on the heap, but keeps bare |
68 // pointers to garbage collected objects in the two hash sets | 80 // pointers to garbage collected objects in the two hash sets |
69 // below. The objects are responsible for managing their | 81 // below. The objects are responsible for managing their |
70 // registration with WebGLContextGroup, and vice versa, the | 82 // registration with WebGLContextGroup, and vice versa, the |
71 // WebGLContextGroup takes care of detaching the group objects if | 83 // WebGLContextGroup takes care of detaching the group objects if |
72 // the set of WebGLRenderingContextBase contexts becomes empty. | 84 // the set of WebGLRenderingContextBase contexts becomes empty. |
73 HashSet<WebGLRenderingContextBase*> m_contexts; | 85 HashSet<WebGLRenderingContextBase*> m_contexts; |
74 HashSet<WebGLSharedObject*> m_groupObjects; | 86 HashSet<WebGLSharedObject*> m_groupObjects; |
75 }; | 87 }; |
76 | 88 |
77 } // namespace blink | 89 } // namespace blink |
78 | 90 |
79 #endif // WebGLContextGroup_h | 91 #endif // WebGLContextGroup_h |
OLD | NEW |