Introduce MainThreadScriptMsg::RegisterPaintWorklet

This avoids the need for a generic task to send messages to the layout thread
through the main script thread.
This commit is contained in:
Anthony Ramine 2017-09-17 09:57:12 +02:00
parent 95dc54d216
commit f58207b851
4 changed files with 67 additions and 39 deletions

View file

@ -46,7 +46,6 @@ use js::rust::Runtime;
use msg::constellation_msg::PipelineId;
use net_traits::image::base::PixelFormat;
use net_traits::image_cache::ImageCache;
use script_layout_interface::message::Msg;
use script_traits::DrawAPaintImageResult;
use script_traits::Painter;
use servo_atoms::Atom;
@ -443,8 +442,7 @@ impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
// Inform layout that there is a registered paint worklet.
// TODO: layout will end up getting this message multiple times.
let painter = self.painter(name.clone());
let msg = Msg::RegisterPaint(name, properties, painter);
self.worklet_global.send_to_layout(msg);
self.worklet_global.register_paint_worklet(name, properties, painter);
Ok(())
}