script: Limit public exports. (#34915)

* script: Restrict reexport visibility of DOM types.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Mass pub->pub(crate) conversion.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Hide existing dead code warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix unit tests.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* More formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-01-10 03:19:19 -05:00 committed by GitHub
parent f220d6d3a5
commit c94d909a86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
585 changed files with 5411 additions and 5013 deletions

View file

@ -117,7 +117,7 @@ fn has_invalid_blend_constants(arg1: u32, arg2: u32) -> bool {
}
}
pub fn uniform_get<T, F>(triple: (&WebGLRenderingContext, WebGLProgramId, i32), f: F) -> T
pub(crate) fn uniform_get<T, F>(triple: (&WebGLRenderingContext, WebGLProgramId, i32), f: F) -> T
where
F: FnOnce(WebGLProgramId, i32, WebGLSender<T>) -> WebGLCommand,
T: for<'de> Deserialize<'de> + Serialize,
@ -128,7 +128,7 @@ where
}
#[allow(unsafe_code)]
pub unsafe fn uniform_typed<T>(
pub(crate) unsafe fn uniform_typed<T>(
cx: *mut JSContext,
value: &[T::Element],
mut retval: MutableHandleValue,
@ -154,20 +154,20 @@ bitflags! {
}
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf)]
pub enum VertexAttrib {
pub(crate) enum VertexAttrib {
Float(f32, f32, f32, f32),
Int(i32, i32, i32, i32),
Uint(u32, u32, u32, u32),
}
#[derive(Clone, Copy, Debug)]
pub enum Operation {
pub(crate) enum Operation {
Fallible,
Infallible,
}
#[dom_struct]
pub struct WebGLRenderingContext {
pub(crate) struct WebGLRenderingContext {
reflector_: Reflector,
#[ignore_malloc_size_of = "Channels are hard"]
webgl_sender: WebGLMessageSender,
@ -215,7 +215,7 @@ pub struct WebGLRenderingContext {
}
impl WebGLRenderingContext {
pub fn new_inherited(
pub(crate) fn new_inherited(
window: &Window,
canvas: &HTMLCanvasElementOrOffscreenCanvas,
webgl_version: WebGLVersion,
@ -282,7 +282,7 @@ impl WebGLRenderingContext {
}
#[allow(crown::unrooted_must_root)]
pub fn new(
pub(crate) fn new(
window: &Window,
canvas: &HTMLCanvasElementOrOffscreenCanvas,
webgl_version: WebGLVersion,
@ -315,19 +315,19 @@ impl WebGLRenderingContext {
}
}
pub fn webgl_version(&self) -> WebGLVersion {
pub(crate) fn webgl_version(&self) -> WebGLVersion {
self.webgl_version
}
pub fn limits(&self) -> &GLLimits {
pub(crate) fn limits(&self) -> &GLLimits {
&self.limits
}
pub fn texture_unpacking_alignment(&self) -> u32 {
pub(crate) fn texture_unpacking_alignment(&self) -> u32 {
self.texture_unpacking_alignment.get()
}
pub fn current_vao(&self) -> DomRoot<WebGLVertexArrayObjectOES> {
pub(crate) fn current_vao(&self) -> DomRoot<WebGLVertexArrayObjectOES> {
self.current_vao.or_init(|| {
DomRoot::from_ref(
self.default_vao
@ -336,7 +336,7 @@ impl WebGLRenderingContext {
})
}
pub fn current_vao_webgl2(&self) -> DomRoot<WebGLVertexArrayObject> {
pub(crate) fn current_vao_webgl2(&self) -> DomRoot<WebGLVertexArrayObject> {
self.current_vao_webgl2.or_init(|| {
DomRoot::from_ref(
self.default_vao_webgl2
@ -345,11 +345,11 @@ impl WebGLRenderingContext {
})
}
pub fn current_vertex_attribs(&self) -> RefMut<Box<[VertexAttrib]>> {
pub(crate) fn current_vertex_attribs(&self) -> RefMut<Box<[VertexAttrib]>> {
self.current_vertex_attribs.borrow_mut()
}
pub fn recreate(&self, size: Size2D<u32>) {
pub(crate) fn recreate(&self, size: Size2D<u32>) {
let (sender, receiver) = webgl_channel().unwrap();
self.webgl_sender.send_resize(size, sender).unwrap();
// FIXME(#21718) The backend is allowed to choose a size smaller than
@ -398,11 +398,11 @@ impl WebGLRenderingContext {
}
}
pub fn context_id(&self) -> WebGLContextId {
pub(crate) fn context_id(&self) -> WebGLContextId {
self.webgl_sender.context_id()
}
pub fn onscreen(&self) -> bool {
pub(crate) fn onscreen(&self) -> bool {
match self.canvas {
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(ref canvas) => {
canvas.upcast::<Node>().is_connected()
@ -412,19 +412,19 @@ impl WebGLRenderingContext {
}
#[inline]
pub fn send_command(&self, command: WebGLCommand) {
pub(crate) fn send_command(&self, command: WebGLCommand) {
self.webgl_sender
.send(command, capture_webgl_backtrace(self))
.unwrap();
}
pub fn send_command_ignored(&self, command: WebGLCommand) {
pub(crate) fn send_command_ignored(&self, command: WebGLCommand) {
let _ = self
.webgl_sender
.send(command, capture_webgl_backtrace(self));
}
pub fn webgl_error(&self, err: WebGLError) {
pub(crate) fn webgl_error(&self, err: WebGLError) {
// TODO(emilio): Add useful debug messages to this
warn!(
"WebGL error: {:?}, previous error was {:?}",
@ -457,7 +457,7 @@ impl WebGLRenderingContext {
//
// The WebGL spec mentions a couple more operations that trigger
// this: clear() and getParameter(IMPLEMENTATION_COLOR_READ_*).
pub fn validate_framebuffer(&self) -> WebGLResult<()> {
pub(crate) fn validate_framebuffer(&self) -> WebGLResult<()> {
match self.bound_draw_framebuffer.get() {
Some(fb) => match fb.check_status_for_rendering() {
CompleteForRendering::Complete => Ok(()),
@ -468,7 +468,7 @@ impl WebGLRenderingContext {
}
}
pub fn validate_ownership<T>(&self, object: &T) -> WebGLResult<()>
pub(crate) fn validate_ownership<T>(&self, object: &T) -> WebGLResult<()>
where
T: DerivedFrom<WebGLObject>,
{
@ -478,7 +478,7 @@ impl WebGLRenderingContext {
Ok(())
}
pub fn with_location<F>(&self, location: Option<&WebGLUniformLocation>, f: F)
pub(crate) fn with_location<F>(&self, location: Option<&WebGLUniformLocation>, f: F)
where
F: FnOnce(&WebGLUniformLocation) -> WebGLResult<()>,
{
@ -495,7 +495,7 @@ impl WebGLRenderingContext {
handle_potential_webgl_error!(self, f(location));
}
pub fn textures(&self) -> &Textures {
pub(crate) fn textures(&self) -> &Textures {
&self.textures
}
@ -536,7 +536,7 @@ impl WebGLRenderingContext {
}
}
pub fn mark_as_dirty(&self) {
pub(crate) fn mark_as_dirty(&self) {
// If we have a bound framebuffer, then don't mark the canvas as dirty.
if self.bound_draw_framebuffer.get().is_some() {
return;
@ -575,7 +575,7 @@ impl WebGLRenderingContext {
self.send_command(WebGLCommand::VertexAttrib(indx, x, y, z, w));
}
pub fn get_current_framebuffer_size(&self) -> Option<(i32, i32)> {
pub(crate) fn get_current_framebuffer_size(&self) -> Option<(i32, i32)> {
match self.bound_draw_framebuffer.get() {
Some(fb) => fb.size(),
@ -584,7 +584,7 @@ impl WebGLRenderingContext {
}
}
pub fn get_texture_packing_alignment(&self) -> u8 {
pub(crate) fn get_texture_packing_alignment(&self) -> u8 {
self.texture_packing_alignment.get()
}
@ -653,7 +653,7 @@ impl WebGLRenderingContext {
)
}
pub fn get_image_pixels(&self, source: TexImageSource) -> Fallible<Option<TexPixels>> {
pub(crate) fn get_image_pixels(&self, source: TexImageSource) -> Fallible<Option<TexPixels>> {
Ok(Some(match source {
TexImageSource::ImageData(image_data) => TexPixels::new(
image_data.to_shared_memory(),
@ -730,7 +730,7 @@ impl WebGLRenderingContext {
}
// TODO(emilio): Move this logic to a validator.
pub fn validate_tex_image_2d_data(
pub(crate) fn validate_tex_image_2d_data(
&self,
width: u32,
height: u32,
@ -776,7 +776,7 @@ impl WebGLRenderingContext {
}
#[allow(clippy::too_many_arguments)]
pub fn tex_image_2d(
pub(crate) fn tex_image_2d(
&self,
texture: &WebGLTexture,
target: TexImageTarget,
@ -956,7 +956,7 @@ impl WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/
pub fn draw_arrays_instanced(
pub(crate) fn draw_arrays_instanced(
&self,
mode: u32,
first: i32,
@ -1024,7 +1024,7 @@ impl WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/
pub fn draw_elements_instanced(
pub(crate) fn draw_elements_instanced(
&self,
mode: u32,
count: i32,
@ -1117,7 +1117,7 @@ impl WebGLRenderingContext {
Ok(())
}
pub fn vertex_attrib_divisor(&self, index: u32, divisor: u32) {
pub(crate) fn vertex_attrib_divisor(&self, index: u32, divisor: u32) {
if index >= self.limits.max_vertex_attribs {
return self.webgl_error(InvalidValue);
}
@ -1137,7 +1137,7 @@ impl WebGLRenderingContext {
// can fail and that it is UB what happens in that case.
//
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#2.2
pub fn get_image_data(&self, mut size: Size2D<u32>) -> Option<Vec<u8>> {
pub(crate) fn get_image_data(&self, mut size: Size2D<u32>) -> Option<Vec<u8>> {
handle_potential_webgl_error!(self, self.validate_framebuffer(), return None);
let (fb_width, fb_height) = handle_potential_webgl_error!(
@ -1158,15 +1158,15 @@ impl WebGLRenderingContext {
Some(receiver.recv().unwrap())
}
pub fn array_buffer(&self) -> Option<DomRoot<WebGLBuffer>> {
pub(crate) fn array_buffer(&self) -> Option<DomRoot<WebGLBuffer>> {
self.bound_buffer_array.get()
}
pub fn array_buffer_slot(&self) -> &MutNullableDom<WebGLBuffer> {
pub(crate) fn array_buffer_slot(&self) -> &MutNullableDom<WebGLBuffer> {
&self.bound_buffer_array
}
pub fn bound_buffer(&self, target: u32) -> WebGLResult<Option<DomRoot<WebGLBuffer>>> {
pub(crate) fn bound_buffer(&self, target: u32) -> WebGLResult<Option<DomRoot<WebGLBuffer>>> {
match target {
constants::ARRAY_BUFFER => Ok(self.bound_buffer_array.get()),
constants::ELEMENT_ARRAY_BUFFER => Ok(self.current_vao().element_array_buffer().get()),
@ -1174,14 +1174,14 @@ impl WebGLRenderingContext {
}
}
pub fn buffer_usage(&self, usage: u32) -> WebGLResult<u32> {
pub(crate) fn buffer_usage(&self, usage: u32) -> WebGLResult<u32> {
match usage {
constants::STREAM_DRAW | constants::STATIC_DRAW | constants::DYNAMIC_DRAW => Ok(usage),
_ => Err(WebGLError::InvalidEnum),
}
}
pub fn create_vertex_array(&self) -> Option<DomRoot<WebGLVertexArrayObjectOES>> {
pub(crate) fn create_vertex_array(&self) -> Option<DomRoot<WebGLVertexArrayObjectOES>> {
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::CreateVertexArray(sender));
receiver
@ -1190,7 +1190,7 @@ impl WebGLRenderingContext {
.map(|id| WebGLVertexArrayObjectOES::new(self, Some(id)))
}
pub fn create_vertex_array_webgl2(&self) -> Option<DomRoot<WebGLVertexArrayObject>> {
pub(crate) fn create_vertex_array_webgl2(&self) -> Option<DomRoot<WebGLVertexArrayObject>> {
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::CreateVertexArray(sender));
receiver
@ -1199,7 +1199,7 @@ impl WebGLRenderingContext {
.map(|id| WebGLVertexArrayObject::new(self, Some(id)))
}
pub fn delete_vertex_array(&self, vao: Option<&WebGLVertexArrayObjectOES>) {
pub(crate) fn delete_vertex_array(&self, vao: Option<&WebGLVertexArrayObjectOES>) {
if let Some(vao) = vao {
handle_potential_webgl_error!(self, self.validate_ownership(vao), return);
// The default vertex array has no id and should never be passed around.
@ -1217,7 +1217,7 @@ impl WebGLRenderingContext {
}
}
pub fn delete_vertex_array_webgl2(&self, vao: Option<&WebGLVertexArrayObject>) {
pub(crate) fn delete_vertex_array_webgl2(&self, vao: Option<&WebGLVertexArrayObject>) {
if let Some(vao) = vao {
handle_potential_webgl_error!(self, self.validate_ownership(vao), return);
// The default vertex array has no id and should never be passed around.
@ -1235,7 +1235,7 @@ impl WebGLRenderingContext {
}
}
pub fn is_vertex_array(&self, vao: Option<&WebGLVertexArrayObjectOES>) -> bool {
pub(crate) fn is_vertex_array(&self, vao: Option<&WebGLVertexArrayObjectOES>) -> bool {
vao.is_some_and(|vao| {
// The default vertex array has no id and should never be passed around.
assert!(vao.id().is_some());
@ -1243,7 +1243,7 @@ impl WebGLRenderingContext {
})
}
pub fn is_vertex_array_webgl2(&self, vao: Option<&WebGLVertexArrayObject>) -> bool {
pub(crate) fn is_vertex_array_webgl2(&self, vao: Option<&WebGLVertexArrayObject>) -> bool {
vao.is_some_and(|vao| {
// The default vertex array has no id and should never be passed around.
assert!(vao.id().is_some());
@ -1251,7 +1251,7 @@ impl WebGLRenderingContext {
})
}
pub fn bind_vertex_array(&self, vao: Option<&WebGLVertexArrayObjectOES>) {
pub(crate) fn bind_vertex_array(&self, vao: Option<&WebGLVertexArrayObjectOES>) {
if let Some(vao) = vao {
// The default vertex array has no id and should never be passed around.
assert!(vao.id().is_some());
@ -1267,7 +1267,7 @@ impl WebGLRenderingContext {
self.current_vao.set(vao);
}
pub fn bind_vertex_array_webgl2(&self, vao: Option<&WebGLVertexArrayObject>) {
pub(crate) fn bind_vertex_array_webgl2(&self, vao: Option<&WebGLVertexArrayObject>) {
if let Some(vao) = vao {
// The default vertex array has no id and should never be passed around.
assert!(vao.id().is_some());
@ -1297,7 +1297,7 @@ impl WebGLRenderingContext {
}
}
pub fn initialize_framebuffer(&self, clear_bits: u32) {
pub(crate) fn initialize_framebuffer(&self, clear_bits: u32) {
if clear_bits == 0 {
return;
}
@ -1308,12 +1308,12 @@ impl WebGLRenderingContext {
});
}
pub fn extension_manager(&self) -> &WebGLExtensions {
pub(crate) fn extension_manager(&self) -> &WebGLExtensions {
&self.extension_manager
}
#[allow(unsafe_code)]
pub fn buffer_data(
pub(crate) fn buffer_data(
&self,
target: u32,
data: Option<ArrayBufferViewOrArrayBuffer>,
@ -1334,7 +1334,7 @@ impl WebGLRenderingContext {
handle_potential_webgl_error!(self, bound_buffer.buffer_data(target, data, usage));
}
pub fn buffer_data_(
pub(crate) fn buffer_data_(
&self,
target: u32,
size: i64,
@ -1355,7 +1355,7 @@ impl WebGLRenderingContext {
}
#[allow(unsafe_code)]
pub fn buffer_sub_data(
pub(crate) fn buffer_sub_data(
&self,
target: u32,
offset: i64,
@ -1388,7 +1388,7 @@ impl WebGLRenderingContext {
sender.send(data).unwrap();
}
pub fn bind_buffer_maybe(
pub(crate) fn bind_buffer_maybe(
&self,
slot: &MutNullableDom<WebGLBuffer>,
target: u32,
@ -1412,11 +1412,11 @@ impl WebGLRenderingContext {
slot.set(buffer);
}
pub fn current_program(&self) -> Option<DomRoot<WebGLProgram>> {
pub(crate) fn current_program(&self) -> Option<DomRoot<WebGLProgram>> {
self.current_program.get()
}
pub fn uniform_check_program(
pub(crate) fn uniform_check_program(
&self,
program: &WebGLProgram,
location: &WebGLUniformLocation,
@ -1465,7 +1465,7 @@ impl WebGLRenderingContext {
self.uniform_vec_section::<f32>(vec, offset, length, uniform_size, uniform_location)
}
pub fn uniform_vec_section<T: Clone>(
pub(crate) fn uniform_vec_section<T: Clone>(
&self,
vec: Vec<T>,
offset: u32,
@ -1503,7 +1503,7 @@ impl WebGLRenderingContext {
Ok(vec)
}
pub fn uniform_matrix_section(
pub(crate) fn uniform_matrix_section(
&self,
vec: Float32ArrayOrUnrestrictedFloatSequence,
offset: u32,
@ -1522,15 +1522,15 @@ impl WebGLRenderingContext {
self.uniform_vec_section::<f32>(vec, offset, length, uniform_size, uniform_location)
}
pub fn get_draw_framebuffer_slot(&self) -> &MutNullableDom<WebGLFramebuffer> {
pub(crate) fn get_draw_framebuffer_slot(&self) -> &MutNullableDom<WebGLFramebuffer> {
&self.bound_draw_framebuffer
}
pub fn get_read_framebuffer_slot(&self) -> &MutNullableDom<WebGLFramebuffer> {
pub(crate) fn get_read_framebuffer_slot(&self) -> &MutNullableDom<WebGLFramebuffer> {
&self.bound_read_framebuffer
}
pub fn validate_new_framebuffer_binding(
pub(crate) fn validate_new_framebuffer_binding(
&self,
framebuffer: Option<&WebGLFramebuffer>,
) -> WebGLResult<()> {
@ -1548,7 +1548,7 @@ impl WebGLRenderingContext {
Ok(())
}
pub fn bind_framebuffer_to(
pub(crate) fn bind_framebuffer_to(
&self,
target: u32,
framebuffer: Option<&WebGLFramebuffer>,
@ -1566,7 +1566,7 @@ impl WebGLRenderingContext {
slot.set(framebuffer);
}
pub fn renderbuffer_storage(
pub(crate) fn renderbuffer_storage(
&self,
target: u32,
samples: i32,
@ -1600,13 +1600,13 @@ impl WebGLRenderingContext {
// FIXME: https://github.com/servo/servo/issues/13710
}
pub fn valid_color_attachment_enum(&self, attachment: u32) -> bool {
pub(crate) fn valid_color_attachment_enum(&self, attachment: u32) -> bool {
let last_slot = constants::COLOR_ATTACHMENT0 + self.limits().max_color_attachments - 1;
constants::COLOR_ATTACHMENT0 <= attachment && attachment <= last_slot
}
#[allow(clippy::too_many_arguments)]
pub fn compressed_tex_image_2d(
pub(crate) fn compressed_tex_image_2d(
&self,
target: u32,
level: i32,
@ -1674,7 +1674,7 @@ impl WebGLRenderingContext {
}
#[allow(clippy::too_many_arguments)]
pub fn compressed_tex_sub_image_2d(
pub(crate) fn compressed_tex_sub_image_2d(
&self,
target: u32,
level: i32,
@ -1723,7 +1723,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform1iv(
pub(crate) fn uniform1iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
@ -1759,7 +1759,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform1fv(
pub(crate) fn uniform1fv(
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
@ -1777,7 +1777,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform2fv(
pub(crate) fn uniform2fv(
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
@ -1795,7 +1795,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform2iv(
pub(crate) fn uniform2iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
@ -1813,7 +1813,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform3fv(
pub(crate) fn uniform3fv(
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
@ -1831,7 +1831,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform3iv(
pub(crate) fn uniform3iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
@ -1849,7 +1849,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform4iv(
pub(crate) fn uniform4iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
@ -1867,7 +1867,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform4fv(
pub(crate) fn uniform4fv(
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
@ -1885,7 +1885,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform_matrix_2fv(
pub(crate) fn uniform_matrix_2fv(
&self,
location: Option<&WebGLUniformLocation>,
transpose: bool,
@ -1905,7 +1905,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform_matrix_3fv(
pub(crate) fn uniform_matrix_3fv(
&self,
location: Option<&WebGLUniformLocation>,
transpose: bool,
@ -1925,7 +1925,7 @@ impl WebGLRenderingContext {
});
}
pub fn uniform_matrix_4fv(
pub(crate) fn uniform_matrix_4fv(
&self,
location: Option<&WebGLUniformLocation>,
transpose: bool,
@ -1945,7 +1945,7 @@ impl WebGLRenderingContext {
});
}
pub fn get_buffer_param(
pub(crate) fn get_buffer_param(
&self,
buffer: Option<DomRoot<WebGLBuffer>>,
parameter: u32,
@ -1970,13 +1970,13 @@ impl WebGLRenderingContext {
#[cfg(not(feature = "webgl_backtrace"))]
#[inline]
pub fn capture_webgl_backtrace<T: DomObject>(_: &T) -> WebGLCommandBacktrace {
pub(crate) fn capture_webgl_backtrace<T: DomObject>(_: &T) -> WebGLCommandBacktrace {
WebGLCommandBacktrace {}
}
#[cfg(feature = "webgl_backtrace")]
#[cfg_attr(feature = "webgl_backtrace", allow(unsafe_code))]
pub fn capture_webgl_backtrace<T: DomObject>(obj: &T) -> WebGLCommandBacktrace {
pub(crate) fn capture_webgl_backtrace<T: DomObject>(obj: &T) -> WebGLCommandBacktrace {
let bt = Backtrace::new();
unsafe {
capture_stack!(in(*obj.global().get_cx()) let stack);
@ -4847,7 +4847,7 @@ macro_rules! capabilities {
};
($prev:ident, [$($name:ident = $value:expr;)*]) => {
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
pub struct CapFlags(u16);
pub(crate) struct CapFlags(u16);
bitflags! {
impl CapFlags: u16 {
@ -4880,7 +4880,7 @@ capabilities! {
#[crown::unrooted_must_root_lint::must_root]
#[derive(JSTraceable, MallocSizeOf)]
pub struct Textures {
pub(crate) struct Textures {
active_unit: Cell<u32>,
units: Box<[TextureUnit]>,
}
@ -4896,7 +4896,7 @@ impl Textures {
}
}
pub fn active_unit_enum(&self) -> u32 {
pub(crate) fn active_unit_enum(&self) -> u32 {
self.active_unit.get() + constants::TEXTURE0
}
@ -4909,7 +4909,7 @@ impl Textures {
Ok(())
}
pub fn active_texture_slot(
pub(crate) fn active_texture_slot(
&self,
target: u32,
webgl_version: WebGLVersion,
@ -4927,7 +4927,7 @@ impl Textures {
}
}
pub fn active_texture_for_image_target(
pub(crate) fn active_texture_for_image_target(
&self,
target: TexImageTarget,
) -> Option<DomRoot<WebGLTexture>> {
@ -4988,7 +4988,7 @@ impl TextureUnit {
}
}
pub struct TexPixels {
pub(crate) struct TexPixels {
data: IpcSharedMemory,
size: Size2D<u32>,
pixel_format: Option<PixelFormat>,
@ -5010,7 +5010,7 @@ impl TexPixels {
}
}
pub fn from_array(data: IpcSharedMemory, size: Size2D<u32>) -> Self {
pub(crate) fn from_array(data: IpcSharedMemory, size: Size2D<u32>) -> Self {
Self {
data,
size,
@ -5019,28 +5019,28 @@ impl TexPixels {
}
}
pub fn size(&self) -> Size2D<u32> {
pub(crate) fn size(&self) -> Size2D<u32> {
self.size
}
}
pub enum TexSource {
pub(crate) enum TexSource {
Pixels(TexPixels),
BufferOffset(i64),
}
#[derive(JSTraceable)]
pub struct WebGLCommandSender {
pub(crate) struct WebGLCommandSender {
#[no_trace]
sender: WebGLChan,
}
impl WebGLCommandSender {
pub fn new(sender: WebGLChan) -> WebGLCommandSender {
pub(crate) fn new(sender: WebGLChan) -> WebGLCommandSender {
WebGLCommandSender { sender }
}
pub fn send(&self, msg: WebGLMsg) -> WebGLSendResult {
pub(crate) fn send(&self, msg: WebGLMsg) -> WebGLSendResult {
self.sender.send(msg)
}
}
@ -5060,19 +5060,23 @@ impl Clone for WebGLMessageSender {
}
impl WebGLMessageSender {
pub fn new(sender: WebGLMsgSender) -> WebGLMessageSender {
pub(crate) fn new(sender: WebGLMsgSender) -> WebGLMessageSender {
WebGLMessageSender { sender }
}
pub fn context_id(&self) -> WebGLContextId {
pub(crate) fn context_id(&self) -> WebGLContextId {
self.sender.context_id()
}
pub fn send(&self, msg: WebGLCommand, backtrace: WebGLCommandBacktrace) -> WebGLSendResult {
pub(crate) fn send(
&self,
msg: WebGLCommand,
backtrace: WebGLCommandBacktrace,
) -> WebGLSendResult {
self.sender.send(msg, backtrace)
}
pub fn send_resize(
pub(crate) fn send_resize(
&self,
size: Size2D<u32>,
sender: WebGLSender<Result<(), String>>,
@ -5080,7 +5084,7 @@ impl WebGLMessageSender {
self.sender.send_resize(size, sender)
}
pub fn send_remove(&self) -> WebGLSendResult {
pub(crate) fn send_remove(&self) -> WebGLSendResult {
self.sender.send_remove()
}
}