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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLProgram.cpp

Issue 2547813002: Remove WebGLObject maps from WebGLRenderingContextBase and WebGLContextGroup. (Closed)
Patch Set: Created 4 years 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 29 matching lines...) Expand all
40 m_linkStatus(false), 40 m_linkStatus(false),
41 m_linkCount(0), 41 m_linkCount(0),
42 m_activeTransformFeedbackCount(0), 42 m_activeTransformFeedbackCount(0),
43 m_vertexShader(this, nullptr), 43 m_vertexShader(this, nullptr),
44 m_fragmentShader(this, nullptr), 44 m_fragmentShader(this, nullptr),
45 m_infoValid(true) { 45 m_infoValid(true) {
46 setObject(ctx->contextGL()->CreateProgram()); 46 setObject(ctx->contextGL()->CreateProgram());
47 } 47 }
48 48
49 WebGLProgram::~WebGLProgram() { 49 WebGLProgram::~WebGLProgram() {
50 // These heap objects handle detachment on their own. Clear out 50 runDestructor();
51 // the references to prevent deleteObjectImpl() from trying to do
52 // same, as we cannot safely access other heap objects from this
53 // destructor.
54 m_vertexShader = nullptr;
55 m_fragmentShader = nullptr;
56
57 // See the comment in WebGLObject::detachAndDeleteObject().
58 detachAndDeleteObject();
59 } 51 }
60 52
61 void WebGLProgram::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) { 53 void WebGLProgram::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) {
62 gl->DeleteProgram(m_object); 54 gl->DeleteProgram(m_object);
63 m_object = 0; 55 m_object = 0;
64 if (m_vertexShader) { 56 if (!destructionInProgress()) {
Kai Ninomiya 2016/12/02 18:51:28 Does this depend on the assumption that there is o
Ken Russell (switch to Gerrit) 2016/12/02 20:38:49 No, no such assumption and no such leak. When the
65 m_vertexShader->onDetached(gl); 57 if (m_vertexShader) {
66 m_vertexShader = nullptr; 58 m_vertexShader->onDetached(gl);
67 } 59 m_vertexShader = nullptr;
68 if (m_fragmentShader) { 60 }
69 m_fragmentShader->onDetached(gl); 61 if (m_fragmentShader) {
70 m_fragmentShader = nullptr; 62 m_fragmentShader->onDetached(gl);
63 m_fragmentShader = nullptr;
64 }
71 } 65 }
72 } 66 }
73 67
74 bool WebGLProgram::linkStatus(WebGLRenderingContextBase* context) { 68 bool WebGLProgram::linkStatus(WebGLRenderingContextBase* context) {
75 cacheInfoIfNeeded(context); 69 cacheInfoIfNeeded(context);
76 return m_linkStatus; 70 return m_linkStatus;
77 } 71 }
78 72
79 void WebGLProgram::increaseLinkCount() { 73 void WebGLProgram::increaseLinkCount() {
80 ++m_linkCount; 74 ++m_linkCount;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 WebGLSharedPlatform3DObject::trace(visitor); 158 WebGLSharedPlatform3DObject::trace(visitor);
165 } 159 }
166 160
167 DEFINE_TRACE_WRAPPERS(WebGLProgram) { 161 DEFINE_TRACE_WRAPPERS(WebGLProgram) {
168 visitor->traceWrappers(m_vertexShader); 162 visitor->traceWrappers(m_vertexShader);
169 visitor->traceWrappers(m_fragmentShader); 163 visitor->traceWrappers(m_fragmentShader);
170 WebGLSharedPlatform3DObject::traceWrappers(visitor); 164 WebGLSharedPlatform3DObject::traceWrappers(visitor);
171 } 165 }
172 166
173 } // namespace blink 167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698