| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 WebGLContextGroup::~WebGLContextGroup() | 44 WebGLContextGroup::~WebGLContextGroup() |
| 45 { | 45 { |
| 46 detachAndRemoveAllObjects(); | 46 detachAndRemoveAllObjects(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 blink::WebGraphicsContext3D* WebGLContextGroup::getAWebGraphicsContext3D() | 49 blink::WebGraphicsContext3D* WebGLContextGroup::getAWebGraphicsContext3D() |
| 50 { | 50 { |
| 51 ASSERT(!m_contexts.isEmpty()); | 51 ASSERT(!m_contexts.isEmpty()); |
| 52 HashSet<WebGLRenderingContext*>::iterator it = m_contexts.begin(); | 52 HashSet<WebGLRenderingContextBase*>::iterator it = m_contexts.begin(); |
| 53 return (*it)->webGraphicsContext3D(); | 53 return (*it)->webGraphicsContext3D(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void WebGLContextGroup::addContext(WebGLRenderingContext* context) | 56 void WebGLContextGroup::addContext(WebGLRenderingContextBase* context) |
| 57 { | 57 { |
| 58 m_contexts.add(context); | 58 m_contexts.add(context); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void WebGLContextGroup::removeContext(WebGLRenderingContext* context) | 61 void WebGLContextGroup::removeContext(WebGLRenderingContextBase* context) |
| 62 { | 62 { |
| 63 // We must call detachAndRemoveAllObjects before removing the last context. | 63 // We must call detachAndRemoveAllObjects before removing the last context. |
| 64 if (m_contexts.size() == 1 && m_contexts.contains(context)) | 64 if (m_contexts.size() == 1 && m_contexts.contains(context)) |
| 65 detachAndRemoveAllObjects(); | 65 detachAndRemoveAllObjects(); |
| 66 | 66 |
| 67 m_contexts.remove(context); | 67 m_contexts.remove(context); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void WebGLContextGroup::removeObject(WebGLSharedObject* object) | 70 void WebGLContextGroup::removeObject(WebGLSharedObject* object) |
| 71 { | 71 { |
| 72 m_groupObjects.remove(object); | 72 m_groupObjects.remove(object); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void WebGLContextGroup::addObject(WebGLSharedObject* object) | 75 void WebGLContextGroup::addObject(WebGLSharedObject* object) |
| 76 { | 76 { |
| 77 m_groupObjects.add(object); | 77 m_groupObjects.add(object); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void WebGLContextGroup::detachAndRemoveAllObjects() | 80 void WebGLContextGroup::detachAndRemoveAllObjects() |
| 81 { | 81 { |
| 82 while (!m_groupObjects.isEmpty()) { | 82 while (!m_groupObjects.isEmpty()) { |
| 83 HashSet<WebGLSharedObject*>::iterator it = m_groupObjects.begin(); | 83 HashSet<WebGLSharedObject*>::iterator it = m_groupObjects.begin(); |
| 84 (*it)->detachContextGroup(); | 84 (*it)->detachContextGroup(); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 void WebGLContextGroup::loseContextGroup(WebGLRenderingContext::LostContextMode
mode) | 88 void WebGLContextGroup::loseContextGroup(WebGLRenderingContextBase::LostContextM
ode mode) |
| 89 { | 89 { |
| 90 // Detach must happen before loseContextImpl, which destroys the GraphicsCon
text3D | 90 // Detach must happen before loseContextImpl, which destroys the GraphicsCon
text3D |
| 91 // and prevents groupObjects from being properly deleted. | 91 // and prevents groupObjects from being properly deleted. |
| 92 detachAndRemoveAllObjects(); | 92 detachAndRemoveAllObjects(); |
| 93 | 93 |
| 94 for (HashSet<WebGLRenderingContext*>::iterator it = m_contexts.begin(); it !
= m_contexts.end(); ++it) | 94 for (HashSet<WebGLRenderingContextBase*>::iterator it = m_contexts.begin();
it != m_contexts.end(); ++it) |
| 95 (*it)->loseContextImpl(mode); | 95 (*it)->loseContextImpl(mode); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace WebCore | 98 } // namespace WebCore |
| OLD | NEW |