Skip to main content

devtools/actors/
pause.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use std::sync::Arc;
6
7use malloc_size_of_derive::MallocSizeOf;
8
9use crate::actor::{Actor, ActorRegistry, new_actor_name};
10
11/// Referenced by `ThreadActor` when replying to `interupt` messages.
12/// <https://searchfox.org/firefox-main/source/devtools/server/actors/thread.js#1699>
13#[derive(MallocSizeOf)]
14pub(crate) struct PauseActor {
15    name: String,
16}
17
18impl Actor for PauseActor {
19    fn name(&self) -> &str {
20        &self.name
21    }
22}
23
24impl PauseActor {
25    pub fn register(registry: &ActorRegistry) -> Arc<Self> {
26        let name = new_actor_name::<Self>();
27        let actor = Self { name };
28        registry.register::<Self>(actor)
29    }
30}