| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 void WebGLObject::detach() | 65 void WebGLObject::detach() |
| 66 { | 66 { |
| 67 m_attachmentCount = 0; // Make sure OpenGL resource is deleted. | 67 m_attachmentCount = 0; // Make sure OpenGL resource is deleted. |
| 68 } | 68 } |
| 69 | 69 |
| 70 void WebGLObject::detachAndDeleteObject() | 70 void WebGLObject::detachAndDeleteObject() |
| 71 { | 71 { |
| 72 // Helper method that pairs detachment with platform object | 72 // Helper method that pairs detachment with platform object |
| 73 // deletion. | 73 // deletion. |
| 74 // | 74 // |
| 75 // With Oilpan enabled, objects may end up being finalized without | 75 // Objects may end up being finalized without having been detached first. |
| 76 // having been detached first. Consequently, the objects force | 76 // Consequently, the objects force detachment first before deleting the |
| 77 // detachment first before deleting the platform object. Without | 77 // platform object. |
| 78 // Oilpan, the objects will have been detached from the 'parent' | |
| 79 // objects first and do not separately require it when finalizing. | |
| 80 // | 78 // |
| 81 // However, as detach() is trivial, the individual WebGL | 79 // The individual WebGL destructors will always call detachAndDeleteObject() |
| 82 // destructors will always call detachAndDeleteObject() rather | 80 // rather than do it based on Oilpan GC. |
| 83 // than do it based on Oilpan being enabled. | |
| 84 detach(); | 81 detach(); |
| 85 deleteObject(nullptr); | 82 deleteObject(nullptr); |
| 86 } | 83 } |
| 87 | 84 |
| 88 void WebGLObject::onDetached(WebGraphicsContext3D* context3d) | 85 void WebGLObject::onDetached(WebGraphicsContext3D* context3d) |
| 89 { | 86 { |
| 90 if (m_attachmentCount) | 87 if (m_attachmentCount) |
| 91 --m_attachmentCount; | 88 --m_attachmentCount; |
| 92 if (m_deleted) | 89 if (m_deleted) |
| 93 deleteObject(context3d); | 90 deleteObject(context3d); |
| 94 } | 91 } |
| 95 | 92 |
| 96 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |