Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLObject.h

Issue 1983953002: Replace uses of v8::Persistent with ScopedPersistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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>>;
70
71 class WebGLObject : public GarbageCollectedFinalized<WebGLObject>, public Script Wrappable { 59 class WebGLObject : public GarbageCollectedFinalized<WebGLObject>, public Script Wrappable {
72 public: 60 public:
73 virtual ~WebGLObject(); 61 virtual ~WebGLObject();
74 62
75 // deleteObject may not always delete the OpenGL resource. For programs and 63 // deleteObject may not always delete the OpenGL resource. For programs and
76 // shaders, deletion is delayed until they are no longer attached. 64 // shaders, deletion is delayed until they are no longer attached.
77 // FIXME: revisit this when resource sharing between contexts are implemente d. 65 // FIXME: revisit this when resource sharing between contexts are implemente d.
78 void deleteObject(gpu::gles2::GLES2Interface*); 66 void deleteObject(gpu::gles2::GLES2Interface*);
79 67
80 void onAttached() { ++m_attachmentCount; } 68 void onAttached() { ++m_attachmentCount; }
(...skipping 25 matching lines...) Expand all
106 virtual gpu::gles2::GLES2Interface* getAGLInterface() const = 0; 94 virtual gpu::gles2::GLES2Interface* getAGLInterface() const = 0;
107 95
108 private: 96 private:
109 unsigned m_attachmentCount; 97 unsigned m_attachmentCount;
110 bool m_deleted; 98 bool m_deleted;
111 }; 99 };
112 100
113 } // namespace blink 101 } // namespace blink
114 102
115 #endif // WebGLObject_h 103 #endif // WebGLObject_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp ('k') | third_party/WebKit/Source/modules/webgl/WebGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698