From c258b1569720009d20e22dc3cd0f6ca82aed6bf6 Mon Sep 17 00:00:00 2001 From: Morris Tseng Date: Fri, 18 Nov 2016 13:02:05 -0500 Subject: [PATCH] Bug 1316223 - Moving binding to separate folder. r=jrmuizel,kats MozReview-Commit-ID: FLqSGebdGcH --HG-- rename : gfx/webrender/src/bindings.rs => gfx/webrender_bindings/src/bindings.rs rename : gfx/webrender/webrender.h => gfx/webrender_bindings/src/webrender.h --- gfx/layers/ipc/PWebRenderBridge.ipdl | 2 +- gfx/layers/ipc/WebRenderMessages.ipdlh | 4 ++-- gfx/layers/wr/WebRenderColorLayer.cpp | 2 +- gfx/layers/wr/WebRenderLayerManager.cpp | 1 - gfx/layers/wr/WebRenderLayerManager.h | 2 +- gfx/layers/wr/WebRenderTypes.h | 2 +- gfx/moz.build | 2 +- gfx/webrender/Cargo.toml | 3 --- gfx/webrender/src/lib.rs | 7 ------- gfx/webrender_bindings/Cargo.toml | 19 ++++++++++++++++++ .../src/bindings.rs | 20 ++++++++----------- gfx/webrender_bindings/src/lib.rs | 20 +++++++++++++++++++ .../src}/webrender.h | 0 toolkit/library/gtest/rust/Cargo.lock | 17 +++++++++++++--- toolkit/library/rust/Cargo.lock | 17 +++++++++++++--- toolkit/library/rust/shared/Cargo.toml | 4 ++-- toolkit/library/rust/shared/lib.rs | 2 +- 17 files changed, 85 insertions(+), 39 deletions(-) create mode 100644 gfx/webrender_bindings/Cargo.toml rename gfx/{webrender => webrender_bindings}/src/bindings.rs (99%) create mode 100644 gfx/webrender_bindings/src/lib.rs rename gfx/{webrender => webrender_bindings/src}/webrender.h (100%) diff --git a/gfx/layers/ipc/PWebRenderBridge.ipdl b/gfx/layers/ipc/PWebRenderBridge.ipdl index 37deedd87460..6f8bc1ca78bd 100644 --- a/gfx/layers/ipc/PWebRenderBridge.ipdl +++ b/gfx/layers/ipc/PWebRenderBridge.ipdl @@ -10,7 +10,7 @@ include "mozilla/GfxMessageUtils.h"; include WebRenderMessages; include protocol PCompositorBridge; -using WRImageFormat from "webrender.h"; +using WRImageFormat from "mozilla/gfx/webrender.h"; using mozilla::gfx::ByteBuffer from "mozilla/layers/WebRenderTypes.h"; namespace mozilla { diff --git a/gfx/layers/ipc/WebRenderMessages.ipdlh b/gfx/layers/ipc/WebRenderMessages.ipdlh index 8672352c1700..3756ad83985e 100644 --- a/gfx/layers/ipc/WebRenderMessages.ipdlh +++ b/gfx/layers/ipc/WebRenderMessages.ipdlh @@ -5,8 +5,8 @@ * 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/. */ -using WRImageKey from "webrender.h"; -using WRRect from "webrender.h"; +using WRImageKey from "mozilla/gfx/webrender.h"; +using WRRect from "mozilla/gfx/webrender.h"; using MaybeImageMask from "mozilla/layers/WebRenderTypes.h"; using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h"; diff --git a/gfx/layers/wr/WebRenderColorLayer.cpp b/gfx/layers/wr/WebRenderColorLayer.cpp index 4280f342dccb..9c8752144b48 100644 --- a/gfx/layers/wr/WebRenderColorLayer.cpp +++ b/gfx/layers/wr/WebRenderColorLayer.cpp @@ -6,8 +6,8 @@ #include "WebRenderColorLayer.h" #include "LayersLogging.h" +#include "mozilla/gfx/webrender.h" #include "mozilla/layers/WebRenderBridgeChild.h" -#include "webrender.h" namespace mozilla { namespace layers { diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp index 564dfb8856c2..3d05c120ccdc 100644 --- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -18,7 +18,6 @@ #include "WebRenderContainerLayer.h" #include "WebRenderImageLayer.h" #include "WebRenderPaintedLayer.h" -#include "webrender.h" namespace mozilla { diff --git a/gfx/layers/wr/WebRenderLayerManager.h b/gfx/layers/wr/WebRenderLayerManager.h index e708948676cb..07049047a235 100644 --- a/gfx/layers/wr/WebRenderLayerManager.h +++ b/gfx/layers/wr/WebRenderLayerManager.h @@ -7,8 +7,8 @@ #define GFX_WEBRENDERLAYERMANAGER_H #include "Layers.h" +#include "mozilla/gfx/webrender.h" #include "mozilla/layers/CompositorController.h" -#include "webrender.h" class nsIWidget; diff --git a/gfx/layers/wr/WebRenderTypes.h b/gfx/layers/wr/WebRenderTypes.h index a51a6e850a11..791de8484289 100644 --- a/gfx/layers/wr/WebRenderTypes.h +++ b/gfx/layers/wr/WebRenderTypes.h @@ -7,8 +7,8 @@ #define GFX_BYTEBUFFER_H #include "chrome/common/ipc_message_utils.h" +#include "mozilla/gfx/webrender.h" #include "mozilla/Maybe.h" -#include "webrender.h" typedef mozilla::Maybe MaybeImageMask; diff --git a/gfx/moz.build b/gfx/moz.build index 645c3dbd795d..7c1214255f3e 100644 --- a/gfx/moz.build +++ b/gfx/moz.build @@ -24,7 +24,7 @@ DIRS += [ 'config', ] -EXPORTS += ['webrender/webrender.h'] +EXPORTS.mozilla.gfx += ['webrender_bindings/src/webrender.h'] if CONFIG['MOZ_ENABLE_SKIA']: DIRS += ['skia'] diff --git a/gfx/webrender/Cargo.toml b/gfx/webrender/Cargo.toml index b555d30a72bc..bee83ece6be7 100644 --- a/gfx/webrender/Cargo.toml +++ b/gfx/webrender/Cargo.toml @@ -36,13 +36,10 @@ freetype = {version = "0.1.2", default-features = false} [target.'cfg(target_os = "windows")'.dependencies] dwrote = "0.1.0" -kernel32-sys = "0.2" -winapi = "0.2.8" [target.'cfg(target_os = "macos")'.dependencies] core-graphics = "0.4.1" core-text = "2.0" -core-foundation = "0.2.2" [profile.release] panic = "abort" diff --git a/gfx/webrender/src/lib.rs b/gfx/webrender/src/lib.rs index 79bbe4a0f992..8749d776276c 100644 --- a/gfx/webrender/src/lib.rs +++ b/gfx/webrender/src/lib.rs @@ -71,7 +71,6 @@ mod spring; mod texture_cache; mod tiling; mod util; -pub mod bindings; mod shader_source { include!(concat!(env!("OUT_DIR"), "/shaders.rs")); @@ -105,18 +104,12 @@ pub mod renderer; extern crate core_graphics; #[cfg(target_os="macos")] extern crate core_text; -#[cfg(target_os="macos")] -extern crate core_foundation; #[cfg(all(unix, not(target_os="macos")))] extern crate freetype; #[cfg(target_os = "windows")] extern crate dwrote; -#[cfg(target_os="windows")] -extern crate kernel32; -#[cfg(target_os="windows")] -extern crate winapi; extern crate app_units; extern crate bincode; diff --git a/gfx/webrender_bindings/Cargo.toml b/gfx/webrender_bindings/Cargo.toml new file mode 100644 index 000000000000..e8bcaa9d4942 --- /dev/null +++ b/gfx/webrender_bindings/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "webrender_bindings" +version = "0.1.0" +authors = ["The Mozilla Project Developers"] +license = "MPL-2.0" + +[dependencies] +webrender = {path = "../webrender"} +webrender_traits = {path = "../webrender_traits"} +euclid = "0.10" +app_units = "0.3" +gleam = "0.2" + +[target.'cfg(target_os = "macos")'.dependencies] +core-foundation = "0.2.2" + +[target.'cfg(target_os = "windows")'.dependencies] +kernel32-sys = "0.2" +winapi = "0.2.8" diff --git a/gfx/webrender/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs similarity index 99% rename from gfx/webrender/src/bindings.rs rename to gfx/webrender_bindings/src/bindings.rs index 6fcd82e9a3cd..1ee0ff17259f 100644 --- a/gfx/webrender/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -1,17 +1,15 @@ use std::path::PathBuf; -use webrender_traits::{PipelineId, AuxiliaryListsBuilder}; -use renderer::{Renderer, RendererOptions}; -extern crate webrender_traits; - -use euclid::{Size2D, Point2D, Rect, Matrix4D}; -use gleam::gl; use std::ffi::CStr; +use std::{mem, slice}; +use std::os::raw::c_uchar; +use gleam::gl; +use euclid::{Size2D, Point2D, Rect, Matrix4D}; +use webrender_traits::{PipelineId, AuxiliaryListsBuilder}; use webrender_traits::{ServoScrollRootId}; use webrender_traits::{Epoch, ColorF}; use webrender_traits::{ImageData, ImageFormat, ImageKey, ImageMask, ImageRendering, RendererKind}; -use std::mem; -use std::slice; -use std::os::raw::c_uchar; +use webrender::renderer::{Renderer, RendererOptions}; +extern crate webrender_traits; #[cfg(target_os = "linux")] mod linux { @@ -473,8 +471,6 @@ pub extern fn wr_dp_push_image(state:&mut WrState, bounds: WrRect, clip : WrRect if state.frame_builder.dl_builder.is_empty() { return; } - - //let (width, height) = state.size; let bounds = bounds.to_rect(); let clip = clip.to_rect(); @@ -526,4 +522,4 @@ pub extern fn wr_free_buffer(vec_ptr: *mut c_uchar, length: u32, capacity: u32) unsafe { let rebuilt = Vec::from_raw_parts(vec_ptr, length as usize, capacity as usize); } -} \ No newline at end of file +} diff --git a/gfx/webrender_bindings/src/lib.rs b/gfx/webrender_bindings/src/lib.rs new file mode 100644 index 000000000000..aadcd8b998c8 --- /dev/null +++ b/gfx/webrender_bindings/src/lib.rs @@ -0,0 +1,20 @@ +/* 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/. */ + +extern crate webrender; +extern crate webrender_traits; +extern crate euclid; +extern crate app_units; +extern crate gleam; + +#[cfg(target_os="macos")] +extern crate core_foundation; + +#[cfg(target_os="windows")] +extern crate kernel32; +#[cfg(target_os="windows")] +extern crate winapi; + +#[allow(non_snake_case)] +pub mod bindings; diff --git a/gfx/webrender/webrender.h b/gfx/webrender_bindings/src/webrender.h similarity index 100% rename from gfx/webrender/webrender.h rename to gfx/webrender_bindings/src/webrender.h diff --git a/toolkit/library/gtest/rust/Cargo.lock b/toolkit/library/gtest/rust/Cargo.lock index 5baddabf5b37..afafdb21af53 100644 --- a/toolkit/library/gtest/rust/Cargo.lock +++ b/toolkit/library/gtest/rust/Cargo.lock @@ -185,7 +185,7 @@ dependencies = [ "mp4parse_capi 0.6.0", "nsstring 0.1.0", "rust_url_capi 0.0.1", - "webrender 0.10.0", + "webrender_bindings 0.1.0", ] [[package]] @@ -544,7 +544,6 @@ dependencies = [ "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "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.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -552,7 +551,6 @@ dependencies = [ "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", @@ -560,6 +558,19 @@ dependencies = [ "rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_traits 0.10.0", +] + +[[package]] +name = "webrender_bindings" +version = "0.1.0" +dependencies = [ + "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender 0.10.0", + "webrender_traits 0.10.0", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/toolkit/library/rust/Cargo.lock b/toolkit/library/rust/Cargo.lock index bef1f1610988..0db512ab265a 100644 --- a/toolkit/library/rust/Cargo.lock +++ b/toolkit/library/rust/Cargo.lock @@ -183,7 +183,7 @@ dependencies = [ "mp4parse_capi 0.6.0", "nsstring 0.1.0", "rust_url_capi 0.0.1", - "webrender 0.10.0", + "webrender_bindings 0.1.0", ] [[package]] @@ -531,7 +531,6 @@ dependencies = [ "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "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.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -539,7 +538,6 @@ dependencies = [ "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", @@ -547,6 +545,19 @@ dependencies = [ "rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_traits 0.10.0", +] + +[[package]] +name = "webrender_bindings" +version = "0.1.0" +dependencies = [ + "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender 0.10.0", + "webrender_traits 0.10.0", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/toolkit/library/rust/shared/Cargo.toml b/toolkit/library/rust/shared/Cargo.toml index 345ff5f958e5..c9290abbf38a 100644 --- a/toolkit/library/rust/shared/Cargo.toml +++ b/toolkit/library/rust/shared/Cargo.toml @@ -6,13 +6,13 @@ license = "MPL-2.0" description = "Shared Rust code for libxul" [features] -quantum_render = ["webrender"] +quantum_render = ["webrender_bindings"] [dependencies] mp4parse_capi = { path = "../../../../media/libstagefright/binding/mp4parse_capi" } nsstring = { path = "../../../../xpcom/rust/nsstring" } rust_url_capi = { path = "../../../../netwerk/base/rust-url-capi" } -webrender = { path = "../../../../gfx/webrender", optional = true } +webrender_bindings = { path = "../../../../gfx/webrender_bindings", optional = true } [lib] path = "lib.rs" diff --git a/toolkit/library/rust/shared/lib.rs b/toolkit/library/rust/shared/lib.rs index cf493ae49fb9..d7f30287505a 100644 --- a/toolkit/library/rust/shared/lib.rs +++ b/toolkit/library/rust/shared/lib.rs @@ -6,4 +6,4 @@ extern crate mp4parse_capi; extern crate nsstring; extern crate rust_url_capi; #[cfg(feature = "quantum_render")] -extern crate webrender; +extern crate webrender_bindings;