Bug 1403213 - Move nsstring into servo/support/gecko/nsstring, r=froydnj

MozReview-Commit-ID: FmKtJxSCdYc
This commit is contained in:
Nika Layzell 2017-10-20 12:04:30 -07:00 committed by Manish Goregaokar
parent 6e3d5384d5
commit a4927e2417
12 changed files with 34 additions and 48 deletions

View File

@ -12,5 +12,5 @@ parallel-utf8 = ["encoding_rs/parallel-utf8"]
[dependencies]
encoding_rs = "0.7.0"
nsstring = { path = "../../xpcom/rust/nsstring" }
nsstring = { path = "../../servo/support/gecko/nsstring" }
nserror = { path = "../../xpcom/rust/nserror" }

View File

@ -9,5 +9,5 @@ name = "rust_url_capi"
[dependencies]
libc = "0.2.0"
url = "1.5.1"
nsstring = { path = "../../../xpcom/rust/nsstring" }
nsstring = { path = "../../../servo/support/gecko/nsstring" }
nserror = { path = "../../../xpcom/rust/nserror" }

View File

@ -539,7 +539,7 @@ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"nsstring_vendor 0.1.0",
"nsstring 0.1.0",
"parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"servo_arc 0.0.1",
@ -883,13 +883,6 @@ dependencies = [
"nsstring 0.1.0",
]
[[package]]
name = "nsstring_vendor"
version = "0.1.0"
dependencies = [
"bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-integer"
version = "0.1.33"
@ -1276,7 +1269,7 @@ dependencies = [
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"nsstring_vendor 0.1.0",
"nsstring 0.1.0",
"num-integer 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -17,7 +17,7 @@ no-static-ideograph-encoder-tables = ["gkrust-shared/no-static-ideograph-encoder
[dependencies]
mp4parse-gtest = { path = "../../../../dom/media/gtest" }
nsstring-gtest = { path = "../../../../xpcom/rust/nsstring/gtest" }
nsstring-gtest = { path = "../../../../xpcom/rust/gtest/nsstring" }
gkrust-shared = { path = "../../rust/shared" }
[lib]

View File

@ -538,7 +538,7 @@ dependencies = [
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"nsstring_vendor 0.1.0",
"nsstring 0.1.0",
"parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"servo_arc 0.0.1",
@ -871,13 +871,6 @@ dependencies = [
"bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nsstring_vendor"
version = "0.1.0"
dependencies = [
"bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-integer"
version = "0.1.33"
@ -1268,7 +1261,7 @@ dependencies = [
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.0.1",
"matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"nsstring_vendor 0.1.0",
"nsstring 0.1.0",
"num-integer 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -8,7 +8,7 @@ description = "Shared Rust code for libxul"
[dependencies]
geckoservo = { path = "../../../../servo/ports/geckolib", optional = true }
mp4parse_capi = { path = "../../../../media/libstagefright/binding/mp4parse_capi" }
nsstring = { path = "../../../../xpcom/rust/nsstring" }
nsstring = { path = "../../../../servo/support/gecko/nsstring" }
nserror = { path = "../../../../xpcom/rust/nserror" }
rust_url_capi = { path = "../../../../netwerk/base/rust-url-capi" }
webrender_bindings = { path = "../../../../gfx/webrender_bindings", optional = true }
@ -32,7 +32,7 @@ servo = ["geckoservo"]
quantum_render = ["webrender_bindings"]
cubeb-remoting = ["cubeb-core", "cubeb", "cubeb-backend", "audioipc-client", "audioipc-server"]
cubeb_pulse_rust = ["cubeb-pulse"]
gecko_debug = ["geckoservo/gecko_debug"]
gecko_debug = ["geckoservo/gecko_debug", "nsstring/gecko_debug"]
simd-accel = ["encoding_c/simd-accel", "encoding_glue/simd-accel"]
no-static-ideograph-encoder-tables = ["encoding_c/no-static-ideograph-encoder-tables", "encoding_glue/no-static-ideograph-encoder-tables"]

View File

@ -30,8 +30,8 @@ if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_DEBUG']:
DIRS += ['windbgdlg']
TEST_DIRS += [
'rust/gtest',
'tests',
'rust/nsstring/gtest',
]
# Can't build internal xptcall tests that use symbols which are not exported.

View File

@ -6,4 +6,4 @@ license = "MPL-2.0"
description = "Rust bindings to xpcom nsresult and NS_ERROR_ values"
[dependencies]
nsstring = { path = "../nsstring" }
nsstring = { path = "../../../servo/support/gecko/nsstring" }

View File

@ -5,5 +5,8 @@ authors = ["nobody@mozilla.com"]
license = "MPL-2.0"
description = "Rust bindings to xpcom string types"
[features]
gecko_debug = []
[dependencies]
bitflags = "0.8"

View File

@ -6,7 +6,7 @@ license = "MPL-2.0"
description = "Tests for rust bindings to xpcom string types"
[dependencies]
nsstring = { path = "../" }
nsstring = { path = "../../../../servo/support/gecko/nsstring" }
[lib]
path = "test.rs"

View File

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
UNIFIED_SOURCES += [
'Test.cpp'
'nsstring/Test.cpp',
]
FINAL_LIBRARY = 'xul-gtest'

View File

@ -1,3 +1,7 @@
/* 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/. */
//! This module provides rust bindings for the XPCOM string types.
//!
//! # TL;DR (what types should I use)
@ -114,16 +118,16 @@
#[macro_use]
extern crate bitflags;
use std::ops::{Deref, DerefMut};
use std::marker::PhantomData;
use std::borrow;
use std::slice;
use std::mem;
use std::fmt;
use std::cmp;
use std::fmt;
use std::marker::PhantomData;
use std::mem;
use std::ops::{Deref, DerefMut};
use std::os::raw::c_void;
use std::slice;
use std::str;
use std::u32;
use std::os::raw::c_void;
///////////////////////////////////
// Internal Implementation Flags //
@ -134,7 +138,7 @@ mod data_flags {
// While this has the same layout as u16, it cannot be passed
// over FFI safely as a u16.
#[repr(C)]
pub flags DataFlags : u16 {
pub flags DataFlags: u16 {
const TERMINATED = 1 << 0, // IsTerminated returns true
const VOIDED = 1 << 1, // IsVoid returns true
const SHARED = 1 << 2, // mData points to a heap-allocated, shared buffer
@ -150,15 +154,15 @@ mod class_flags {
// While this has the same layout as u16, it cannot be passed
// over FFI safely as a u16.
#[repr(C)]
pub flags ClassFlags : u16 {
pub flags ClassFlags: u16 {
const INLINE = 1 << 0, // |this|'s buffer is inline
const NULL_TERMINATED = 1 << 1, // |this| requires its buffer is null-terminated
}
}
}
use data_flags::DataFlags;
use class_flags::ClassFlags;
use data_flags::DataFlags;
////////////////////////////////////
// Generic String Bindings Macros //
@ -1004,12 +1008,12 @@ impl cmp::PartialEq<str> for nsAString {
}
}
#[cfg(not(debug_assertions))]
#[cfg(not(feature = "gecko_debug"))]
#[allow(non_snake_case)]
unsafe fn Gecko_IncrementStringAdoptCount(_: *mut c_void) {}
extern "C" {
#[cfg(debug_assertions)]
#[cfg(feature = "gecko_debug")]
fn Gecko_IncrementStringAdoptCount(data: *mut c_void);
// Gecko implementation in nsSubstring.cpp
@ -1057,17 +1061,10 @@ pub mod test_helpers {
//! It is public to ensure that these testing functions are avaliable to
//! gtest code.
use super::{
nsCString,
nsString,
nsCStr,
nsStr,
nsCStringRepr,
nsStringRepr,
data_flags,
class_flags,
};
use std::mem;
use super::{class_flags, data_flags};
use super::{nsCStr, nsCString, nsCStringRepr};
use super::{nsStr, nsString, nsStringRepr};
/// Generates an #[no_mangle] extern "C" function which returns the size and
/// alignment of the given type with the given name.