1 // This Source Code Form is subject to the terms of the Mozilla Public 2 // License, v. 2.0. If a copy of the MPL was not distributed with this 3 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 extern crate geckoservo; 6 7 extern crate app_services_logger; 8 #[cfg(feature = "cubeb-remoting")] 9 extern crate audioipc2_client; 10 #[cfg(feature = "cubeb-remoting")] 11 extern crate audioipc2_server; 12 #[cfg(feature = "cubeb-remoting")] 13 extern crate audioipc_client; 14 #[cfg(feature = "cubeb-remoting")] 15 extern crate audioipc_server; 16 extern crate authenticator; 17 #[cfg(feature = "bitsdownload")] 18 extern crate bitsdownload; 19 #[cfg(feature = "moz_places")] 20 extern crate bookmark_sync; 21 extern crate cascade_bloom_filter; 22 extern crate cert_storage; 23 extern crate chardetng_c; 24 extern crate cosec; 25 #[cfg(feature = "cubeb_coreaudio_rust")] 26 extern crate cubeb_coreaudio; 27 #[cfg(feature = "cubeb_pulse_rust")] 28 extern crate cubeb_pulse; 29 extern crate encoding_glue; 30 extern crate fog_control; 31 extern crate gecko_profiler; 32 extern crate gkrust_utils; 33 extern crate http_sfv; 34 extern crate jsrust_shared; 35 extern crate kvstore; 36 extern crate mapped_hyph; 37 extern crate mozurl; 38 extern crate mp4parse_capi; 39 extern crate netwerk_helper; 40 extern crate nserror; 41 extern crate nsstring; 42 extern crate prefs_parser; 43 extern crate processtools; 44 #[cfg(feature = "gecko_profiler")] 45 extern crate profiler_helper; 46 extern crate rsdparsa_capi; 47 extern crate static_prefs; 48 extern crate storage; 49 extern crate webrender_bindings; 50 extern crate xpcom; 51 #[cfg(feature = "new_xulstore")] 52 extern crate xulstore; 53 54 extern crate audio_thread_priority; 55 56 #[cfg(not(target_os = "android"))] 57 extern crate webext_storage_bridge; 58 59 #[cfg(feature = "webrtc")] 60 extern crate mdns_service; 61 extern crate neqo_glue; 62 extern crate wgpu_bindings; 63 64 extern crate qcms; 65 66 extern crate unic_langid; 67 extern crate unic_langid_ffi; 68 69 extern crate fluent_langneg; 70 extern crate fluent_langneg_ffi; 71 72 extern crate fluent; 73 extern crate fluent_ffi; 74 75 extern crate fluent_fallback; 76 extern crate l10nregistry_ffi; 77 extern crate localization_ffi; 78 79 #[cfg(not(target_os = "android"))] 80 extern crate viaduct; 81 82 extern crate gecko_logger; 83 84 #[cfg(feature = "oxidized_breakpad")] 85 extern crate rust_minidump_writer_linux; 86 87 #[cfg(feature = "webmidi_midir_impl")] 88 extern crate midir_impl; 89 90 extern crate origin_trials_ffi; 91 92 extern crate log; 93 use log::info; 94 95 use std::{ffi::CStr, os::raw::c_char}; 96 97 use gecko_logger::GeckoLogger; 98 99 #[no_mangle] GkRust_Init()100pub extern "C" fn GkRust_Init() { 101 // Initialize logging. 102 let _ = GeckoLogger::init(); 103 } 104 105 #[no_mangle] GkRust_Shutdown()106pub extern "C" fn GkRust_Shutdown() {} 107 108 /// Used to implement `nsIDebug2::RustPanic` for testing purposes. 109 #[no_mangle] intentional_panic(message: *const c_char)110pub extern "C" fn intentional_panic(message: *const c_char) { 111 panic!("{}", unsafe { CStr::from_ptr(message) }.to_string_lossy()); 112 } 113 114 /// Used to implement `nsIDebug2::rustLog` for testing purposes. 115 #[no_mangle] debug_log(target: *const c_char, message: *const c_char)116pub extern "C" fn debug_log(target: *const c_char, message: *const c_char) { 117 unsafe { 118 // NOTE: The `info!` log macro is used here because we have the `release_max_level_info` feature set. 119 info!(target: CStr::from_ptr(target).to_str().unwrap(), "{}", CStr::from_ptr(message).to_str().unwrap()); 120 } 121 } 122