Updated proc-macro-hack and simplified app_profiler names for window methods.
This commit is contained in:
parent
8c9d2b462c
commit
521546589a
|
@ -1,3 +1,3 @@
|
|||
/target
|
||||
**/*.rs.bk
|
||||
profile.json
|
||||
app_profile.json
|
|
@ -927,17 +927,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.11"
|
||||
version = "0.5.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-nested"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -1548,8 +1543,8 @@ dependencies = [
|
|||
"glutin 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.5.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-nested 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1563,7 +1558,7 @@ name = "zero-ui-macros"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.5.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1681,8 +1676,8 @@ dependencies = [
|
|||
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
||||
"checksum plane-split 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe16a646a08f4b4dd74035b9ff8e378eb1a4012a74f14f5889e7001cdbece33"
|
||||
"checksum proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e"
|
||||
"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
|
||||
"checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e"
|
||||
"checksum proc-macro-hack 0.5.14 (registry+https://github.com/rust-lang/crates.io-index)" = "fcfdefadc3d57ca21cf17990a28ef4c0f7c61383a28cb7604cf4a18e6ede1420"
|
||||
"checksum proc-macro-nested 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
|
||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
|
||||
"checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0"
|
||||
|
|
|
@ -12,8 +12,8 @@ app_profiler = ["serde_json", "lazy_static"]
|
|||
zero-ui-macros = { path = "zero-ui-macros" }
|
||||
|
||||
# proc-macro-hack
|
||||
proc-macro-hack = "0.5.11"
|
||||
proc-macro-nested = "0.1.3"
|
||||
proc-macro-hack = "0.5.14"
|
||||
proc-macro-nested = "0.1.4"
|
||||
|
||||
# core
|
||||
raw-window-handle = "0.3.3"
|
||||
|
|
|
@ -246,6 +246,9 @@ impl<E: AppExtension> AppExtended<E> {
|
|||
/// Runs the application event loop calling `start` once at the beginning.
|
||||
#[inline]
|
||||
pub fn run(self, start: impl FnOnce(&mut AppContext)) -> ! {
|
||||
#[cfg(feature = "app_profiler")]
|
||||
crate::core::profiler::register_thread_with_profiler();
|
||||
|
||||
profile_scope!("app::run");
|
||||
|
||||
let event_loop = EventLoop::with_user_event();
|
||||
|
@ -299,6 +302,11 @@ impl<E: AppExtension> AppExtended<E> {
|
|||
extensions.on_redraw_requested(window_id, &mut owned_ctx.borrow(event_loop))
|
||||
}
|
||||
|
||||
#[cfg(feature = "app_profiler")]
|
||||
GEvent::LoopDestroyed => {
|
||||
crate::core::profiler::write_profile("app_profile.json");
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
|
|
@ -645,15 +645,6 @@ struct GlWindow {
|
|||
doc_view_changed: bool,
|
||||
}
|
||||
|
||||
macro_rules! win_profile_scope {
|
||||
($ctx: expr, $mtd_name: tt) => {
|
||||
win_profile_scope!($ctx.id(), $ctx.root.title.get_local(), $mtd_name)
|
||||
};
|
||||
($id: expr, $title: expr, $mtd_name: tt) => {
|
||||
profile_scope!(r#"({:?} "{}")::{}"#, $id, $title, $mtd_name)
|
||||
};
|
||||
}
|
||||
|
||||
impl GlWindow {
|
||||
pub fn new(
|
||||
new_window: Box<dyn FnOnce(&AppContext) -> Window>,
|
||||
|
@ -759,12 +750,10 @@ impl GlWindow {
|
|||
|
||||
/// Update window vars.
|
||||
pub fn update(&mut self, vars: &Vars) {
|
||||
let ctx = self.ctx.as_mut().unwrap();
|
||||
|
||||
win_profile_scope!(ctx, "update::self");
|
||||
profile_scope!("window::update::self");
|
||||
|
||||
let window = self.gl_ctx.as_ref().unwrap().window();
|
||||
let r = &mut ctx.root;
|
||||
let r = &mut self.ctx.as_mut().unwrap().root;
|
||||
|
||||
if let Some(title) = r.title.update_local(vars) {
|
||||
window.set_title(title);
|
||||
|
@ -802,7 +791,7 @@ impl GlWindow {
|
|||
let ctx = self.ctx.as_mut().unwrap();
|
||||
|
||||
if ctx.update == UpdateDisplayRequest::Layout {
|
||||
win_profile_scope!(ctx, "layout");
|
||||
profile_scope!("window::layout");
|
||||
|
||||
ctx.update = UpdateDisplayRequest::Render;
|
||||
|
||||
|
@ -821,7 +810,7 @@ impl GlWindow {
|
|||
let ctx = self.ctx.as_mut().unwrap();
|
||||
|
||||
if ctx.update == UpdateDisplayRequest::Render {
|
||||
win_profile_scope!(ctx, "render");
|
||||
profile_scope!("window::render");
|
||||
|
||||
ctx.update = UpdateDisplayRequest::None;
|
||||
|
||||
|
@ -876,7 +865,7 @@ impl GlWindow {
|
|||
/// override your vsync settings, which means that you can't know in
|
||||
/// advance whether `swap_buffers` will block or not.
|
||||
pub fn redraw(&mut self) {
|
||||
win_profile_scope!(self.ctx.as_ref().unwrap(), "redraw");
|
||||
profile_scope!("window::redraw");
|
||||
|
||||
let context = unsafe { self.gl_ctx.take().unwrap().make_current().unwrap() };
|
||||
|
||||
|
@ -976,7 +965,9 @@ impl OwnedWindowContext {
|
|||
|
||||
/// Call [UiNode::init] in all nodes.
|
||||
pub fn init(&mut self, ctx: &mut AppContext) {
|
||||
win_profile_scope!(self, "init");
|
||||
profile_scope!("window::init");
|
||||
|
||||
self.root.title.init_local(ctx.vars);
|
||||
|
||||
let update = self.root_context(ctx, |root, ctx| {
|
||||
ctx.updates.push_layout();
|
||||
|
@ -988,7 +979,7 @@ impl OwnedWindowContext {
|
|||
|
||||
/// Call [UiNode::update_hp] in all nodes.
|
||||
pub fn update_hp(&mut self, ctx: &mut AppContext) {
|
||||
win_profile_scope!(self, "update_hp");
|
||||
profile_scope!("window::update_hp");
|
||||
|
||||
let update = self.root_context(ctx, |root, ctx| root.update_hp(ctx));
|
||||
self.update |= update;
|
||||
|
@ -996,7 +987,7 @@ impl OwnedWindowContext {
|
|||
|
||||
/// Call [UiNode::update] in all nodes.
|
||||
pub fn update(&mut self, ctx: &mut AppContext) {
|
||||
win_profile_scope!(self, "update");
|
||||
profile_scope!("window::update");
|
||||
|
||||
// do UiNode updates
|
||||
let update = self.root_context(ctx, |root, ctx| root.update(ctx));
|
||||
|
@ -1005,7 +996,7 @@ impl OwnedWindowContext {
|
|||
|
||||
/// Call [UiNode::deinit] in all nodes.
|
||||
pub fn deinit(mut self, ctx: &mut AppContext) {
|
||||
win_profile_scope!(self, "deinit");
|
||||
profile_scope!("window::deinit");
|
||||
self.root_context(ctx, |root, ctx| root.deinit(ctx));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,5 +12,5 @@ proc-macro2 = "1.0.9"
|
|||
syn = { version = "1.0.16", features = ["full", "visit-mut", "extra-traits"] }
|
||||
quote = "1.0.2"
|
||||
|
||||
proc-macro-hack = "0.5.11"
|
||||
proc-macro-hack = "0.5.14"
|
||||
proc-macro-crate = "0.1.4"
|
Loading…
Reference in New Issue