Bug 1316223 - Moving binding to separate folder. r=jrmuizel,kats
authorMorris Tseng <mtseng@mozilla.com>
Fri, 18 Nov 2016 13:02:05 -0500
changeset 459794 5f62856653d3d5d25f5a76b15110c4ff53e5e3b0
parent 459793 c7a5966d7115cc01fbdae87390dafae5dacda68a
child 459795 c78b0565b19f65faca08b6c72b153c5bc2cad482
push id41343
push userkgupta@mozilla.com
push dateThu, 12 Jan 2017 20:13:44 +0000
reviewersjrmuizel, kats
bugs1316223
milestone53.0a1
Bug 1316223 - Moving binding to separate folder. r=jrmuizel,kats MozReview-Commit-ID: FLqSGebdGcH
gfx/layers/ipc/PWebRenderBridge.ipdl
gfx/layers/ipc/WebRenderMessages.ipdlh
gfx/layers/wr/WebRenderColorLayer.cpp
gfx/layers/wr/WebRenderLayerManager.cpp
gfx/layers/wr/WebRenderLayerManager.h
gfx/layers/wr/WebRenderTypes.h
gfx/moz.build
gfx/webrender/Cargo.toml
gfx/webrender/src/bindings.rs
gfx/webrender/src/lib.rs
gfx/webrender/webrender.h
gfx/webrender_bindings/Cargo.toml
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/src/lib.rs
gfx/webrender_bindings/src/webrender.h
toolkit/library/gtest/rust/Cargo.lock
toolkit/library/rust/Cargo.lock
toolkit/library/rust/shared/Cargo.toml
toolkit/library/rust/shared/lib.rs
--- a/gfx/layers/ipc/PWebRenderBridge.ipdl
+++ b/gfx/layers/ipc/PWebRenderBridge.ipdl
@@ -5,17 +5,17 @@
  * 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/. */
 
 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 {
 namespace layers {
 
 sync protocol PWebRenderBridge
 {
   manager PCompositorBridge;
--- a/gfx/layers/ipc/WebRenderMessages.ipdlh
+++ b/gfx/layers/ipc/WebRenderMessages.ipdlh
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: sw=2 ts=8 et :
  */
 /* 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/. */
 
-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";
 
 namespace mozilla {
 namespace layers {
 
 struct OpPushDLBuilder { };
 
--- a/gfx/layers/wr/WebRenderColorLayer.cpp
+++ b/gfx/layers/wr/WebRenderColorLayer.cpp
@@ -1,18 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
 #include "WebRenderColorLayer.h"
 
 #include "LayersLogging.h"
+#include "mozilla/gfx/webrender.h"
 #include "mozilla/layers/WebRenderBridgeChild.h"
-#include "webrender.h"
 
 namespace mozilla {
 namespace layers {
 
 void
 WebRenderColorLayer::RenderLayer()
 {
   WRScrollFrameStackingContextGenerator scrollFrames(this);
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/widget/PlatformWidgetTypes.h"
 #include "nsThreadUtils.h"
 #include "TreeTraversal.h"
 #include "WebRenderCanvasLayer.h"
 #include "WebRenderColorLayer.h"
 #include "WebRenderContainerLayer.h"
 #include "WebRenderImageLayer.h"
 #include "WebRenderPaintedLayer.h"
-#include "webrender.h"
 
 namespace mozilla {
 
 using namespace gfx;
 
 namespace layers {
 
 WebRenderLayerManager*
--- a/gfx/layers/wr/WebRenderLayerManager.h
+++ b/gfx/layers/wr/WebRenderLayerManager.h
@@ -2,18 +2,18 @@
  * 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/. */
 
 #ifndef GFX_WEBRENDERLAYERMANAGER_H
 #define GFX_WEBRENDERLAYERMANAGER_H
 
 #include "Layers.h"
+#include "mozilla/gfx/webrender.h"
 #include "mozilla/layers/CompositorController.h"
-#include "webrender.h"
 
 class nsIWidget;
 
 namespace mozilla {
 namespace layers {
 
 class WebRenderBridgeChild;
 
--- a/gfx/layers/wr/WebRenderTypes.h
+++ b/gfx/layers/wr/WebRenderTypes.h
@@ -2,18 +2,18 @@
  * 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/. */
 
 #ifndef GFX_BYTEBUFFER_H
 #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<WRImageMask> MaybeImageMask;
 
 namespace mozilla {
 namespace gfx {
 
 struct ByteBuffer
 {
--- a/gfx/moz.build
+++ b/gfx/moz.build
@@ -19,17 +19,17 @@ DIRS += [
     'harfbuzz/src',
     'ots/src',
     'thebes',
     'ipc',
     'vr',
     'config',
 ]
 
-EXPORTS += ['webrender/webrender.h']
+EXPORTS.mozilla.gfx += ['webrender_bindings/src/webrender.h']
 
 if CONFIG['MOZ_ENABLE_SKIA']:
     DIRS += ['skia']
 
 if CONFIG['ENABLE_TESTS']:
     DIRS += ['tests/gtest']
 
 TEST_DIRS += ['tests']
--- a/gfx/webrender/Cargo.toml
+++ b/gfx/webrender/Cargo.toml
@@ -31,19 +31,16 @@ bitflags = "0.7"
 [target.'cfg(target_os = "android")'.dependencies]
 freetype = "0.1.2"
 
 [target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
 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"
 debug = true
--- a/gfx/webrender/src/lib.rs
+++ b/gfx/webrender/src/lib.rs
@@ -66,17 +66,16 @@ mod profiler;
 mod record;
 mod render_backend;
 mod resource_cache;
 mod scene;
 mod spring;
 mod texture_cache;
 mod tiling;
 mod util;
-pub mod bindings;
 
 mod shader_source {
     include!(concat!(env!("OUT_DIR"), "/shaders.rs"));
 }
 
 mod platform {
     #[cfg(target_os="macos")]
     pub use platform::macos::font;
@@ -100,28 +99,22 @@ mod platform {
 }
 
 pub mod renderer;
 
 #[cfg(target_os="macos")]
 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;
 extern crate euclid;
 extern crate fnv;
 extern crate gleam;
 extern crate num_traits;
 //extern crate notify;
new file mode 100644
--- /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"
rename from gfx/webrender/src/bindings.rs
rename to gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1,22 +1,20 @@
 use std::path::PathBuf;
+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 renderer::{Renderer, RendererOptions};
-extern crate webrender_traits;
-
-use euclid::{Size2D, Point2D, Rect, Matrix4D};
-use gleam::gl;
-use std::ffi::CStr;
 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 {
     use std::mem;
     use std::os::raw::{c_void, c_char, c_int};
     use std::ffi::CString;
 
     //pub const RTLD_LAZY: c_int = 0x001;
@@ -468,18 +466,16 @@ impl WrRect
     }
 }
 
 #[no_mangle]
 pub extern fn wr_dp_push_image(state:&mut WrState, bounds: WrRect, clip : WrRect, mask: *const WrImageMask, key: ImageKey) {
     if state.frame_builder.dl_builder.is_empty() {
         return;
     }
-
-    //let (width, height) = state.size;
     let bounds = bounds.to_rect();
     let clip = clip.to_rect();
 
     // convert from the C type to the Rust type
     let mask = unsafe { mask.as_ref().map(|&WrImageMask{image, ref rect,repeat}| ImageMask{image: image, rect: rect.to_rect(), repeat: repeat}) };
 
     let clip_region = webrender_traits::ClipRegion::new(&clip,
                                                         Vec::new(),
@@ -521,9 +517,9 @@ pub extern fn wr_readback_buffer(width: 
 
 #[no_mangle]
 pub extern fn wr_free_buffer(vec_ptr: *mut c_uchar, length: u32, capacity: u32)
 {
     // note that vec_ptr loses its const here because we're doing unsafe things.
     unsafe {
         let rebuilt = Vec::from_raw_parts(vec_ptr, length as usize, capacity as usize);
     }
-}
\ No newline at end of file
+}
new file mode 100644
--- /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;
rename from gfx/webrender/webrender.h
rename to gfx/webrender_bindings/src/webrender.h
--- a/toolkit/library/gtest/rust/Cargo.lock
+++ b/toolkit/library/gtest/rust/Cargo.lock
@@ -180,17 +180,17 @@ dependencies = [
 
 [[package]]
 name = "gkrust-shared"
 version = "0.1.0"
 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]]
 name = "gl_generator"
 version = "0.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -539,32 +539,43 @@ dependencies = [
 name = "webrender"
 version = "0.10.0"
 dependencies = [
  "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
  "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
  "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
 ]
 
 [[package]]
 name = "webrender_traits"
 version = "0.10.0"
 dependencies = [
  "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
--- a/toolkit/library/rust/Cargo.lock
+++ b/toolkit/library/rust/Cargo.lock
@@ -178,17 +178,17 @@ dependencies = [
 
 [[package]]
 name = "gkrust-shared"
 version = "0.1.0"
 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]]
 name = "gl_generator"
 version = "0.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -526,32 +526,43 @@ dependencies = [
 name = "webrender"
 version = "0.10.0"
 dependencies = [
  "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
  "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
  "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "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)",
 ]
 
 [[package]]
 name = "webrender_traits"
 version = "0.10.0"
 dependencies = [
  "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
--- a/toolkit/library/rust/shared/Cargo.toml
+++ b/toolkit/library/rust/shared/Cargo.toml
@@ -1,23 +1,23 @@
 [package]
 name = "gkrust-shared"
 version = "0.1.0"
 authors = ["nobody@mozilla.org"]
 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"
 test = false
 doctest = false
 bench = false
 doc = false
 plugin = false
--- a/toolkit/library/rust/shared/lib.rs
+++ b/toolkit/library/rust/shared/lib.rs
@@ -1,9 +1,9 @@
 // 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 mp4parse_capi;
 extern crate nsstring;
 extern crate rust_url_capi;
 #[cfg(feature = "quantum_render")]
-extern crate webrender;
+extern crate webrender_bindings;