mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
make use of ScriptToConstellationChan
This commit is contained in:
parent
817de15735
commit
d241389129
24 changed files with 285 additions and 280 deletions
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use script_traits::ScriptMsg as ConstellationMsg;
|
||||
use ipc_channel::ipc::channel;
|
||||
use script_traits::{ScriptToConstellationChan, ScriptMsg};
|
||||
use std::borrow::ToOwned;
|
||||
|
||||
pub trait ClipboardProvider {
|
||||
|
@ -13,14 +13,14 @@ pub trait ClipboardProvider {
|
|||
fn set_clipboard_contents(&mut self, String);
|
||||
}
|
||||
|
||||
impl ClipboardProvider for IpcSender<ConstellationMsg> {
|
||||
impl ClipboardProvider for ScriptToConstellationChan {
|
||||
fn clipboard_contents(&mut self) -> String {
|
||||
let (tx, rx) = ipc::channel().unwrap();
|
||||
self.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
|
||||
let (tx, rx) = channel().unwrap();
|
||||
self.send(ScriptMsg::GetClipboardContents(tx)).unwrap();
|
||||
rx.recv().unwrap()
|
||||
}
|
||||
fn set_clipboard_contents(&mut self, s: String) {
|
||||
self.send(ConstellationMsg::SetClipboardContents(s)).unwrap();
|
||||
self.send(ScriptMsg::SetClipboardContents(s)).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue