forked from servo/servo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# This is a combination of 5 commits.
# This is the 1st commit message: resolved merge conflict # This is the commit message servo#2: getRandomValues uses ArrayBufferView now # This is the commit message servo#3: Workaround servo#20149 - presumed rustc bug on android. # This is the commit message servo#4: Update WR (accelerated webgl fix on mac, line decoration optimizations). # This is the commit message servo#5: build(mach): generate webrender revision via cargo lockfile
- Loading branch information
pmocher
committed
Mar 30, 2018
1 parent
b30a8d2
commit f572f8f
Showing
37 changed files
with
230 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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 bincode; | ||
use ipc_channel::ipc; | ||
use serde::{Deserialize, Serialize}; | ||
use std::io::Error; | ||
use time; | ||
use time::ProfilerCategory; | ||
use time::ProfilerChan; | ||
|
||
pub struct IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize { | ||
ipc_receiver: ipc::IpcReceiver<T>, | ||
time_profile_chan: ProfilerChan, | ||
} | ||
|
||
impl<T> IpcReceiver<T> where T: for<'de> Deserialize<'de> + Serialize { | ||
pub fn recv(&self) -> Result<T, bincode::Error> { | ||
time::profile( | ||
ProfilerCategory::IpcReceiver, | ||
None, | ||
self.time_profile_chan.clone(), | ||
move || self.ipc_receiver.recv(), | ||
) | ||
} | ||
|
||
pub fn try_recv(&self) -> Result<T, bincode::Error> { | ||
self.ipc_receiver.try_recv() | ||
} | ||
|
||
pub fn to_opaque(self) -> ipc::OpaqueIpcReceiver { | ||
self.ipc_receiver.to_opaque() | ||
} | ||
} | ||
|
||
pub fn channel<T>(time_profile_chan: ProfilerChan) -> Result<(ipc::IpcSender<T>, IpcReceiver<T>), Error> | ||
where T: for<'de> Deserialize<'de> + Serialize, { | ||
let (ipc_sender, ipc_receiver) = ipc::channel()?; | ||
let profiled_ipc_receiver = IpcReceiver { | ||
ipc_receiver, | ||
time_profile_chan, | ||
}; | ||
Ok((ipc_sender, profiled_ipc_receiver)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.