mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
Moves to FxHashMap for Allocator, BHM, Canvas, Media, Servo, WebGL and WebGPU (#39202)
This moves more of HashMap/FnvHashMap to FxHashmap. Again we only changed instances that do not look security related and have small keys. Additionally, allocator used the fnv feature which did not seem to be used. Testing: Unit Tests and WPT should cover this and functionality change is highly unlikely. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
228b240635
commit
d2c78db981
19 changed files with 53 additions and 46 deletions
|
@ -19,11 +19,11 @@ webxr = ["dep:webxr", "dep:webxr-api"]
|
|||
base = { workspace = true }
|
||||
bitflags = { workspace = true }
|
||||
byteorder = { workspace = true }
|
||||
rustc-hash = { workspace = true }
|
||||
canvas_traits = { workspace = true }
|
||||
compositing_traits = { workspace = true }
|
||||
crossbeam-channel = { workspace = true }
|
||||
euclid = { workspace = true }
|
||||
fnv = { workspace = true }
|
||||
glow = { workspace = true }
|
||||
half = "2"
|
||||
ipc-channel = { workspace = true }
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::default::Default;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
|
@ -13,8 +12,8 @@ use compositing_traits::{
|
|||
WebrenderExternalImageRegistry,
|
||||
};
|
||||
use euclid::default::Size2D;
|
||||
use fnv::FnvHashMap;
|
||||
use log::debug;
|
||||
use rustc_hash::FxHashMap;
|
||||
use surfman::chains::{SwapChainAPI, SwapChains, SwapChainsAPI};
|
||||
use surfman::{Device, SurfaceTexture};
|
||||
use webrender::RenderApiSender;
|
||||
|
@ -87,7 +86,7 @@ impl WebGLComm {
|
|||
struct WebGLExternalImages {
|
||||
rendering_context: Rc<dyn RenderingContext>,
|
||||
swap_chains: SwapChains<WebGLContextId, Device>,
|
||||
locked_front_buffers: FnvHashMap<WebGLContextId, SurfaceTexture>,
|
||||
locked_front_buffers: FxHashMap<WebGLContextId, SurfaceTexture>,
|
||||
}
|
||||
|
||||
impl WebGLExternalImages {
|
||||
|
@ -98,7 +97,7 @@ impl WebGLExternalImages {
|
|||
Self {
|
||||
rendering_context,
|
||||
swap_chains,
|
||||
locked_front_buffers: FnvHashMap::default(),
|
||||
locked_front_buffers: FxHashMap::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ use compositing_traits::{
|
|||
WebrenderImageHandlerType,
|
||||
};
|
||||
use euclid::default::Size2D;
|
||||
use fnv::FnvHashMap;
|
||||
use glow::{
|
||||
self as gl, ActiveTransformFeedback, Context as Gl, HasContext, NativeTransformFeedback,
|
||||
NativeUniformLocation, NativeVertexArray, PixelUnpackData, ShaderPrecisionFormat,
|
||||
|
@ -40,6 +39,7 @@ use ipc_channel::ipc::IpcSharedMemory;
|
|||
use itertools::Itertools;
|
||||
use log::{debug, error, trace, warn};
|
||||
use pixels::{self, PixelFormat, SnapshotAlphaMode, unmultiply_inplace};
|
||||
use rustc_hash::FxHashMap;
|
||||
use surfman::chains::{PreserveBuffer, SwapChains, SwapChainsAPI};
|
||||
use surfman::{
|
||||
self, Adapter, Connection, Context, ContextAttributeFlags, ContextAttributes, Device,
|
||||
|
@ -210,9 +210,9 @@ pub(crate) struct WebGLThread {
|
|||
compositor_api: CrossProcessCompositorApi,
|
||||
webrender_api: RenderApi,
|
||||
/// Map of live WebGLContexts.
|
||||
contexts: FnvHashMap<WebGLContextId, GLContextData>,
|
||||
contexts: FxHashMap<WebGLContextId, GLContextData>,
|
||||
/// Cached information for WebGLContexts.
|
||||
cached_context_info: FnvHashMap<WebGLContextId, WebGLContextInfo>,
|
||||
cached_context_info: FxHashMap<WebGLContextId, WebGLContextInfo>,
|
||||
/// Current bound context.
|
||||
bound_context_id: Option<WebGLContextId>,
|
||||
/// List of registered webrender external images.
|
||||
|
@ -863,7 +863,7 @@ impl WebGLThread {
|
|||
pub(crate) fn make_current_if_needed<'a>(
|
||||
device: &Device,
|
||||
context_id: WebGLContextId,
|
||||
contexts: &'a FnvHashMap<WebGLContextId, GLContextData>,
|
||||
contexts: &'a FxHashMap<WebGLContextId, GLContextData>,
|
||||
bound_id: &mut Option<WebGLContextId>,
|
||||
) -> Option<&'a GLContextData> {
|
||||
let data = contexts.get(&context_id);
|
||||
|
@ -882,7 +882,7 @@ impl WebGLThread {
|
|||
pub(crate) fn make_current_if_needed_mut<'a>(
|
||||
device: &Device,
|
||||
context_id: WebGLContextId,
|
||||
contexts: &'a mut FnvHashMap<WebGLContextId, GLContextData>,
|
||||
contexts: &'a mut FxHashMap<WebGLContextId, GLContextData>,
|
||||
bound_id: &mut Option<WebGLContextId>,
|
||||
) -> Option<&'a mut GLContextData> {
|
||||
let data = contexts.get_mut(&context_id);
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::num::NonZeroU32;
|
|||
use canvas_traits::webgl::{
|
||||
WebGLContextId, WebGLMsg, WebGLSender, WebXRCommand, WebXRLayerManagerId, webgl_channel,
|
||||
};
|
||||
use fnv::FnvHashMap;
|
||||
use rustc_hash::FxHashMap;
|
||||
use surfman::{Context, Device};
|
||||
use webxr::SurfmanGL as WebXRSurfman;
|
||||
use webxr_api::{
|
||||
|
@ -310,7 +310,7 @@ impl Drop for WebXRBridgeManager {
|
|||
}
|
||||
|
||||
pub(crate) struct WebXRBridgeContexts<'a> {
|
||||
pub(crate) contexts: &'a mut FnvHashMap<WebGLContextId, GLContextData>,
|
||||
pub(crate) contexts: &'a mut FxHashMap<WebGLContextId, GLContextData>,
|
||||
pub(crate) bound_context_id: &'a mut Option<WebGLContextId>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue