mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-29 12:38:02 +00:00
Avoid storing type name string on AnyViewHandle
It won't be needed for leak error messages, because the typed view handle will typically be created first. And this avoids increasing the size of the handle used in production.
This commit is contained in:
parent
ae93cfed50
commit
8b7a9367fa
1 changed files with 3 additions and 8 deletions
|
@ -15,7 +15,7 @@ use platform::Event;
|
||||||
use postage::oneshot;
|
use postage::oneshot;
|
||||||
use smol::prelude::*;
|
use smol::prelude::*;
|
||||||
use std::{
|
use std::{
|
||||||
any::{self, type_name, Any, TypeId},
|
any::{type_name, Any, TypeId},
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::{hash_map::Entry, BTreeMap, HashMap, HashSet, VecDeque},
|
collections::{hash_map::Entry, BTreeMap, HashMap, HashSet, VecDeque},
|
||||||
fmt::{self, Debug},
|
fmt::{self, Debug},
|
||||||
|
@ -3382,8 +3382,8 @@ pub struct AnyViewHandle {
|
||||||
window_id: usize,
|
window_id: usize,
|
||||||
view_id: usize,
|
view_id: usize,
|
||||||
view_type: TypeId,
|
view_type: TypeId,
|
||||||
type_name: &'static str,
|
|
||||||
ref_counts: Arc<Mutex<RefCounts>>,
|
ref_counts: Arc<Mutex<RefCounts>>,
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
handle_id: usize,
|
handle_id: usize,
|
||||||
}
|
}
|
||||||
|
@ -3393,7 +3393,6 @@ impl AnyViewHandle {
|
||||||
window_id: usize,
|
window_id: usize,
|
||||||
view_id: usize,
|
view_id: usize,
|
||||||
view_type: TypeId,
|
view_type: TypeId,
|
||||||
type_name: &'static str,
|
|
||||||
ref_counts: Arc<Mutex<RefCounts>>,
|
ref_counts: Arc<Mutex<RefCounts>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
ref_counts.lock().inc_view(window_id, view_id);
|
ref_counts.lock().inc_view(window_id, view_id);
|
||||||
|
@ -3403,13 +3402,12 @@ impl AnyViewHandle {
|
||||||
.lock()
|
.lock()
|
||||||
.leak_detector
|
.leak_detector
|
||||||
.lock()
|
.lock()
|
||||||
.handle_created(Some(type_name), view_id);
|
.handle_created(None, view_id);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
window_id,
|
window_id,
|
||||||
view_id,
|
view_id,
|
||||||
view_type,
|
view_type,
|
||||||
type_name,
|
|
||||||
ref_counts,
|
ref_counts,
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
handle_id,
|
handle_id,
|
||||||
|
@ -3456,7 +3454,6 @@ impl Clone for AnyViewHandle {
|
||||||
self.window_id,
|
self.window_id,
|
||||||
self.view_id,
|
self.view_id,
|
||||||
self.view_type,
|
self.view_type,
|
||||||
self.type_name,
|
|
||||||
self.ref_counts.clone(),
|
self.ref_counts.clone(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -3474,7 +3471,6 @@ impl<T: View> From<&ViewHandle<T>> for AnyViewHandle {
|
||||||
handle.window_id,
|
handle.window_id,
|
||||||
handle.view_id,
|
handle.view_id,
|
||||||
TypeId::of::<T>(),
|
TypeId::of::<T>(),
|
||||||
any::type_name::<T>(),
|
|
||||||
handle.ref_counts.clone(),
|
handle.ref_counts.clone(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -3486,7 +3482,6 @@ impl<T: View> From<ViewHandle<T>> for AnyViewHandle {
|
||||||
window_id: handle.window_id,
|
window_id: handle.window_id,
|
||||||
view_id: handle.view_id,
|
view_id: handle.view_id,
|
||||||
view_type: TypeId::of::<T>(),
|
view_type: TypeId::of::<T>(),
|
||||||
type_name: any::type_name::<T>(),
|
|
||||||
ref_counts: handle.ref_counts.clone(),
|
ref_counts: handle.ref_counts.clone(),
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
handle_id: handle.handle_id,
|
handle_id: handle.handle_id,
|
||||||
|
|
Loading…
Reference in a new issue