зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset a50f4437c923 (bug 1888880) for crashreporter osx build bustages. CLOSED TREE
This commit is contained in:
Родитель
9961676b27
Коммит
e17a5122e8
|
@ -986,12 +986,12 @@ dependencies = [
|
|||
"fluent",
|
||||
"gtkbind",
|
||||
"intl-memoizer",
|
||||
"lazy_static",
|
||||
"libloading",
|
||||
"log",
|
||||
"mozbuild",
|
||||
"mozilla-central-workspace-hack",
|
||||
"objc",
|
||||
"once_cell",
|
||||
"phf",
|
||||
"phf_codegen",
|
||||
"serde",
|
||||
|
|
|
@ -12,11 +12,11 @@ cfg-if = "1.0"
|
|||
env_logger = { version = "0.10", default-features = false }
|
||||
fluent = "0.16.0"
|
||||
intl-memoizer = "0.5"
|
||||
lazy_static = "1.4"
|
||||
libloading = "0.7"
|
||||
log = "0.4.17"
|
||||
mozbuild = "0.1"
|
||||
mozilla-central-workspace-hack = { version = "0.1", features = ["crashreporter"], optional = true }
|
||||
once_cell = "1"
|
||||
phf = "0.11"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
use crate::std::path::Path;
|
||||
use libloading::{Library, Symbol};
|
||||
use once_cell::sync::Lazy;
|
||||
use std::ffi::{c_char, c_long, c_uint, CStr, CString};
|
||||
|
||||
// Constants lifted from `curl.h`
|
||||
|
@ -149,9 +148,12 @@ library_binding! {
|
|||
fn curl_mime_free(CurlMime);
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref CURL: std::io::Result<Curl> = Curl::load();
|
||||
}
|
||||
|
||||
/// Load libcurl if possible.
|
||||
pub fn load() -> std::io::Result<&'static Curl> {
|
||||
static CURL: Lazy<std::io::Result<Curl>> = Lazy::new(Curl::load);
|
||||
CURL.as_ref().map_err(error_other)
|
||||
}
|
||||
|
||||
|
|
Двоичные данные
toolkit/crashreporter/client/app/src/ui/crashreporter.png
Двоичные данные
toolkit/crashreporter/client/app/src/ui/crashreporter.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 4.1 KiB |
|
@ -35,17 +35,6 @@ pub struct UI {
|
|||
impl UI {
|
||||
pub fn run_loop(&self, app: Application) {
|
||||
unsafe {
|
||||
let stream = gtk::g_memory_input_stream_new_from_data(
|
||||
super::ICON_PNG_DATA.as_ptr() as _,
|
||||
super::ICON_PNG_DATA.len() as i64,
|
||||
None,
|
||||
);
|
||||
let icon_pixbuf =
|
||||
gtk::gdk_pixbuf_new_from_stream(stream, std::ptr::null_mut(), std::ptr::null_mut());
|
||||
gtk::g_object_unref(stream as _);
|
||||
|
||||
gtk::gtk_window_set_default_icon(icon_pixbuf);
|
||||
|
||||
let app_ptr = gtk::gtk_application_new(
|
||||
std::ptr::null(),
|
||||
gtk::GApplicationFlags_G_APPLICATION_FLAGS_NONE,
|
||||
|
@ -65,7 +54,6 @@ impl UI {
|
|||
gtk::g_application_run(app_ptr as *mut gtk::GApplication, 0, std::ptr::null_mut());
|
||||
self.running.store(false, Relaxed);
|
||||
gtk::g_object_unref(app_ptr as *mut _);
|
||||
gtk::g_object_unref(icon_pixbuf as _);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ use cocoa::{
|
|||
NSTextField_NSTextFieldConvenience, NSView_NSConstraintBasedLayoutInstallingConstraints,
|
||||
NSView_NSConstraintBasedLayoutLayering, NSView_NSSafeAreas, PNSObject,
|
||||
};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
/// https://developer.apple.com/documentation/foundation/1497293-string_encodings/nsutf8stringencoding?language=objc
|
||||
const NSUTF8StringEncoding: cocoa::NSStringEncoding = 4;
|
||||
|
@ -184,9 +183,10 @@ fn enqueue<F: Fn() + 'static>(f: F) {
|
|||
// # Safety
|
||||
// The array is static and cannot be changed.
|
||||
unsafe impl Sync for RunloopModes {}
|
||||
unsafe impl Send for RunloopModes {}
|
||||
|
||||
static RUNLOOP_MODES: Lazy<RunloopModes> = Lazy::new(RunloopModes::new);
|
||||
lazy_static::lazy_static! {
|
||||
static ref RUNLOOP_MODES: RunloopModes = RunloopModes::new();
|
||||
}
|
||||
|
||||
unsafe {
|
||||
cocoa::NSRunLoop::mainRunLoop().performInModes_block_(RUNLOOP_MODES.0, &*block);
|
||||
|
|
|
@ -20,13 +20,6 @@ use ui_impl::UI;
|
|||
|
||||
mod model;
|
||||
|
||||
// Must be DWORD-aligned for Win32 CreateIconFromResource.
|
||||
#[repr(align(4))]
|
||||
struct Aligned<Bytes: ?Sized>(Bytes);
|
||||
static ICON_PNG_DATA_ALIGNMENT: &'static Aligned<[u8]> =
|
||||
&Aligned(*include_bytes!("crashreporter.png"));
|
||||
static ICON_PNG_DATA: &'static [u8] = &ICON_PNG_DATA_ALIGNMENT.0;
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod test {
|
||||
pub mod model {
|
||||
|
|
|
@ -24,7 +24,6 @@ extern "C" {}
|
|||
use super::model::{self, Application, Element, ElementStyle, TypedElement};
|
||||
use crate::data::Property;
|
||||
use font::Font;
|
||||
use once_cell::sync::Lazy;
|
||||
use quit_token::QuitToken;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
|
@ -288,25 +287,6 @@ impl window::WindowClass for AppWindow {
|
|||
}
|
||||
|
||||
impl CustomWindowClass for AppWindow {
|
||||
fn icon() -> win::HICON {
|
||||
static ICON: Lazy<win::HICON> = Lazy::new(|| unsafe {
|
||||
// If CreateIconFromResource fails it returns NULL, which is fine (a default icon will be
|
||||
// used).
|
||||
win::CreateIconFromResource(
|
||||
// We take advantage of the fact that since Windows Vista, an RT_ICON resource entry
|
||||
// can simply be a PNG image.
|
||||
super::ICON_PNG_DATA.as_ptr(),
|
||||
super::ICON_PNG_DATA.len() as u32,
|
||||
true.into(),
|
||||
// The 0x00030000 constant isn't available anywhere; the docs basically say to just
|
||||
// pass it...
|
||||
0x00030000,
|
||||
)
|
||||
});
|
||||
|
||||
*ICON
|
||||
}
|
||||
|
||||
fn message(
|
||||
data: &RefCell<Self>,
|
||||
hwnd: HWND,
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::cell::RefCell;
|
|||
use windows_sys::Win32::{
|
||||
Foundation::{HINSTANCE, HWND, LPARAM, LRESULT, WPARAM},
|
||||
Graphics::Gdi::{self, HBRUSH},
|
||||
UI::WindowsAndMessaging::{self as win, HCURSOR, HICON},
|
||||
UI::WindowsAndMessaging::{self as win, HCURSOR},
|
||||
};
|
||||
|
||||
/// Types representing a window class.
|
||||
|
@ -58,11 +58,6 @@ pub trait CustomWindowClass: WindowClass {
|
|||
unsafe { win::LoadCursorW(0, win::IDC_ARROW) }
|
||||
}
|
||||
|
||||
/// The class's default icon.
|
||||
fn icon() -> HICON {
|
||||
0
|
||||
}
|
||||
|
||||
/// Register the class.
|
||||
fn register(module: HINSTANCE) -> anyhow::Result<()> {
|
||||
unsafe extern "system" fn wnd_proc<W: CustomWindowClass>(
|
||||
|
@ -102,7 +97,6 @@ pub trait CustomWindowClass: WindowClass {
|
|||
hInstance: module,
|
||||
lpszClassName: class_name.pcwstr(),
|
||||
hbrBackground: Self::background(),
|
||||
hIcon: Self::icon(),
|
||||
hCursor: Self::cursor(),
|
||||
cbWndExtra: std::mem::size_of::<isize>() as i32,
|
||||
..unsafe { std::mem::zeroed() }
|
||||
|
|
|
@ -9,7 +9,6 @@ use mozbuild::config::{
|
|||
const HEADER: &str = r#"
|
||||
#include "gtk/gtk.h"
|
||||
#include "pango/pango.h"
|
||||
#include "gdk-pixbuf/gdk-pixbuf.h"
|
||||
"#;
|
||||
|
||||
fn main() {
|
||||
|
@ -18,10 +17,7 @@ fn main() {
|
|||
.clang_args(CFLAGS)
|
||||
.clang_args(GTK_CFLAGS)
|
||||
.allowlist_function("gtk_.*")
|
||||
.allowlist_function(
|
||||
"g_(application|main_context|memory_input_stream|object|signal|timeout)_.*",
|
||||
)
|
||||
.allowlist_function("gdk_pixbuf_new_from_stream")
|
||||
.allowlist_function("g_(application|main_context|object|signal|timeout)_.*")
|
||||
.allowlist_function("pango_attr_.*")
|
||||
// The gtk/glib valist functions generate FFI-unsafe signatures on aarch64 which cause
|
||||
// compile errors. We don't use them anyway.
|
||||
|
|
Загрузка…
Ссылка в новой задаче