Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 } | 49 } |
| 50 | 50 |
| 51 template <typename T> | 51 template <typename T> |
| 52 GLuint objectNonZero(const T* object) | 52 GLuint objectNonZero(const T* object) |
| 53 { | 53 { |
| 54 GLuint result = object->object(); | 54 GLuint result = object->object(); |
| 55 DCHECK(result); | 55 DCHECK(result); |
| 56 return result; | 56 return result; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // TODO(kbr): v8::Persistent doesn't auto-reset in its destructor, | |
| 60 // which wreaks havoc when they're embedded in Oilpan objects even if | |
| 61 // they use GarbageCollectedFinalized. The first V8 GC after the | |
| 62 // Oilpan object is reclaimed will reset the cell in the | |
| 63 // v8::Persistent, scribbling over the Oilpan heap. If v8::Persistents | |
| 64 // are ever embedded in Oilpan objects, they must use | |
| 65 // CopyablePersistentTraits to pick up the kResetInDestructor = true | |
| 66 // setting. This alias template ensures correct usage, but ideally, | |
| 67 // these persistent caches would not be necessary. crbug.com/611864 | |
| 68 template <typename T> | |
| 69 using V8CopyablePersistent = v8::Persistent<T, v8::CopyablePersistentTraits<T>>; | |
|
haraken
2016/05/15 09:18:46
Instead you should use ScopedPersistent. Then Scop
| |
| 70 | |
| 59 class WebGLObject : public GarbageCollectedFinalized<WebGLObject>, public Script Wrappable { | 71 class WebGLObject : public GarbageCollectedFinalized<WebGLObject>, public Script Wrappable { |
| 60 public: | 72 public: |
| 61 virtual ~WebGLObject(); | 73 virtual ~WebGLObject(); |
| 62 | 74 |
| 63 // deleteObject may not always delete the OpenGL resource. For programs and | 75 // deleteObject may not always delete the OpenGL resource. For programs and |
| 64 // shaders, deletion is delayed until they are no longer attached. | 76 // shaders, deletion is delayed until they are no longer attached. |
| 65 // FIXME: revisit this when resource sharing between contexts are implemente d. | 77 // FIXME: revisit this when resource sharing between contexts are implemente d. |
| 66 void deleteObject(gpu::gles2::GLES2Interface*); | 78 void deleteObject(gpu::gles2::GLES2Interface*); |
| 67 | 79 |
| 68 void onAttached() { ++m_attachmentCount; } | 80 void onAttached() { ++m_attachmentCount; } |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 94 virtual gpu::gles2::GLES2Interface* getAGLInterface() const = 0; | 106 virtual gpu::gles2::GLES2Interface* getAGLInterface() const = 0; |
| 95 | 107 |
| 96 private: | 108 private: |
| 97 unsigned m_attachmentCount; | 109 unsigned m_attachmentCount; |
| 98 bool m_deleted; | 110 bool m_deleted; |
| 99 }; | 111 }; |
| 100 | 112 |
| 101 } // namespace blink | 113 } // namespace blink |
| 102 | 114 |
| 103 #endif // WebGLObject_h | 115 #endif // WebGLObject_h |
| OLD | NEW |