| 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 12 matching lines...) Expand all  Loading... | 
|  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 #include "modules/webgl/WebGLContextGroup.h" |  26 #include "modules/webgl/WebGLContextGroup.h" | 
|  27  |  27  | 
|  28 namespace blink { |  28 namespace blink { | 
|  29  |  29  | 
|  30 WebGLContextGroup::WebGLContextGroup() : m_numberOfContextLosses(0) {} |  30 WebGLContextGroup::WebGLContextGroup() : m_numberOfContextLosses(0) {} | 
|  31  |  31  | 
|  32 gpu::gles2::GLES2Interface* WebGLContextGroup::getAGLInterface() { |  32 gpu::gles2::GLES2Interface* WebGLContextGroup::getAGLInterface() { | 
|  33   // During an Oilpan GC where WebGL objects become unreachable at the same |  33   // It's possible that all of the WebGLRenderingContextBases (currently | 
|  34   // time the context does, the m_contexts set can be fully cleared out |  34   // only one) referenced weakly by this WebGLContextGroup are GC'd before | 
|  35   // before WebGLObjects' destructors run. Since the calling code handles |  35   // the (shared) WebGLObjects that it created. Since the calling code | 
|  36   // this gracefully, explicitly test for this possibility. |  36   // handles this gracefully, and since the graphical resources will have | 
 |  37   // been implicitly reclaimed by the deletion of the context, explicitly | 
 |  38   // test for this possibility. | 
|  37   if (m_contexts.isEmpty()) |  39   if (m_contexts.isEmpty()) | 
|  38     return nullptr; |  40     return nullptr; | 
|  39  |  41  | 
|  40   // Weak processing removes dead entries from the HeapHashSet, so it's |  42   // Weak processing removes dead entries from the HeapHashSet, so it's | 
|  41   // 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 | 
|  42   // WeakMember was nulled out. |  44   // WeakMember was nulled out. | 
|  43   return (*m_contexts.begin())->contextGL(); |  45   return (*m_contexts.begin())->contextGL(); | 
|  44 } |  46 } | 
|  45  |  47  | 
|  46 void WebGLContextGroup::addContext(WebGLRenderingContextBase* context) { |  48 void WebGLContextGroup::addContext(WebGLRenderingContextBase* context) { | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
|  62 DEFINE_TRACE_WRAPPERS(WebGLContextGroup) { |  64 DEFINE_TRACE_WRAPPERS(WebGLContextGroup) { | 
|  63   // TODO(kbr, mlippautz): need to use the manual write barrier since we |  65   // TODO(kbr, mlippautz): need to use the manual write barrier since we | 
|  64   // need to use weak members to get the desired semantics in Oilpan, but |  66   // need to use weak members to get the desired semantics in Oilpan, but | 
|  65   // no such TraceWrapperMember (like TraceWrapperWeakMember) exists yet. |  67   // no such TraceWrapperMember (like TraceWrapperWeakMember) exists yet. | 
|  66   for (auto context : m_contexts) { |  68   for (auto context : m_contexts) { | 
|  67     visitor->traceWrappersWithManualWriteBarrier(context); |  69     visitor->traceWrappersWithManualWriteBarrier(context); | 
|  68   } |  70   } | 
|  69 } |  71 } | 
|  70  |  72  | 
|  71 }  // namespace blink |  73 }  // namespace blink | 
| OLD | NEW |