aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglprogram.rs
diff options
context:
space:
mode:
authorTobias Tschinkowitz <tobias.tschinkowitz@icloud.com>2020-04-23 18:23:01 +0200
committerTobias Tschinkowitz <tobias.tschinkowitz@icloud.com>2020-04-23 18:23:01 +0200
commit9c343fcc9600a1a2b768a4632793d0856d55ddce (patch)
tree468ae96e83fb1986e392d5b1c2bdece3bd17f67f /components/script/dom/webglprogram.rs
parent60e75314feaf0b5009f0cabfca6930ef1a584f27 (diff)
downloadservo-9c343fcc9600a1a2b768a4632793d0856d55ddce.tar.gz
servo-9c343fcc9600a1a2b768a4632793d0856d55ddce.zip
Replaced failible boolean with an enum
Diffstat (limited to 'components/script/dom/webglprogram.rs')
-rw-r--r--components/script/dom/webglprogram.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs
index 79598f7f5c1..88cecf0296f 100644
--- a/components/script/dom/webglprogram.rs
+++ b/components/script/dom/webglprogram.rs
@@ -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);
}
}