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 malloc_size_of_derive::MallocSizeOf;
6
7use crate::actor::{Actor, ActorRegistry};
8
9/// Referenced by `ThreadActor` when replying to `interupt` messages.
10/// <https://searchfox.org/firefox-main/source/devtools/server/actors/thread.js#1699>
11#[derive(MallocSizeOf)]
12pub(crate) struct PauseActor {
13 name: String,
14}
15
16impl Actor for PauseActor {
17 fn name(&self) -> String {
18 self.name.clone()
19 }
20}
21
22impl PauseActor {
23 pub fn register(registry: &ActorRegistry) -> String {
24 let name = registry.new_name::<Self>();
25 let actor = Self { name: name.clone() };
26 registry.register::<Self>(actor);
27 name
28 }
29}