diff options
author | Tobias Tschinkowitz <tobias.tschinkowitz@icloud.com> | 2020-04-23 18:23:01 +0200 |
---|---|---|
committer | Tobias Tschinkowitz <tobias.tschinkowitz@icloud.com> | 2020-04-23 18:23:01 +0200 |
commit | 9c343fcc9600a1a2b768a4632793d0856d55ddce (patch) | |
tree | 468ae96e83fb1986e392d5b1c2bdece3bd17f67f /components/script/dom/webglsampler.rs | |
parent | 60e75314feaf0b5009f0cabfca6930ef1a584f27 (diff) | |
download | servo-9c343fcc9600a1a2b768a4632793d0856d55ddce.tar.gz servo-9c343fcc9600a1a2b768a4632793d0856d55ddce.zip |
Replaced failible boolean with an enum
Diffstat (limited to 'components/script/dom/webglsampler.rs')
-rw-r--r-- | components/script/dom/webglsampler.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/components/script/dom/webglsampler.rs b/components/script/dom/webglsampler.rs index c80e2a6a508..063decffe8f 100644 --- a/components/script/dom/webglsampler.rs +++ b/components/script/dom/webglsampler.rs @@ -7,7 +7,7 @@ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject}; use crate::dom::bindings::root::DomRoot; use crate::dom::webglobject::WebGLObject; -use crate::dom::webglrenderingcontext::WebGLRenderingContext; +use crate::dom::webglrenderingcontext::{Operation, WebGLRenderingContext}; use canvas_traits::webgl::WebGLError::*; use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLSamplerId}; use dom_struct::dom_struct; @@ -90,16 +90,15 @@ impl WebGLSampler { ) } - pub fn delete(&self, fallible: bool) { + pub fn delete(&self, operation_fallibility: Operation) { if !self.marked_for_deletion.get() { self.marked_for_deletion.set(true); let command = WebGLCommand::DeleteSampler(self.gl_id); let context = self.upcast::<WebGLObject>().context(); - if fallible { - context.send_command_ignored(command); - } else { - context.send_command(command); + match operation_fallibility { + Operation::Fallible => context.send_command_ignored(command), + Operation::Infallible => context.send_command(command), } } } @@ -180,6 +179,6 @@ impl WebGLSampler { impl Drop for WebGLSampler { fn drop(&mut self) { - self.delete(true); + self.delete(Operation::Fallible); } } |