diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-04-24 02:04:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-24 02:04:07 -0400 |
commit | 25220049d9793ad3d488bc061951a65c3f8a487e (patch) | |
tree | f598798a20f0a4777d1c62130ae2b70f5acd2be5 /components/script/dom/webgl2renderingcontext.rs | |
parent | 412bc1cddd8027596950164f3b396198bdcba25e (diff) | |
parent | 9c343fcc9600a1a2b768a4632793d0856d55ddce (diff) | |
download | servo-25220049d9793ad3d488bc061951a65c3f8a487e.tar.gz servo-25220049d9793ad3d488bc061951a65c3f8a487e.zip |
Auto merge of #26289 - he4d:master, r=jdm
Replaced failible boolean with an enum
<!-- Please describe your changes on the following line: -->
Replaced the boolean `fallible` argument of some WebGL object methods with the new `enum Operation { Fallible, Infallible }` that was added to the `webglrenderingcontext`. This improves the readability of that methods.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #26047 (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because the issue says so
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/webgl2renderingcontext.rs')
-rw-r--r-- | components/script/dom/webgl2renderingcontext.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs index d86879907c9..1828ab6fe7d 100644 --- a/components/script/dom/webgl2renderingcontext.rs +++ b/components/script/dom/webgl2renderingcontext.rs @@ -25,7 +25,7 @@ use crate::dom::webglprogram::WebGLProgram; use crate::dom::webglquery::WebGLQuery; use crate::dom::webglrenderbuffer::WebGLRenderbuffer; use crate::dom::webglrenderingcontext::{ - uniform_get, uniform_typed, LayoutCanvasWebGLRenderingContextHelpers, VertexAttrib, + uniform_get, uniform_typed, LayoutCanvasWebGLRenderingContextHelpers, Operation, VertexAttrib, WebGLRenderingContext, }; use crate::dom::webglsampler::{WebGLSampler, WebGLSamplerValue}; @@ -338,7 +338,7 @@ impl WebGL2RenderingContext { fn unbind_from(&self, slot: &MutNullableDom<WebGLBuffer>, buffer: &WebGLBuffer) { if slot.get().map_or(false, |b| buffer == &*b) { - buffer.decrement_attached_counter(false); + buffer.decrement_attached_counter(Operation::Infallible); slot.set(None); } } @@ -1658,7 +1658,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { self.unbind_from(&binding.buffer, &buffer); } - buffer.mark_for_deletion(false); + buffer.mark_for_deletion(Operation::Infallible); } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6 @@ -3055,7 +3055,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { } } - query.delete(false); + query.delete(Operation::Infallible); } } @@ -3081,7 +3081,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { slot.set(None); } } - sampler.delete(false); + sampler.delete(Operation::Infallible); } } @@ -3312,7 +3312,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { fn DeleteSync(&self, sync: Option<&WebGLSync>) { if let Some(sync) = sync { handle_potential_webgl_error!(self.base, self.base.validate_ownership(sync), return); - sync.delete(false); + sync.delete(Operation::Infallible); } } @@ -3391,7 +3391,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { self.base.webgl_error(InvalidOperation); return; } - tf.delete(false); + tf.delete(Operation::Infallible); self.current_transform_feedback.set(None); } } @@ -3625,7 +3625,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { for slot in &[&generic_slot, &indexed_binding.buffer] { if let Some(old) = slot.get() { - old.decrement_attached_counter(false); + old.decrement_attached_counter(Operation::Infallible); } slot.set(buffer); } @@ -3703,7 +3703,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { for slot in &[&generic_slot, &indexed_binding.buffer] { if let Some(old) = slot.get() { - old.decrement_attached_counter(false); + old.decrement_attached_counter(Operation::Infallible); } slot.set(buffer); } |