зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #19547 - Send IPC receiver for canvas as part of CreateCanvasPaintThread message (from tigercosmos:b1); r=jdm
<!-- Please describe your changes on the following line: --> I am not sure if @jdm want this. r? @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #19483(github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: c9e3fabdfd0d4c900e83a1050ec465303e339681 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 6aa288e249807e1eae78d5900427d8f72414a4ee
This commit is contained in:
Родитель
6f65825326
Коммит
25eac1e745
|
@ -11,7 +11,7 @@ use azure::azure_hl::SurfacePattern;
|
|||
use canvas_traits::canvas::*;
|
||||
use cssparser::RGBA;
|
||||
use euclid::{Transform2D, Point2D, Vector2D, Rect, Size2D};
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use ipc_channel::ipc::{self, IpcSender, IpcReceiver};
|
||||
use num_traits::ToPrimitive;
|
||||
use std::borrow::ToOwned;
|
||||
use std::mem;
|
||||
|
@ -118,9 +118,8 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
/// communicate with it.
|
||||
pub fn start(size: Size2D<i32>,
|
||||
webrender_api_sender: webrender_api::RenderApiSender,
|
||||
antialias: bool)
|
||||
-> IpcSender<CanvasMsg> {
|
||||
let (sender, receiver) = ipc::channel::<CanvasMsg>().unwrap();
|
||||
antialias: bool,
|
||||
receiver: IpcReceiver<CanvasMsg>) {
|
||||
let antialias = if antialias {
|
||||
AntialiasMode::Default
|
||||
} else {
|
||||
|
@ -216,8 +215,6 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
}
|
||||
}
|
||||
}).expect("Thread spawning failed");
|
||||
|
||||
sender
|
||||
}
|
||||
|
||||
fn save_context_state(&mut self) {
|
||||
|
|
|
@ -1235,9 +1235,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
self.embedder_proxy.send(EmbedderMsg::HeadParsed(source_top_ctx_id));
|
||||
}
|
||||
}
|
||||
FromScriptMsg::CreateCanvasPaintThread(size, sender) => {
|
||||
FromScriptMsg::CreateCanvasPaintThread(size, receiver) => {
|
||||
debug!("constellation got create-canvas-paint-thread message");
|
||||
self.handle_create_canvas_paint_thread_msg(&size, sender)
|
||||
self.handle_create_canvas_paint_thread_msg(&size, receiver)
|
||||
}
|
||||
FromScriptMsg::NodeStatus(message) => {
|
||||
debug!("constellation got NodeStatus message");
|
||||
|
@ -2264,13 +2264,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
fn handle_create_canvas_paint_thread_msg(
|
||||
&mut self,
|
||||
size: &Size2D<i32>,
|
||||
response_sender: IpcSender<IpcSender<CanvasMsg>>) {
|
||||
receiver: IpcReceiver<CanvasMsg>) {
|
||||
let webrender_api = self.webrender_api_sender.clone();
|
||||
let sender = CanvasPaintThread::start(*size, webrender_api,
|
||||
opts::get().enable_canvas_antialiasing);
|
||||
if let Err(e) = response_sender.send(sender) {
|
||||
warn!("Create canvas paint thread response failed ({})", e);
|
||||
}
|
||||
CanvasPaintThread::start(*size,
|
||||
webrender_api,
|
||||
opts::get().enable_canvas_antialiasing,
|
||||
receiver);
|
||||
}
|
||||
|
||||
fn handle_webdriver_msg(&mut self, msg: WebDriverCommandMsg) {
|
||||
|
|
|
@ -129,11 +129,10 @@ impl CanvasRenderingContext2D {
|
|||
size: Size2D<i32>)
|
||||
-> CanvasRenderingContext2D {
|
||||
debug!("Creating new canvas rendering context.");
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (ipc_renderer, receiver) = ipc::channel::<CanvasMsg>().unwrap();
|
||||
let script_to_constellation_chan = global.script_to_constellation_chan();
|
||||
debug!("Asking constellation to create new canvas thread.");
|
||||
script_to_constellation_chan.send(ScriptMsg::CreateCanvasPaintThread(size, sender)).unwrap();
|
||||
let ipc_renderer = receiver.recv().unwrap();
|
||||
script_to_constellation_chan.send(ScriptMsg::CreateCanvasPaintThread(size, receiver)).unwrap();
|
||||
debug!("Done.");
|
||||
CanvasRenderingContext2D {
|
||||
reflector_: Reflector::new(),
|
||||
|
|
|
@ -79,7 +79,7 @@ pub enum ScriptMsg {
|
|||
ChangeRunningAnimationsState(AnimationState),
|
||||
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
|
||||
/// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.)
|
||||
CreateCanvasPaintThread(Size2D<i32>, IpcSender<IpcSender<CanvasMsg>>),
|
||||
CreateCanvasPaintThread(Size2D<i32>, IpcReceiver<CanvasMsg>),
|
||||
/// Notifies the constellation that this frame has received focus.
|
||||
Focus,
|
||||
/// Forward an event that was sent to the parent window.
|
||||
|
|
Загрузка…
Ссылка в новой задаче