| 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 #include "modules/webgl/WebGLContextObject.h" | 26 #include "modules/webgl/WebGLContextObject.h" |
| 27 | 27 |
| 28 #include "modules/webgl/WebGLRenderingContextBase.h" | 28 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 WebGLContextObject::WebGLContextObject(WebGLRenderingContextBase* context) | 32 WebGLContextObject::WebGLContextObject(WebGLRenderingContextBase* context) |
| 33 : WebGLObject(context), m_context(context) {} | 33 : WebGLObject(context), m_context(context) {} |
| 34 | 34 |
| 35 WebGLContextObject::~WebGLContextObject() {} | 35 bool WebGLContextObject::validate( |
| 36 const WebGLContextGroup*, |
| 37 const WebGLRenderingContextBase* context) const { |
| 38 // The contexts and context groups no longer maintain references to all |
| 39 // the objects they ever created, so there's no way to invalidate them |
| 40 // eagerly during context loss. The invalidation is discovered lazily. |
| 41 return context == m_context && |
| 42 cachedNumberOfContextLosses() == context->numberOfContextLosses(); |
| 43 } |
| 36 | 44 |
| 37 void WebGLContextObject::detachContext() { | 45 uint32_t WebGLContextObject::currentNumberOfContextLosses() const { |
| 38 detach(); | 46 return m_context->numberOfContextLosses(); |
| 39 if (m_context) { | |
| 40 deleteObject(m_context->contextGL()); | |
| 41 m_context->removeContextObject(this); | |
| 42 m_context = nullptr; | |
| 43 } | |
| 44 } | 47 } |
| 45 | 48 |
| 46 gpu::gles2::GLES2Interface* WebGLContextObject::getAGLInterface() const { | 49 gpu::gles2::GLES2Interface* WebGLContextObject::getAGLInterface() const { |
| 47 return m_context->contextGL(); | 50 return m_context->contextGL(); |
| 48 } | 51 } |
| 49 | 52 |
| 50 DEFINE_TRACE(WebGLContextObject) { | 53 DEFINE_TRACE(WebGLContextObject) { |
| 51 visitor->trace(m_context); | 54 visitor->trace(m_context); |
| 52 WebGLObject::trace(visitor); | 55 WebGLObject::trace(visitor); |
| 53 } | 56 } |
| 54 | 57 |
| 55 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |