mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Replaced failible boolean with an enum
This commit is contained in:
parent
60e75314fe
commit
9c343fcc96
15 changed files with 106 additions and 111 deletions
|
@ -12,7 +12,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::webglactiveinfo::WebGLActiveInfo;
|
||||
use crate::dom::webglobject::WebGLObject;
|
||||
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
|
||||
use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext};
|
||||
use crate::dom::webglshader::WebGLShader;
|
||||
use crate::dom::webgluniformlocation::WebGLUniformLocation;
|
||||
use canvas_traits::webgl::{webgl_channel, WebGLProgramId, WebGLResult};
|
||||
|
@ -84,17 +84,16 @@ impl WebGLProgram {
|
|||
}
|
||||
|
||||
/// glDeleteProgram
|
||||
pub fn mark_for_deletion(&self, fallible: bool) {
|
||||
pub fn mark_for_deletion(&self, operation_fallibility: Operation) {
|
||||
if self.marked_for_deletion.get() {
|
||||
return;
|
||||
}
|
||||
self.marked_for_deletion.set(true);
|
||||
let cmd = WebGLCommand::DeleteProgram(self.id);
|
||||
let context = self.upcast::<WebGLObject>().context();
|
||||
if fallible {
|
||||
context.send_command_ignored(cmd);
|
||||
} else {
|
||||
context.send_command(cmd);
|
||||
match operation_fallibility {
|
||||
Operation::Fallible => context.send_command_ignored(cmd),
|
||||
Operation::Infallible => context.send_command(cmd),
|
||||
}
|
||||
if self.is_deleted() {
|
||||
self.detach_shaders();
|
||||
|
@ -639,7 +638,7 @@ impl WebGLProgram {
|
|||
impl Drop for WebGLProgram {
|
||||
fn drop(&mut self) {
|
||||
self.in_use(false);
|
||||
self.mark_for_deletion(true);
|
||||
self.mark_for_deletion(Operation::Fallible);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue