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

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

Issue 1815803003: Move simple methods [T-Z] from WebGraphicsContext3D to GLES2Interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simples-fplus
Patch Set: Created 4 years, 9 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 21 matching lines...) Expand all
32 , m_deleted(false) 32 , m_deleted(false)
33 { 33 {
34 } 34 }
35 35
36 WebGLObject::~WebGLObject() 36 WebGLObject::~WebGLObject()
37 { 37 {
38 // Verify that platform objects have been explicitly deleted. 38 // Verify that platform objects have been explicitly deleted.
39 ASSERT(m_deleted); 39 ASSERT(m_deleted);
40 } 40 }
41 41
42 void WebGLObject::deleteObject(WebGraphicsContext3D* context3d) 42 void WebGLObject::deleteObject(WebGraphicsContext3D* context3d, gpu::gles2::GLES 2Interface* gl)
43 { 43 {
44 m_deleted = true; 44 m_deleted = true;
45 if (!hasObject()) 45 if (!hasObject())
46 return; 46 return;
47 47
48 if (!hasGroupOrContext()) 48 if (!hasGroupOrContext())
49 return; 49 return;
50 50
51 if (!m_attachmentCount) { 51 if (!m_attachmentCount) {
52 if (!context3d) 52 if (!context3d)
53 context3d = getAWebGraphicsContext3D(); 53 context3d = getAWebGraphicsContext3D();
danakj 2016/03/19 00:31:49 Oh this can get a context3d here, we need to grab
54 54
55 if (context3d) { 55 if (context3d) {
56 deleteObjectImpl(context3d); 56 deleteObjectImpl(context3d, gl);
57 // Ensure the inherited class no longer claims to have a valid objec t 57 // Ensure the inherited class no longer claims to have a valid objec t
58 ASSERT(!hasObject()); 58 ASSERT(!hasObject());
59 } 59 }
60 } 60 }
61 } 61 }
62 62
63 void WebGLObject::detach() 63 void WebGLObject::detach()
64 { 64 {
65 m_attachmentCount = 0; // Make sure OpenGL resource is deleted. 65 m_attachmentCount = 0; // Make sure OpenGL resource is deleted.
66 } 66 }
67 67
68 void WebGLObject::detachAndDeleteObject() 68 void WebGLObject::detachAndDeleteObject()
69 { 69 {
70 // To ensure that all platform objects are deleted after being detached, 70 // To ensure that all platform objects are deleted after being detached,
71 // this method does them together. 71 // this method does them together.
72 // 72 //
73 // The individual WebGL destructors need to call detachAndDeleteObject() 73 // The individual WebGL destructors need to call detachAndDeleteObject()
74 // rather than do it based on Oilpan GC. 74 // rather than do it based on Oilpan GC.
75 detach(); 75 detach();
76 deleteObject(nullptr); 76 deleteObject(nullptr, nullptr);
77 } 77 }
78 78
79 void WebGLObject::onDetached(WebGraphicsContext3D* context3d) 79 void WebGLObject::onDetached(WebGraphicsContext3D* context3d, gpu::gles2::GLES2I nterface* gl)
80 { 80 {
81 if (m_attachmentCount) 81 if (m_attachmentCount)
82 --m_attachmentCount; 82 --m_attachmentCount;
83 if (m_deleted) 83 if (m_deleted)
84 deleteObject(context3d); 84 deleteObject(context3d, gl);
85 } 85 }
86 86
87 } // namespace blink 87 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLObject.h ('k') | third_party/WebKit/Source/modules/webgl/WebGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698