Fmting pass
This commit is contained in:
parent
e54a28a110
commit
2e40bb6ae3
|
@ -1,11 +1,11 @@
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::collections::hash_map::DefaultHasher;
|
use std::collections::hash_map::DefaultHasher;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::collections::HashMap;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
use std::hash::{Hash, Hasher};
|
||||||
|
use std::sync::{Arc, RwLock};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use std::sync::{Arc, RwLock};
|
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use objc::declare::ClassDecl;
|
use objc::declare::ClassDecl;
|
||||||
|
@ -124,11 +124,7 @@ impl ClassMap {
|
||||||
///
|
///
|
||||||
/// There's definitely room to optimize here, but it works for now.
|
/// There's definitely room to optimize here, but it works for now.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn load_or_register_class<F>(
|
pub fn load_or_register_class<F>(superclass_name: &'static str, subclass_name: &'static str, config: F) -> *const Class
|
||||||
superclass_name: &'static str,
|
|
||||||
subclass_name: &'static str,
|
|
||||||
config: F
|
|
||||||
) -> *const Class
|
|
||||||
where
|
where
|
||||||
F: Fn(&mut ClassDecl) + 'static
|
F: Fn(&mut ClassDecl) + 'static
|
||||||
{
|
{
|
||||||
|
@ -145,12 +141,17 @@ where
|
||||||
// guarantees that we almost always have a unique name to register with the ObjC runtime).
|
// guarantees that we almost always have a unique name to register with the ObjC runtime).
|
||||||
//
|
//
|
||||||
// For more context, see: https://github.com/ryanmcgrath/cacao/issues/63
|
// For more context, see: https://github.com/ryanmcgrath/cacao/issues/63
|
||||||
let objc_subclass_name = format!("{}_{}_{}", subclass_name, superclass_name, RNG_SEED.with(|rng| {
|
let objc_subclass_name = format!(
|
||||||
|
"{}_{}_{}",
|
||||||
|
subclass_name,
|
||||||
|
superclass_name,
|
||||||
|
RNG_SEED.with(|rng| {
|
||||||
rng.set(rng.get().wrapping_add(0xa0761d6478bd642f));
|
rng.set(rng.get().wrapping_add(0xa0761d6478bd642f));
|
||||||
let s = rng.get();
|
let s = rng.get();
|
||||||
let t = u128::from(s) * (u128::from(s ^ 0xe7037ed1a0b428db));
|
let t = u128::from(s) * (u128::from(s ^ 0xe7037ed1a0b428db));
|
||||||
((t >> 64) as u64) ^ (t as u64)
|
((t >> 64) as u64) ^ (t as u64)
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
match ClassDecl::new(&objc_subclass_name, unsafe { &*superclass }) {
|
match ClassDecl::new(&objc_subclass_name, unsafe { &*superclass }) {
|
||||||
Some(mut decl) => {
|
Some(mut decl) => {
|
||||||
|
|
|
@ -12,7 +12,7 @@ use objc::declare::ClassDecl;
|
||||||
use objc::runtime::{Class, Object, Sel};
|
use objc::runtime::{Class, Object, Sel};
|
||||||
use objc::{class, msg_send, sel, sel_impl};
|
use objc::{class, msg_send, sel, sel_impl};
|
||||||
|
|
||||||
use crate::foundation::{id, nil, NSArray, NSInteger, NSString, NO, YES, load_or_register_class};
|
use crate::foundation::{id, load_or_register_class, nil, NSArray, NSInteger, NSString, NO, YES};
|
||||||
use crate::webview::actions::{NavigationAction, NavigationResponse};
|
use crate::webview::actions::{NavigationAction, NavigationResponse};
|
||||||
use crate::webview::{mimetype::MimeType, WebViewDelegate, WEBVIEW_DELEGATE_PTR}; //, OpenPanelParameters};
|
use crate::webview::{mimetype::MimeType, WebViewDelegate, WEBVIEW_DELEGATE_PTR}; //, OpenPanelParameters};
|
||||||
//use crate::webview::enums::{NavigationPolicy, NavigationResponsePolicy};
|
//use crate::webview::enums::{NavigationPolicy, NavigationResponsePolicy};
|
||||||
|
|
Loading…
Reference in a new issue