| 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 29 matching lines...) Expand all Loading... |
| 40 return nullptr; | 40 return nullptr; |
| 41 | 41 |
| 42 // Weak processing removes dead entries from the HeapHashSet, so it's | 42 // Weak processing removes dead entries from the HeapHashSet, so it's |
| 43 // guaranteed that this will not return null for the reason that a | 43 // guaranteed that this will not return null for the reason that a |
| 44 // WeakMember was nulled out. | 44 // WeakMember was nulled out. |
| 45 return (*m_contexts.begin())->contextGL(); | 45 return (*m_contexts.begin())->contextGL(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void WebGLContextGroup::addContext(WebGLRenderingContextBase* context) { | 48 void WebGLContextGroup::addContext(WebGLRenderingContextBase* context) { |
| 49 m_contexts.add(context); | 49 m_contexts.add(context); |
| 50 ScriptWrappableVisitor::writeBarrier(this, context); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void WebGLContextGroup::loseContextGroup( | 53 void WebGLContextGroup::loseContextGroup( |
| 53 WebGLRenderingContextBase::LostContextMode mode, | 54 WebGLRenderingContextBase::LostContextMode mode, |
| 54 WebGLRenderingContextBase::AutoRecoveryMethod autoRecoveryMethod) { | 55 WebGLRenderingContextBase::AutoRecoveryMethod autoRecoveryMethod) { |
| 55 ++m_numberOfContextLosses; | 56 ++m_numberOfContextLosses; |
| 56 for (WebGLRenderingContextBase* const context : m_contexts) | 57 for (WebGLRenderingContextBase* const context : m_contexts) |
| 57 context->loseContextImpl(mode, autoRecoveryMethod); | 58 context->loseContextImpl(mode, autoRecoveryMethod); |
| 58 } | 59 } |
| 59 | 60 |
| 60 uint32_t WebGLContextGroup::numberOfContextLosses() const { | 61 uint32_t WebGLContextGroup::numberOfContextLosses() const { |
| 61 return m_numberOfContextLosses; | 62 return m_numberOfContextLosses; |
| 62 } | 63 } |
| 63 | 64 |
| 64 DEFINE_TRACE_WRAPPERS(WebGLContextGroup) { | 65 DEFINE_TRACE_WRAPPERS(WebGLContextGroup) { |
| 65 // TODO(kbr, mlippautz): need to use the manual write barrier since we | 66 // TODO(kbr, mlippautz): need to use the manual write barrier since we |
| 66 // need to use weak members to get the desired semantics in Oilpan, but | 67 // need to use weak members to get the desired semantics in Oilpan, but |
| 67 // no such TraceWrapperMember (like TraceWrapperWeakMember) exists yet. | 68 // no such TraceWrapperMember (like TraceWrapperWeakMember) exists yet. |
| 68 for (auto context : m_contexts) { | 69 for (auto context : m_contexts) { |
| 69 visitor->traceWrappersWithManualWriteBarrier(context); | 70 visitor->traceWrappersWithManualWriteBarrier(context); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 | 73 |
| 73 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |