refactor: propagate CanGc arguments through callers (#35591)

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
This commit is contained in:
Auguste Baum 2025-02-23 01:34:51 +01:00 committed by GitHub
parent 02199520f2
commit b0b0289014
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 403 additions and 275 deletions

View file

@ -69,13 +69,16 @@ impl WebGLProgram {
}
}
pub(crate) fn maybe_new(context: &WebGLRenderingContext) -> Option<DomRoot<Self>> {
pub(crate) fn maybe_new(
context: &WebGLRenderingContext,
can_gc: CanGc,
) -> Option<DomRoot<Self>> {
let (sender, receiver) = webgl_channel().unwrap();
context.send_command(WebGLCommand::CreateProgram(sender));
receiver
.recv()
.unwrap()
.map(|id| WebGLProgram::new(context, id, CanGc::note()))
.map(|id| WebGLProgram::new(context, id, can_gc))
}
pub(crate) fn new(
@ -320,7 +323,11 @@ impl WebGLProgram {
Ok(())
}
pub(crate) fn get_active_uniform(&self, index: u32) -> WebGLResult<DomRoot<WebGLActiveInfo>> {
pub(crate) fn get_active_uniform(
&self,
index: u32,
can_gc: CanGc,
) -> WebGLResult<DomRoot<WebGLActiveInfo>> {
if self.is_deleted() {
return Err(WebGLError::InvalidValue);
}
@ -333,12 +340,16 @@ impl WebGLProgram {
data.size.unwrap_or(1),
data.type_,
data.name().into(),
CanGc::note(),
can_gc,
))
}
/// glGetActiveAttrib
pub(crate) fn get_active_attrib(&self, index: u32) -> WebGLResult<DomRoot<WebGLActiveInfo>> {
pub(crate) fn get_active_attrib(
&self,
index: u32,
can_gc: CanGc,
) -> WebGLResult<DomRoot<WebGLActiveInfo>> {
if self.is_deleted() {
return Err(WebGLError::InvalidValue);
}
@ -351,7 +362,7 @@ impl WebGLProgram {
data.size,
data.type_,
data.name.clone().into(),
CanGc::note(),
can_gc,
))
}
@ -406,6 +417,7 @@ impl WebGLProgram {
pub(crate) fn get_uniform_location(
&self,
name: DOMString,
can_gc: CanGc,
) -> WebGLResult<Option<DomRoot<WebGLUniformLocation>>> {
if !self.is_linked() || self.is_deleted() {
return Err(WebGLError::InvalidOperation);
@ -458,7 +470,7 @@ impl WebGLProgram {
self.link_generation.get(),
size,
type_,
CanGc::note(),
can_gc,
)))
}