mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #11646 - pcwalton:real-info-plist, r=metajack
servo: Add an `Info.plist` on the Mac and opt into integrated graphics. Discrete GPUs cause power use problems and tend to perform badly with WebRender. See: * https://developer.apple.com/library/mac/qa/qa1734/_index.html * https://reverse.put.as/2013/05/28/gimmedebugah-how-to-embedded-a-info-plist-into-arbitrary-binaries/ r? @metajack <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11646) <!-- Reviewable:end -->
This commit is contained in:
commit
e51ce5d1ba
7 changed files with 95 additions and 21 deletions
20
components/servo/Cargo.lock
generated
20
components/servo/Cargo.lock
generated
|
@ -99,7 +99,7 @@ version = "0.4.5"
|
|||
source = "git+https://github.com/servo/rust-azure#a7177c8df81554352bc51de2f5b77cbb47ec2635"
|
||||
dependencies = [
|
||||
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
|
||||
|
@ -273,11 +273,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.4.2"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -403,7 +403,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -417,7 +417,7 @@ version = "1.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -756,7 +756,7 @@ dependencies = [
|
|||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2056,9 +2056,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cocoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cocoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gl_generator 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2525,7 +2525,7 @@ source = "git+https://github.com/servo/webrender#3a6db793d0a2a1c0e55f78ba2ee8ec2
|
|||
dependencies = [
|
||||
"app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2548,7 +2548,7 @@ source = "git+https://github.com/servo/webrender_traits#e4cbde9880d118e50de425d3
|
|||
dependencies = [
|
||||
"app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
|
||||
|
|
|
@ -37,6 +37,17 @@ use servo::util::opts::{self, ArgumentParsingResult};
|
|||
use servo::util::panicking::initiate_panic_hook;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub mod platform {
|
||||
#[cfg(target_os = "macos")]
|
||||
pub use platform::macos::deinit;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub mod macos;
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
pub fn deinit() {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Parse the command line options and store them globally
|
||||
let opts_result = opts::from_cmdline_args(&*args());
|
||||
|
@ -82,6 +93,8 @@ fn main() {
|
|||
};
|
||||
|
||||
unregister_glutin_resize_handler(&window);
|
||||
|
||||
platform::deinit()
|
||||
}
|
||||
|
||||
fn register_glutin_resize_handler(window: &Rc<app::window::Window>,
|
||||
|
|
21
components/servo/platform/macos/Info.plist
Normal file
21
components/servo/platform/macos/Info.plist
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Servo</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Servo</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 The Servo Authors</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.servo.servo</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
19
components/servo/platform/macos/mod.rs
Normal file
19
components/servo/platform/macos/mod.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* 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 std::ptr;
|
||||
|
||||
pub fn deinit() {
|
||||
// An unfortunate hack to make sure the linker's dead code stripping doesn't strip our
|
||||
// `Info.plist`.
|
||||
unsafe {
|
||||
ptr::read_volatile(&INFO_PLIST[0]);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_section = "__TEXT,__info_plist"]
|
||||
#[no_mangle]
|
||||
pub static INFO_PLIST: [u8; 619] = *include_bytes!("Info.plist");
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue