mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Format msg #21373
This commit is contained in:
parent
b3b188a6ff
commit
7f4ca21928
3 changed files with 49 additions and 17 deletions
|
@ -224,17 +224,21 @@ impl PipelineNamespace {
|
||||||
|
|
||||||
thread_local!(pub static PIPELINE_NAMESPACE: Cell<Option<PipelineNamespace>> = Cell::new(None));
|
thread_local!(pub static PIPELINE_NAMESPACE: Cell<Option<PipelineNamespace>> = Cell::new(None));
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
|
)]
|
||||||
pub struct PipelineNamespaceId(pub u32);
|
pub struct PipelineNamespaceId(pub u32);
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||||
pub struct PipelineIndex(pub NonZeroU32);
|
pub struct PipelineIndex(pub NonZeroU32);
|
||||||
malloc_size_of_is_0!(PipelineIndex);
|
malloc_size_of_is_0!(PipelineIndex);
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
|
)]
|
||||||
pub struct PipelineId {
|
pub struct PipelineId {
|
||||||
pub namespace_id: PipelineNamespaceId,
|
pub namespace_id: PipelineNamespaceId,
|
||||||
pub index: PipelineIndex
|
pub index: PipelineIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PipelineId {
|
impl PipelineId {
|
||||||
|
@ -289,7 +293,9 @@ impl fmt::Display for PipelineId {
|
||||||
pub struct BrowsingContextIndex(pub NonZeroU32);
|
pub struct BrowsingContextIndex(pub NonZeroU32);
|
||||||
malloc_size_of_is_0!(BrowsingContextIndex);
|
malloc_size_of_is_0!(BrowsingContextIndex);
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
|
)]
|
||||||
pub struct BrowsingContextId {
|
pub struct BrowsingContextId {
|
||||||
pub namespace_id: PipelineNamespaceId,
|
pub namespace_id: PipelineNamespaceId,
|
||||||
pub index: BrowsingContextIndex,
|
pub index: BrowsingContextIndex,
|
||||||
|
@ -316,7 +322,9 @@ impl fmt::Display for BrowsingContextId {
|
||||||
|
|
||||||
thread_local!(pub static TOP_LEVEL_BROWSING_CONTEXT_ID: Cell<Option<TopLevelBrowsingContextId>> = Cell::new(None));
|
thread_local!(pub static TOP_LEVEL_BROWSING_CONTEXT_ID: Cell<Option<TopLevelBrowsingContextId>> = Cell::new(None));
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
|
)]
|
||||||
pub struct TopLevelBrowsingContextId(BrowsingContextId);
|
pub struct TopLevelBrowsingContextId(BrowsingContextId);
|
||||||
|
|
||||||
impl TopLevelBrowsingContextId {
|
impl TopLevelBrowsingContextId {
|
||||||
|
@ -362,7 +370,9 @@ impl PartialEq<BrowsingContextId> for TopLevelBrowsingContextId {
|
||||||
pub struct HistoryStateIndex(pub NonZeroU32);
|
pub struct HistoryStateIndex(pub NonZeroU32);
|
||||||
malloc_size_of_is_0!(HistoryStateIndex);
|
malloc_size_of_is_0!(HistoryStateIndex);
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
|
#[derive(
|
||||||
|
Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, Ord, PartialEq, PartialOrd, Serialize,
|
||||||
|
)]
|
||||||
pub struct HistoryStateId {
|
pub struct HistoryStateId {
|
||||||
pub namespace_id: PipelineNamespaceId,
|
pub namespace_id: PipelineNamespaceId,
|
||||||
pub index: HistoryStateIndex,
|
pub index: HistoryStateIndex,
|
||||||
|
@ -390,13 +400,19 @@ impl fmt::Display for HistoryStateId {
|
||||||
// We provide ids just for unit testing.
|
// We provide ids just for unit testing.
|
||||||
pub const TEST_NAMESPACE: PipelineNamespaceId = PipelineNamespaceId(1234);
|
pub const TEST_NAMESPACE: PipelineNamespaceId = PipelineNamespaceId(1234);
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub const TEST_PIPELINE_INDEX: PipelineIndex = unsafe { PipelineIndex(NonZeroU32::new_unchecked(5678)) };
|
pub const TEST_PIPELINE_INDEX: PipelineIndex =
|
||||||
pub const TEST_PIPELINE_ID: PipelineId = PipelineId { namespace_id: TEST_NAMESPACE, index: TEST_PIPELINE_INDEX };
|
unsafe { PipelineIndex(NonZeroU32::new_unchecked(5678)) };
|
||||||
|
pub const TEST_PIPELINE_ID: PipelineId = PipelineId {
|
||||||
|
namespace_id: TEST_NAMESPACE,
|
||||||
|
index: TEST_PIPELINE_INDEX,
|
||||||
|
};
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub const TEST_BROWSING_CONTEXT_INDEX: BrowsingContextIndex =
|
pub const TEST_BROWSING_CONTEXT_INDEX: BrowsingContextIndex =
|
||||||
unsafe { BrowsingContextIndex(NonZeroU32::new_unchecked(8765)) };
|
unsafe { BrowsingContextIndex(NonZeroU32::new_unchecked(8765)) };
|
||||||
pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId =
|
pub const TEST_BROWSING_CONTEXT_ID: BrowsingContextId = BrowsingContextId {
|
||||||
BrowsingContextId { namespace_id: TEST_NAMESPACE, index: TEST_BROWSING_CONTEXT_INDEX };
|
namespace_id: TEST_NAMESPACE,
|
||||||
|
index: TEST_BROWSING_CONTEXT_INDEX,
|
||||||
|
};
|
||||||
|
|
||||||
// Used to specify the kind of input method editor appropriate to edit a field.
|
// Used to specify the kind of input method editor appropriate to edit a field.
|
||||||
// This is a subset of htmlinputelement::InputType because some variants of InputType
|
// This is a subset of htmlinputelement::InputType because some variants of InputType
|
||||||
|
|
|
@ -6,9 +6,12 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
#[macro_use] extern crate malloc_size_of;
|
#[macro_use]
|
||||||
#[macro_use] extern crate malloc_size_of_derive;
|
extern crate malloc_size_of;
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use]
|
||||||
|
extern crate malloc_size_of_derive;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate serde;
|
||||||
extern crate webrender_api;
|
extern crate webrender_api;
|
||||||
|
|
||||||
pub mod constellation_msg;
|
pub mod constellation_msg;
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
#![cfg(target_pointer_width = "64")]
|
#![cfg(target_pointer_width = "64")]
|
||||||
|
|
||||||
extern crate msg;
|
extern crate msg;
|
||||||
#[macro_use] extern crate size_of_test;
|
#[macro_use]
|
||||||
|
extern crate size_of_test;
|
||||||
|
|
||||||
use msg::constellation_msg::BrowsingContextId;
|
use msg::constellation_msg::BrowsingContextId;
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
|
@ -14,6 +15,18 @@ use msg::constellation_msg::TopLevelBrowsingContextId;
|
||||||
size_of_test!(test_size_of_pipeline_id, PipelineId, 8);
|
size_of_test!(test_size_of_pipeline_id, PipelineId, 8);
|
||||||
size_of_test!(test_size_of_optional_pipeline_id, Option<PipelineId>, 8);
|
size_of_test!(test_size_of_optional_pipeline_id, Option<PipelineId>, 8);
|
||||||
size_of_test!(test_size_of_browsing_context_id, BrowsingContextId, 8);
|
size_of_test!(test_size_of_browsing_context_id, BrowsingContextId, 8);
|
||||||
size_of_test!(test_size_of_optional_browsing_context_id, Option<BrowsingContextId>, 8);
|
size_of_test!(
|
||||||
size_of_test!(test_size_of_top_level_browsing_context_id, TopLevelBrowsingContextId, 8);
|
test_size_of_optional_browsing_context_id,
|
||||||
size_of_test!(test_size_of_top_level_optional_browsing_context_id, Option<TopLevelBrowsingContextId>, 8);
|
Option<BrowsingContextId>,
|
||||||
|
8
|
||||||
|
);
|
||||||
|
size_of_test!(
|
||||||
|
test_size_of_top_level_browsing_context_id,
|
||||||
|
TopLevelBrowsingContextId,
|
||||||
|
8
|
||||||
|
);
|
||||||
|
size_of_test!(
|
||||||
|
test_size_of_top_level_optional_browsing_context_id,
|
||||||
|
Option<TopLevelBrowsingContextId>,
|
||||||
|
8
|
||||||
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue