Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rivet/runtime/windows/src/browser/chromium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ impl TabMoves for Chromium {
fn read_word(address: usize) -> Option<usize> {
use windows_sys::Win32::System::Diagnostics::Debug::ReadProcessMemory;
use windows_sys::Win32::System::Threading::GetCurrentProcess;
// A word known readable is read in place, without a system call.
if let Some(value) = crate::chromium::memory::read_word(address) {
return Some(value);
}
let mut value = 0usize;
let mut done = 0usize;
// ReadProcessMemory fails, instead of faulting, on an address that is not mapped.
Expand Down
3 changes: 3 additions & 0 deletions rivet/runtime/windows/src/features/app_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ pub(crate) unsafe fn flip_new_tab(window: HWND, offsets: &[usize]) -> bool {
unsafe fn safe_word(address: usize) -> Option<usize> {
use windows_sys::Win32::System::Diagnostics::Debug::ReadProcessMemory;
use windows_sys::Win32::System::Threading::GetCurrentProcess;
if let Some(value) = crate::chromium::memory::read_word(address) {
return Some(value);
}
let mut value = 0usize;
let mut done = 0usize;
let ok = ReadProcessMemory(
Expand Down
5 changes: 5 additions & 0 deletions rivet/runtime/windows/src/features/tab_strip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ const BOUNDS: usize = 0x1C0;
/// A word of memory that may not belong to a view, read so that a wrong guess cannot fault.
unsafe fn read(address: usize, bytes: usize, out: *mut u8) -> bool {
use windows_sys::Win32::System::Diagnostics::Debug::ReadProcessMemory;
// Memory known readable is copied in place, without a system call for every word.
if address > 0x10000 && crate::chromium::memory::readable(address, bytes) {
std::ptr::copy_nonoverlapping(address as *const u8, out, bytes);
return true;
}
address > 0x10000
&& ReadProcessMemory(
windows_sys::Win32::System::Threading::GetCurrentProcess(),
Expand Down
6 changes: 6 additions & 0 deletions rivet/runtime/windows/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3125,19 +3125,25 @@ pub(crate) unsafe fn update_top_bar(window: HWND) {
if crate::features::address_bar::busy() {
return;
}
let mut laps = Laps::start();
let dpi = layout_dpi(window);
let top_bar = if framed(window) {
crate::features::address_bar::view(window)
} else {
None
};
laps.mark("view");
APPBARS.with(|appbars| {
if let Some(appbar) = appbars.borrow_mut().get_mut(&(window as isize)) {
if let Err(error) = appbar.update_address(window as isize, top_bar.as_ref(), dpi) {
log(&format!("rivet: could not draw the top bar: {error}"));
}
}
});
laps.mark("paint");
if laps.total_us() >= SLOW_UPDATE_US && crate::trace::tracing() {
crate::trace::trace(&laps.line().replacen("appbar:", "top bar:", 1));
}
}

/// The steps of one surface update and how long each took, in microseconds.
Expand Down
Loading