Removed
Link Here
|
1 |
Revert bug 1284816, bug 1341967, bug 1336153 to postpone bustage on non-x86 archs. |
2 |
|
3 |
diff --git browser/confvars.sh browser/confvars.sh |
4 |
index d8dcd99c2757..740d9d3e5fcf 100755 |
5 |
--- browser/confvars.sh |
6 |
+++ browser/confvars.sh |
7 |
@@ -30,6 +30,7 @@ if test "$OS_ARCH" = "WINNT"; then |
8 |
fi |
9 |
fi |
10 |
|
11 |
+MOZ_RUST_MP4PARSE=1 |
12 |
if test "$NIGHTLY_BUILD"; then |
13 |
MOZ_RUST_URLPARSE=1 |
14 |
fi |
15 |
diff --git build/moz.configure/rust.configure build/moz.configure/rust.configure |
16 |
index 267d989f1597..f709820e60ae 100644 |
17 |
--- build/moz.configure/rust.configure |
18 |
+++ build/moz.configure/rust.configure |
19 |
@@ -4,10 +4,20 @@ |
20 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
21 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
22 |
|
23 |
-# Rust is required by `rust_compiler` below. We allow_missing here |
24 |
-# to propagate failures to the better error message there. |
25 |
-rustc = check_prog('RUSTC', ['rustc'], allow_missing=True) |
26 |
-cargo = check_prog('CARGO', ['cargo'], allow_missing=True) |
27 |
+option('--disable-rust', help='Don\'t include Rust language sources') |
28 |
+ |
29 |
+@depends('--enable-rust') |
30 |
+def rust_compiler_names(value): |
31 |
+ if value: |
32 |
+ return ['rustc'] |
33 |
+ |
34 |
+@depends('--enable-rust') |
35 |
+def cargo_binary_names(value): |
36 |
+ if value: |
37 |
+ return ['cargo'] |
38 |
+ |
39 |
+rustc = check_prog('RUSTC', rust_compiler_names, allow_missing=True) |
40 |
+cargo = check_prog('CARGO', cargo_binary_names, allow_missing=True) |
41 |
|
42 |
@depends_if(rustc) |
43 |
@checking('rustc version', lambda info: info.version) |
44 |
@@ -43,9 +53,12 @@ def cargo_info(cargo): |
45 |
version=Version(version), |
46 |
) |
47 |
|
48 |
-@depends(rustc_info, cargo_info) |
49 |
+@depends('--enable-rust', rustc_info, cargo_info) |
50 |
@imports(_from='textwrap', _import='dedent') |
51 |
-def rust_compiler(rustc_info, cargo_info): |
52 |
+def rust_compiler(value, rustc_info, cargo_info): |
53 |
+ if not value: |
54 |
+ return None |
55 |
+ |
56 |
if not rustc_info: |
57 |
die(dedent('''\ |
58 |
Rust compiler not found. |
59 |
@@ -97,6 +110,9 @@ def rust_compiler(rustc_info, cargo_info): |
60 |
|
61 |
return True |
62 |
|
63 |
+set_define('MOZ_RUST', rust_compiler) |
64 |
+set_config('MOZ_RUST', rust_compiler) |
65 |
+ |
66 |
@template |
67 |
def rust_triple_alias(host_or_target): |
68 |
"""Template defining the alias used for rustc's --target flag. |
69 |
@@ -227,7 +243,8 @@ set_config('RUST_HOST_TARGET', rust_host_triple) |
70 |
|
71 |
@depends(rust_target_triple) |
72 |
def rust_target_env_name(triple): |
73 |
- return triple.upper().replace('-','_') |
74 |
+ if triple: |
75 |
+ return triple.upper().replace('-','_') |
76 |
|
77 |
# We need this to form various Cargo environment variables, as there is no |
78 |
# uppercase function in make, and we don't want to shell out just for |
79 |
@@ -235,5 +252,6 @@ def rust_target_env_name(triple): |
80 |
set_config('RUST_TARGET_ENV_NAME', rust_target_env_name) |
81 |
|
82 |
# Until we remove all the other Rust checks in old-configure. |
83 |
+add_old_configure_assignment('MOZ_RUST', rust_compiler) |
84 |
add_old_configure_assignment('RUSTC', rustc) |
85 |
add_old_configure_assignment('RUST_TARGET', rust_target_triple) |
86 |
diff --git config/rules.mk config/rules.mk |
87 |
index 94cc5556e3d0..7b143ebc5146 100644 |
88 |
--- config/rules.mk |
89 |
+++ config/rules.mk |
90 |
@@ -900,6 +900,7 @@ endif |
91 |
|
92 |
$(foreach file,$(DUMP_SYMS_TARGETS),$(eval $(call syms_template,$(file),$(file)_syms.track))) |
93 |
|
94 |
+ifdef MOZ_RUST |
95 |
cargo_host_flag := --target=$(RUST_HOST_TARGET) |
96 |
cargo_target_flag := --target=$(RUST_TARGET) |
97 |
|
98 |
@@ -1055,6 +1056,7 @@ force-cargo-host-program-build: |
99 |
|
100 |
$(HOST_RUST_PROGRAMS): force-cargo-host-program-build |
101 |
endif # HOST_RUST_PROGRAMS |
102 |
+endif # MOZ_RUST |
103 |
|
104 |
$(SOBJS): |
105 |
$(REPORT_BUILD) |
106 |
diff --git dom/media/MediaPrefs.h dom/media/MediaPrefs.h |
107 |
index 4dcc659222a4..559334d89fd1 100644 |
108 |
--- dom/media/MediaPrefs.h |
109 |
+++ dom/media/MediaPrefs.h |
110 |
@@ -183,7 +183,7 @@ private: |
111 |
DECL_MEDIA_PREF("media.ogg.flac.enabled", FlacInOgg, bool, false); |
112 |
DECL_MEDIA_PREF("media.flac.enabled", FlacEnabled, bool, true); |
113 |
|
114 |
-#if !defined(RELEASE_OR_BETA) |
115 |
+#if defined(MOZ_RUST_MP4PARSE) && !defined(RELEASE_OR_BETA) |
116 |
DECL_MEDIA_PREF("media.rust.test_mode", RustTestMode, bool, false); |
117 |
#endif |
118 |
|
119 |
diff --git dom/media/gtest/moz.build dom/media/gtest/moz.build |
120 |
index c66ac4a9437f..e2203c0a4321 100644 |
121 |
--- dom/media/gtest/moz.build |
122 |
+++ dom/media/gtest/moz.build |
123 |
@@ -22,7 +22,6 @@ UNIFIED_SOURCES += [ |
124 |
'TestMozPromise.cpp', |
125 |
'TestMP3Demuxer.cpp', |
126 |
'TestMP4Demuxer.cpp', |
127 |
- 'TestRust.cpp', |
128 |
'TestTrackEncoder.cpp', |
129 |
'TestVideoSegment.cpp', |
130 |
'TestVideoUtils.cpp', |
131 |
@@ -36,6 +35,9 @@ if CONFIG['MOZ_WEBM_ENCODER']: |
132 |
'TestWebMWriter.cpp', |
133 |
] |
134 |
|
135 |
+if CONFIG['MOZ_RUST']: |
136 |
+ UNIFIED_SOURCES += ['TestRust.cpp',] |
137 |
+ |
138 |
TEST_HARNESS_FILES.gtest += [ |
139 |
'../test/gizmo-frag.mp4', |
140 |
'../test/gizmo.mp4', |
141 |
diff --git media/libcubeb/src/moz.build media/libcubeb/src/moz.build |
142 |
index c65b53b80f63..8953f646e831 100644 |
143 |
--- media/libcubeb/src/moz.build |
144 |
+++ media/libcubeb/src/moz.build |
145 |
@@ -32,7 +32,8 @@ if CONFIG['MOZ_PULSEAUDIO']: |
146 |
'cubeb_pulse.c', |
147 |
] |
148 |
DEFINES['USE_PULSE'] = True |
149 |
- DEFINES['USE_PULSE_RUST'] = True |
150 |
+ if CONFIG['MOZ_RUST']: |
151 |
+ DEFINES['USE_PULSE_RUST'] = True |
152 |
|
153 |
if CONFIG['MOZ_JACK']: |
154 |
SOURCES += [ |
155 |
diff --git media/libstagefright/binding/DecoderData.cpp media/libstagefright/binding/DecoderData.cpp |
156 |
index 109ea329d154..a06e533b1e62 100644 |
157 |
--- media/libstagefright/binding/DecoderData.cpp |
158 |
+++ media/libstagefright/binding/DecoderData.cpp |
159 |
@@ -13,9 +13,11 @@ |
160 |
#include "mozilla/ArrayUtils.h" |
161 |
#include "include/ESDS.h" |
162 |
|
163 |
+#ifdef MOZ_RUST_MP4PARSE |
164 |
// OpusDecoder header is really needed only by MP4 in rust |
165 |
#include "OpusDecoder.h" |
166 |
#include "mp4parse.h" |
167 |
+#endif // MOZ_RUST_MP4PARSE |
168 |
|
169 |
using namespace stagefright; |
170 |
using mozilla::media::TimeUnit; |
171 |
@@ -177,6 +179,7 @@ MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType) |
172 |
FindData(aMetaData, kKeyAVCC, mExtraData); |
173 |
} |
174 |
|
175 |
+#ifdef MOZ_RUST_MP4PARSE |
176 |
static void |
177 |
UpdateTrackProtectedInfo(mozilla::TrackInfo& aConfig, |
178 |
const mp4parse_sinf_info& aSinf) |
179 |
@@ -263,6 +266,7 @@ MP4VideoInfo::Update(const mp4parse_track_info* track, |
180 |
mExtraData->AppendElements(video->extra_data.data, video->extra_data.length); |
181 |
} |
182 |
} |
183 |
+#endif // MOZ_RUST_MP4PARSE |
184 |
|
185 |
bool |
186 |
MP4VideoInfo::IsValid() const |
187 |
diff --git media/libstagefright/binding/MP4Metadata.cpp media/libstagefright/binding/MP4Metadata.cpp |
188 |
index 5c3810d99a38..5d14dfd8b8a9 100644 |
189 |
--- media/libstagefright/binding/MP4Metadata.cpp |
190 |
+++ media/libstagefright/binding/MP4Metadata.cpp |
191 |
@@ -20,14 +20,18 @@ |
192 |
#include "mp4_demuxer/MP4Metadata.h" |
193 |
#include "mp4_demuxer/Stream.h" |
194 |
#include "MediaPrefs.h" |
195 |
+#ifdef MOZ_RUST_MP4PARSE |
196 |
#include "mp4parse.h" |
197 |
+#endif // MOZ_RUST_MP4PARSE |
198 |
|
199 |
#include <limits> |
200 |
#include <stdint.h> |
201 |
#include <vector> |
202 |
|
203 |
|
204 |
+#ifdef MOZ_RUST_MP4PARSE |
205 |
struct FreeMP4Parser { void operator()(mp4parse_parser* aPtr) { mp4parse_free(aPtr); } }; |
206 |
+#endif // MOZ_RUST_MP4PARSE |
207 |
|
208 |
using namespace stagefright; |
209 |
using mozilla::media::TimeUnit; |
210 |
@@ -105,6 +109,7 @@ private: |
211 |
bool mCanSeek; |
212 |
}; |
213 |
|
214 |
+#ifdef MOZ_RUST_MP4PARSE |
215 |
// Wrap an mp4_demuxer::Stream to remember the read offset. |
216 |
|
217 |
class RustStreamAdaptor { |
218 |
@@ -151,6 +156,7 @@ private: |
219 |
RustStreamAdaptor mRustSource; |
220 |
mozilla::UniquePtr<mp4parse_parser, FreeMP4Parser> mRustParser; |
221 |
}; |
222 |
+#endif // MOZ_RUST_MP4PARSE |
223 |
|
224 |
class IndiceWrapperStagefright : public IndiceWrapper { |
225 |
public: |
226 |
@@ -187,6 +193,7 @@ IndiceWrapperStagefright::GetIndice(size_t aIndex, Index::Indice& aIndice) const |
227 |
return true; |
228 |
} |
229 |
|
230 |
+#ifdef MOZ_RUST_MP4PARSE |
231 |
// the owner of mIndice is rust mp4 paser, so lifetime of this class |
232 |
// SHOULD NOT longer than rust parser. |
233 |
class IndiceWrapperRust : public IndiceWrapper |
234 |
@@ -232,9 +239,11 @@ IndiceWrapperRust::GetIndice(size_t aIndex, Index::Indice& aIndice) const |
235 |
aIndice.sync = indice->sync; |
236 |
return true; |
237 |
} |
238 |
+#endif // MOZ_RUST_MP4PARSE |
239 |
|
240 |
MP4Metadata::MP4Metadata(Stream* aSource) |
241 |
: mStagefright(MakeUnique<MP4MetadataStagefright>(aSource)) |
242 |
+#ifdef MOZ_RUST_MP4PARSE |
243 |
, mRust(MakeUnique<MP4MetadataRust>(aSource)) |
244 |
, mPreferRust(MediaPrefs::EnableRustMP4Parser()) |
245 |
, mReportedAudioTrackTelemetry(false) |
246 |
@@ -242,6 +251,7 @@ MP4Metadata::MP4Metadata(Stream* aSource) |
247 |
#ifndef RELEASE_OR_BETA |
248 |
, mRustTestMode(MediaPrefs::RustTestMode()) |
249 |
#endif |
250 |
+#endif // MOZ_RUST_MP4PARSE |
251 |
{ |
252 |
} |
253 |
|
254 |
@@ -274,8 +284,11 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const |
255 |
MP4Metadata::ResultAndTrackCount numTracks = |
256 |
mStagefright->GetNumberTracks(aType); |
257 |
|
258 |
+#ifdef MOZ_RUST_MP4PARSE |
259 |
if (!mRust) { |
260 |
+#endif // MOZ_RUST_MP4PARSE |
261 |
return numTracks; |
262 |
+#ifdef MOZ_RUST_MP4PARSE |
263 |
} |
264 |
|
265 |
MP4Metadata::ResultAndTrackCount numTracksRust = |
266 |
@@ -350,8 +363,10 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const |
267 |
// Same non-error numbers, just return any. |
268 |
// (Choosing Rust here, in case it carries a warning, we'd want to know that.) |
269 |
return numTracksRust; |
270 |
+#endif // MOZ_RUST_MP4PARSE |
271 |
} |
272 |
|
273 |
+#ifdef MOZ_RUST_MP4PARSE |
274 |
bool MP4Metadata::ShouldPreferRust() const { |
275 |
if (!mRust) { |
276 |
return false; |
277 |
@@ -389,6 +404,7 @@ bool MP4Metadata::ShouldPreferRust() const { |
278 |
// Otherwise, fall back. |
279 |
return false; |
280 |
} |
281 |
+#endif // MOZ_RUST_MP4PARSE |
282 |
|
283 |
static const char* |
284 |
GetDifferentField(const mozilla::TrackInfo& info, |
285 |
@@ -443,6 +459,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, |
286 |
MP4Metadata::ResultAndTrackInfo info = |
287 |
mStagefright->GetTrackInfo(aType, aTrackNumber); |
288 |
|
289 |
+#ifdef MOZ_RUST_MP4PARSE |
290 |
if (!mRust) { |
291 |
return info; |
292 |
} |
293 |
@@ -514,6 +531,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType, |
294 |
if (mPreferRust) { |
295 |
return infoRust; |
296 |
} |
297 |
+#endif // MOZ_RUST_MP4PARSE |
298 |
|
299 |
return info; |
300 |
} |
301 |
@@ -528,6 +546,7 @@ MP4Metadata::ResultAndCryptoFile |
302 |
MP4Metadata::Crypto() const |
303 |
{ |
304 |
MP4Metadata::ResultAndCryptoFile crypto = mStagefright->Crypto(); |
305 |
+#ifdef MOZ_RUST_MP4PARSE |
306 |
MP4Metadata::ResultAndCryptoFile rustCrypto = mRust->Crypto(); |
307 |
|
308 |
#ifndef RELEASE_OR_BETA |
309 |
@@ -548,6 +567,7 @@ MP4Metadata::Crypto() const |
310 |
if (mPreferRust) { |
311 |
return rustCrypto; |
312 |
} |
313 |
+#endif // MOZ_RUST_MP4PARSE |
314 |
|
315 |
return crypto; |
316 |
} |
317 |
@@ -556,17 +576,22 @@ MP4Metadata::ResultAndIndice |
318 |
MP4Metadata::GetTrackIndice(mozilla::TrackID aTrackID) |
319 |
{ |
320 |
FallibleTArray<Index::Indice> indiceSF; |
321 |
+#ifdef MOZ_RUST_MP4PARSE |
322 |
if (!mPreferRust |
323 |
#ifndef RELEASE_OR_BETA |
324 |
|| mRustTestMode |
325 |
#endif |
326 |
) { |
327 |
+#endif // MOZ_RUST_MP4PARSE |
328 |
MediaResult rv = mStagefright->ReadTrackIndex(indiceSF, aTrackID); |
329 |
if (NS_FAILED(rv)) { |
330 |
return {Move(rv), nullptr}; |
331 |
} |
332 |
+#ifdef MOZ_RUST_MP4PARSE |
333 |
} |
334 |
+#endif // MOZ_RUST_MP4PARSE |
335 |
|
336 |
+#ifdef MOZ_RUST_MP4PARSE |
337 |
mp4parse_byte_data indiceRust = {}; |
338 |
if (mPreferRust |
339 |
#ifndef RELEASE_OR_BETA |
340 |
@@ -592,13 +617,18 @@ MP4Metadata::GetTrackIndice(mozilla::TrackID aTrackID) |
341 |
} |
342 |
} |
343 |
#endif |
344 |
+#endif // MOZ_RUST_MP4PARSE |
345 |
|
346 |
UniquePtr<IndiceWrapper> indice; |
347 |
+#ifdef MOZ_RUST_MP4PARSE |
348 |
if (mPreferRust) { |
349 |
indice = mozilla::MakeUnique<IndiceWrapperRust>(indiceRust); |
350 |
} else { |
351 |
+#endif // MOZ_RUST_MP4PARSE |
352 |
indice = mozilla::MakeUnique<IndiceWrapperStagefright>(indiceSF); |
353 |
+#ifdef MOZ_RUST_MP4PARSE |
354 |
} |
355 |
+#endif // MOZ_RUST_MP4PARSE |
356 |
|
357 |
return {NS_OK, Move(indice)}; |
358 |
} |
359 |
@@ -856,6 +886,7 @@ MP4MetadataStagefright::Metadata(Stream* aSource) |
360 |
return {NS_OK, Move(buffer)}; |
361 |
} |
362 |
|
363 |
+#ifdef MOZ_RUST_MP4PARSE |
364 |
bool |
365 |
RustStreamAdaptor::Read(uint8_t* buffer, uintptr_t size, size_t* bytes_read) |
366 |
{ |
367 |
@@ -1152,5 +1183,6 @@ MP4MetadataRust::Metadata(Stream* aSource) |
368 |
MOZ_ASSERT(false, "Not yet implemented"); |
369 |
return {NS_ERROR_NOT_IMPLEMENTED, nullptr}; |
370 |
} |
371 |
+#endif // MOZ_RUST_MP4PARSE |
372 |
|
373 |
} // namespace mp4_demuxer |
374 |
diff --git media/libstagefright/binding/include/mp4_demuxer/DecoderData.h media/libstagefright/binding/include/mp4_demuxer/DecoderData.h |
375 |
index 3cd4b7c142f4..dc25ddf03b10 100644 |
376 |
--- media/libstagefright/binding/include/mp4_demuxer/DecoderData.h |
377 |
+++ media/libstagefright/binding/include/mp4_demuxer/DecoderData.h |
378 |
@@ -19,11 +19,13 @@ namespace stagefright |
379 |
class MetaData; |
380 |
} |
381 |
|
382 |
+#ifdef MOZ_RUST_MP4PARSE |
383 |
extern "C" { |
384 |
typedef struct mp4parse_track_info mp4parse_track_info; |
385 |
typedef struct mp4parse_track_audio_info mp4parse_track_audio_info; |
386 |
typedef struct mp4parse_track_video_info mp4parse_track_video_info; |
387 |
} |
388 |
+#endif // MOZ_RUST_MP4PARSE |
389 |
|
390 |
namespace mp4_demuxer |
391 |
{ |
392 |
@@ -71,8 +73,10 @@ public: |
393 |
void Update(const stagefright::MetaData* aMetaData, |
394 |
const char* aMimeType); |
395 |
|
396 |
+#ifdef MOZ_RUST_MP4PARSE |
397 |
void Update(const mp4parse_track_info* track, |
398 |
const mp4parse_track_audio_info* audio); |
399 |
+#endif // MOZ_RUST_MP4PARSE |
400 |
|
401 |
virtual bool IsValid() const override; |
402 |
}; |
403 |
@@ -85,8 +89,10 @@ public: |
404 |
void Update(const stagefright::MetaData* aMetaData, |
405 |
const char* aMimeType); |
406 |
|
407 |
+#ifdef MOZ_RUST_MP4PARSE |
408 |
void Update(const mp4parse_track_info* track, |
409 |
const mp4parse_track_video_info* video); |
410 |
+#endif // MOZ_RUST_MP4PARSE |
411 |
|
412 |
virtual bool IsValid() const override; |
413 |
}; |
414 |
diff --git media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h |
415 |
index 492c9c1c1bc3..e16dbbd1155e 100644 |
416 |
--- media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h |
417 |
+++ media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h |
418 |
@@ -13,7 +13,9 @@ |
419 |
#include "MediaInfo.h" |
420 |
#include "MediaResult.h" |
421 |
#include "Stream.h" |
422 |
+#ifdef MOZ_RUST_MP4PARSE |
423 |
#include "mp4parse.h" |
424 |
+#endif // MOZ_RUST_MP4PARSE |
425 |
|
426 |
namespace mp4_demuxer { |
427 |
|
428 |
@@ -82,6 +84,7 @@ public: |
429 |
|
430 |
private: |
431 |
UniquePtr<MP4MetadataStagefright> mStagefright; |
432 |
+#ifdef MOZ_RUST_MP4PARSE |
433 |
UniquePtr<MP4MetadataRust> mRust; |
434 |
mutable bool mPreferRust; |
435 |
mutable bool mReportedAudioTrackTelemetry; |
436 |
@@ -90,6 +93,7 @@ private: |
437 |
mutable bool mRustTestMode; |
438 |
#endif |
439 |
bool ShouldPreferRust() const; |
440 |
+#endif // MOZ_RUST_MP4PARSE |
441 |
}; |
442 |
|
443 |
} // namespace mp4_demuxer |
444 |
diff --git media/libstagefright/gtest/moz.build media/libstagefright/gtest/moz.build |
445 |
index be4d56fc93f7..66fdd365f8f3 100644 |
446 |
--- media/libstagefright/gtest/moz.build |
447 |
+++ media/libstagefright/gtest/moz.build |
448 |
@@ -38,12 +38,13 @@ TEST_HARNESS_FILES.gtest += [ |
449 |
'test_case_1351094.mp4', |
450 |
] |
451 |
|
452 |
-UNIFIED_SOURCES += ['TestMP4Rust.cpp',] |
453 |
-TEST_HARNESS_FILES.gtest += [ |
454 |
- '../../../dom/media/test/street.mp4', |
455 |
-] |
456 |
-LOCAL_INCLUDES += [ |
457 |
- '../binding/include', |
458 |
-] |
459 |
+if CONFIG['MOZ_RUST']: |
460 |
+ UNIFIED_SOURCES += ['TestMP4Rust.cpp',] |
461 |
+ TEST_HARNESS_FILES.gtest += [ |
462 |
+ '../../../dom/media/test/street.mp4', |
463 |
+ ] |
464 |
+ LOCAL_INCLUDES += [ |
465 |
+ '../binding/include', |
466 |
+ ] |
467 |
|
468 |
FINAL_LIBRARY = 'xul-gtest' |
469 |
diff --git media/libstagefright/moz.build media/libstagefright/moz.build |
470 |
index af5d1194d621..6725a0179989 100644 |
471 |
--- media/libstagefright/moz.build |
472 |
+++ media/libstagefright/moz.build |
473 |
@@ -83,9 +83,10 @@ SOURCES += [ |
474 |
'system/core/libutils/VectorImpl.cpp', |
475 |
] |
476 |
|
477 |
-EXPORTS += [ |
478 |
- 'binding/include/mp4parse.h', |
479 |
-] |
480 |
+if CONFIG['MOZ_RUST']: |
481 |
+ EXPORTS += [ |
482 |
+ 'binding/include/mp4parse.h', |
483 |
+ ] |
484 |
|
485 |
UNIFIED_SOURCES += [ |
486 |
'binding/Adts.cpp', |
487 |
diff --git mobile/android/confvars.sh mobile/android/confvars.sh |
488 |
index e79b6f5c0707..eb62763acaf7 100644 |
489 |
--- mobile/android/confvars.sh |
490 |
+++ mobile/android/confvars.sh |
491 |
@@ -30,6 +30,8 @@ MOZ_XULRUNNER= |
492 |
MOZ_CAPTURE=1 |
493 |
MOZ_RAW=1 |
494 |
|
495 |
+MOZ_RUST_MP4PARSE=1 |
496 |
+ |
497 |
# use custom widget for html:select |
498 |
MOZ_USE_NATIVE_POPUP_WINDOWS=1 |
499 |
|
500 |
diff --git netwerk/base/moz.build netwerk/base/moz.build |
501 |
index 61d022a9660e..e5ca1d77d859 100644 |
502 |
--- netwerk/base/moz.build |
503 |
+++ netwerk/base/moz.build |
504 |
@@ -256,7 +256,7 @@ UNIFIED_SOURCES += [ |
505 |
'TLSServerSocket.cpp', |
506 |
] |
507 |
|
508 |
-if CONFIG['MOZ_RUST_URLPARSE']: |
509 |
+if CONFIG['MOZ_RUST'] and CONFIG['MOZ_RUST_URLPARSE']: |
510 |
EXPORTS.mozilla.net += [ 'RustURL.h' ] |
511 |
UNIFIED_SOURCES += [ 'RustURL.cpp' ] |
512 |
|
513 |
diff --git netwerk/base/nsStandardURL.cpp netwerk/base/nsStandardURL.cpp |
514 |
index 608b918a4ecf..20bcdeb34ab8 100644 |
515 |
--- netwerk/base/nsStandardURL.cpp |
516 |
+++ netwerk/base/nsStandardURL.cpp |
517 |
@@ -858,6 +858,7 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) |
518 |
if (!SegmentIs(spec, mScheme, "resource") && |
519 |
!SegmentIs(spec, mScheme, "chrome")) { |
520 |
nsAutoCString ipString; |
521 |
+#ifdef MOZ_RUST |
522 |
if (encHost.Length() > 0 && |
523 |
encHost.First() == '[' && encHost.Last() == ']' && |
524 |
ValidIPv6orHostname(encHost.get(), encHost.Length())) { |
525 |
@@ -866,7 +867,9 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) |
526 |
return rv; |
527 |
} |
528 |
encHost = ipString; |
529 |
- } else if (NS_SUCCEEDED(NormalizeIPv4(encHost, ipString))) { |
530 |
+ } else |
531 |
+#endif |
532 |
+ if (NS_SUCCEEDED(NormalizeIPv4(encHost, ipString))) { |
533 |
encHost = ipString; |
534 |
} |
535 |
} |
536 |
@@ -2112,6 +2115,7 @@ nsStandardURL::SetHost(const nsACString &input) |
537 |
|
538 |
if (!SegmentIs(mScheme, "resource") && !SegmentIs(mScheme, "chrome")) { |
539 |
nsAutoCString ipString; |
540 |
+#ifdef MOZ_RUST |
541 |
if (hostBuf.Length() > 0 && |
542 |
hostBuf.First() == '[' && hostBuf.Last() == ']' && |
543 |
ValidIPv6orHostname(hostBuf.get(), hostBuf.Length())) { |
544 |
@@ -2120,7 +2124,9 @@ nsStandardURL::SetHost(const nsACString &input) |
545 |
return rv; |
546 |
} |
547 |
hostBuf = ipString; |
548 |
- } else if (NS_SUCCEEDED(NormalizeIPv4(hostBuf, ipString))) { |
549 |
+ } else |
550 |
+#endif |
551 |
+ if (NS_SUCCEEDED(NormalizeIPv4(hostBuf, ipString))) { |
552 |
hostBuf = ipString; |
553 |
} |
554 |
} |
555 |
diff --git old-configure.in old-configure.in |
556 |
index 717a94fcc692..54b29d737cc1 100644 |
557 |
--- old-configure.in |
558 |
+++ old-configure.in |
559 |
@@ -2330,9 +2330,14 @@ if test -n "$MOZ_MULET"; then |
560 |
fi |
561 |
|
562 |
# Propagate feature switches for code written in rust from confvars.sh |
563 |
-if test -n "$MOZ_RUST_URLPARSE"; then |
564 |
- AC_DEFINE(MOZ_RUST_URLPARSE) |
565 |
- AC_SUBST(MOZ_RUST_URLPARSE) |
566 |
+if test -n "$MOZ_RUST"; then |
567 |
+ if test -n "$MOZ_RUST_MP4PARSE"; then |
568 |
+ AC_DEFINE(MOZ_RUST_MP4PARSE) |
569 |
+ fi |
570 |
+ if test -n "$MOZ_RUST_URLPARSE"; then |
571 |
+ AC_DEFINE(MOZ_RUST_URLPARSE) |
572 |
+ AC_SUBST(MOZ_RUST_URLPARSE) |
573 |
+ fi |
574 |
fi |
575 |
|
576 |
AC_SUBST(MOZ_PHOENIX) |
577 |
diff --git toolkit/components/telemetry/Histograms.json toolkit/components/telemetry/Histograms.json |
578 |
index 061c55f6a5b6..e49dfd176952 100644 |
579 |
--- toolkit/components/telemetry/Histograms.json |
580 |
+++ toolkit/components/telemetry/Histograms.json |
581 |
@@ -8320,7 +8320,8 @@ |
582 |
"expires_in_version": "60", |
583 |
"kind": "boolean", |
584 |
"bug_numbers": [1220885], |
585 |
- "description": "Whether the rust mp4 demuxer successfully parsed a stream segment." |
586 |
+ "description": "Whether the rust mp4 demuxer successfully parsed a stream segment.", |
587 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
588 |
}, |
589 |
"MEDIA_RUST_MP4PARSE_ERROR_CODE": { |
590 |
"record_in_processes": ["main", "content"], |
591 |
@@ -8329,7 +8330,8 @@ |
592 |
"kind": "enumerated", |
593 |
"n_values": 32, |
594 |
"bug_numbers": [1238420], |
595 |
- "description": "The error code reported when an MP4 parse attempt has failed.0 = OK, 1 = bad argument, 2 = invalid data, 3 = unsupported, 4 = unexpected end of file, 5 = read error." |
596 |
+ "description": "The error code reported when an MP4 parse attempt has failed.0 = OK, 1 = bad argument, 2 = invalid data, 3 = unsupported, 4 = unexpected end of file, 5 = read error.", |
597 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
598 |
}, |
599 |
"MEDIA_RUST_MP4PARSE_TRACK_MATCH_AUDIO": { |
600 |
"record_in_processes": ["main", "content"], |
601 |
@@ -8337,7 +8339,8 @@ |
602 |
"expires_in_version": "60", |
603 |
"kind": "boolean", |
604 |
"bug_numbers": [1231169], |
605 |
- "description": "Whether rust and stagefight mp4 parser audio track results match." |
606 |
+ "description": "Whether rust and stagefight mp4 parser audio track results match.", |
607 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
608 |
}, |
609 |
"MEDIA_RUST_MP4PARSE_TRACK_MATCH_VIDEO": { |
610 |
"record_in_processes": ["main", "content"], |
611 |
@@ -8345,7 +8348,8 @@ |
612 |
"expires_in_version": "60", |
613 |
"kind": "boolean", |
614 |
"bug_numbers": [1231169], |
615 |
- "description": "Whether rust and stagefight mp4 parser video track results match." |
616 |
+ "description": "Whether rust and stagefight mp4 parser video track results match.", |
617 |
+ "cpp_guard": "MOZ_RUST_MP4PARSE" |
618 |
}, |
619 |
"MEDIA_WMF_DECODE_ERROR": { |
620 |
"record_in_processes": ["main", "content", "gpu"], |
621 |
diff --git toolkit/library/gtest/moz.build toolkit/library/gtest/moz.build |
622 |
index 69a8fb1f4893..c684f48e456e 100644 |
623 |
--- toolkit/library/gtest/moz.build |
624 |
+++ toolkit/library/gtest/moz.build |
625 |
@@ -7,7 +7,6 @@ |
626 |
FINAL_TARGET = 'dist/bin/gtest' |
627 |
|
628 |
USE_LIBS += [ |
629 |
- 'gkrust-gtest', |
630 |
'static:xul', |
631 |
# xul-gtest is an intermediate static library. It is used as FINAL_TARGET |
632 |
# for gtest code. |
633 |
@@ -21,6 +20,11 @@ USE_LIBS += [ |
634 |
# before StaticXULComponentStart. |
635 |
Libxul('xul-gtest-real') |
636 |
|
637 |
+if CONFIG['MOZ_RUST']: |
638 |
+ USE_LIBS += [ |
639 |
+ 'gkrust-gtest', |
640 |
+ ] |
641 |
+ |
642 |
DIRS += [ |
643 |
'static', |
644 |
] |
645 |
diff --git toolkit/library/moz.build toolkit/library/moz.build |
646 |
index 650f6eaba980..191e90ceb09a 100644 |
647 |
--- toolkit/library/moz.build |
648 |
+++ toolkit/library/moz.build |
649 |
@@ -63,7 +63,7 @@ def Libxul(name): |
650 |
|
651 |
# This option should go away in bug 1290972, but we need to wait until |
652 |
# Rust 1.12 has been released. |
653 |
- if CONFIG['OS_ARCH'] == 'Darwin': |
654 |
+ if CONFIG['MOZ_RUST'] and CONFIG['OS_ARCH'] == 'Darwin': |
655 |
LDFLAGS += ['-Wl,-no_compact_unwind'] |
656 |
|
657 |
Libxul('xul') |
658 |
@@ -343,4 +343,5 @@ USE_LIBS += ['StaticXULComponentsEnd'] |
659 |
# The above library needs to be last for C++ purposes. This library, |
660 |
# however, is entirely composed of Rust code, and needs to come after |
661 |
# all the C++ code so any possible C++ -> Rust calls can be resolved. |
662 |
-USE_LIBS += ['gkrust'] |
663 |
+if CONFIG['MOZ_RUST']: |
664 |
+ USE_LIBS += ['gkrust'] |
665 |
diff --git toolkit/moz.configure toolkit/moz.configure |
666 |
index ac9d123224ce..e90da70f0fa5 100644 |
667 |
--- toolkit/moz.configure |
668 |
+++ toolkit/moz.configure |
669 |
@@ -88,8 +88,7 @@ include('../js/moz.configure') |
670 |
|
671 |
# Rust |
672 |
# ============================================================== |
673 |
-include('../build/moz.configure/rust.configure', |
674 |
- when='--enable-compile-environment') |
675 |
+include('../build/moz.configure/rust.configure') |
676 |
|
677 |
|
678 |
# L10N |
679 |
@@ -623,13 +622,13 @@ id_and_secret_keyfile('Leanplum SDK') |
680 |
option('--enable-stylo', nargs='?', choices=('build',), |
681 |
help='Include Stylo in the build and/or enable it at runtime') |
682 |
|
683 |
-@depends('--enable-stylo') |
684 |
-def stylo_config(value): |
685 |
+@depends('--enable-stylo', '--enable-rust') |
686 |
+def stylo_config(value, rust_enabled): |
687 |
build_stylo = None |
688 |
enable_stylo = None |
689 |
|
690 |
# The default is to not build Stylo at all. |
691 |
- if value.origin == 'default': |
692 |
+ if not rust_enabled or value.origin == 'default': |
693 |
pass |
694 |
elif value == 'build': |
695 |
build_stylo = True |
696 |
@@ -769,12 +768,14 @@ set_config('SERVO_TARGET_DIR', servo_target_dir) |
697 |
option('--enable-webrender', nargs='?', choices=('build',), |
698 |
help='Include WebRender in the build and/or enable it at runtime') |
699 |
|
700 |
-@depends('--enable-webrender', milestone) |
701 |
-def webrender(value, milestone): |
702 |
+@depends('--enable-webrender', '--enable-rust', milestone) |
703 |
+def webrender(value, rust_enabled, milestone): |
704 |
build_webrender = None |
705 |
enable_webrender = None |
706 |
|
707 |
- if value.origin == 'default': |
708 |
+ if not rust_enabled: |
709 |
+ pass |
710 |
+ elif value.origin == 'default': |
711 |
# if nothing is specified, default to just building on Nightly |
712 |
build_webrender = milestone.is_nightly |
713 |
elif value == 'build': |
714 |
diff --git toolkit/toolkit.mozbuild toolkit/toolkit.mozbuild |
715 |
index b845aab48023..9215afc6dd2d 100644 |
716 |
--- toolkit/toolkit.mozbuild |
717 |
+++ toolkit/toolkit.mozbuild |
718 |
@@ -133,16 +133,23 @@ if CONFIG['MOZ_PREF_EXTENSIONS']: |
719 |
|
720 |
DIRS += [ |
721 |
'/devtools', |
722 |
- '/toolkit/library', |
723 |
- '/toolkit/library/gtest/rust', |
724 |
- '/toolkit/library/rust', |
725 |
- '/toolkit/library/StaticXULComponentsEnd', |
726 |
'/services', |
727 |
'/startupcache', |
728 |
'/js/ductwork/debugger', |
729 |
'/other-licenses/snappy', |
730 |
] |
731 |
|
732 |
+if CONFIG['MOZ_RUST']: |
733 |
+ DIRS += [ |
734 |
+ '/toolkit/library/gtest/rust', |
735 |
+ '/toolkit/library/rust', |
736 |
+ ] |
737 |
+ |
738 |
+DIRS += [ |
739 |
+ '/toolkit/library/StaticXULComponentsEnd', |
740 |
+ '/toolkit/library', |
741 |
+] |
742 |
+ |
743 |
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: |
744 |
DIRS += ['/toolkit/system/gnome'] |
745 |
|
746 |
diff --git toolkit/xre/nsAppRunner.cpp toolkit/xre/nsAppRunner.cpp |
747 |
index 667c2eb1b365..6fb6cf102baa 100644 |
748 |
--- toolkit/xre/nsAppRunner.cpp |
749 |
+++ toolkit/xre/nsAppRunner.cpp |
750 |
@@ -227,11 +227,13 @@ |
751 |
extern uint32_t gRestartMode; |
752 |
extern void InstallSignalHandlers(const char *ProgramName); |
753 |
|
754 |
+#ifdef MOZ_RUST |
755 |
// This workaround is fixed in Rust 1.19. For details, see bug 1358151. |
756 |
// Implementation in toolkit/library/rust/shared/lib.rs |
757 |
extern "C" { |
758 |
void rust_init_please_remove_this_after_updating_rust_1_19(); |
759 |
} |
760 |
+#endif |
761 |
|
762 |
#define FILE_COMPATIBILITY_INFO NS_LITERAL_CSTRING("compatibility.ini") |
763 |
#define FILE_INVALIDATE_CACHES NS_LITERAL_CSTRING(".purgecaches") |
764 |
@@ -3122,8 +3124,10 @@ XREMain::XRE_mainInit(bool* aExitFlag) |
765 |
return 1; |
766 |
*aExitFlag = false; |
767 |
|
768 |
+#ifdef MOZ_RUST |
769 |
// This workaround is fixed in Rust 1.19. For details, see bug 1358151. |
770 |
rust_init_please_remove_this_after_updating_rust_1_19(); |
771 |
+#endif |
772 |
|
773 |
atexit(UnexpectedExit); |
774 |
auto expectedShutdown = mozilla::MakeScopeExit([&] { |
775 |
diff --git xpcom/base/nsDebugImpl.cpp xpcom/base/nsDebugImpl.cpp |
776 |
index e6bb623c258b..c49d61dce605 100644 |
777 |
--- xpcom/base/nsDebugImpl.cpp |
778 |
+++ xpcom/base/nsDebugImpl.cpp |
779 |
@@ -148,14 +148,20 @@ nsDebugImpl::Abort(const char* aFile, int32_t aLine) |
780 |
return NS_OK; |
781 |
} |
782 |
|
783 |
+#ifdef MOZ_RUST |
784 |
// From toolkit/library/rust/lib.rs |
785 |
extern "C" void intentional_panic(const char* message); |
786 |
+#endif |
787 |
|
788 |
NS_IMETHODIMP |
789 |
nsDebugImpl::RustPanic(const char* aMessage) |
790 |
{ |
791 |
+#ifdef MOZ_RUST |
792 |
intentional_panic(aMessage); |
793 |
return NS_OK; |
794 |
+#else |
795 |
+ return NS_ERROR_NOT_IMPLEMENTED; |
796 |
+#endif |
797 |
} |
798 |
|
799 |
NS_IMETHODIMP |
800 |
diff --git xpcom/rust/nsstring/gtest/moz.build xpcom/rust/nsstring/gtest/moz.build |
801 |
index 197411678815..5bed9e57e57d 100644 |
802 |
--- xpcom/rust/nsstring/gtest/moz.build |
803 |
+++ xpcom/rust/nsstring/gtest/moz.build |
804 |
@@ -4,8 +4,9 @@ |
805 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
806 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
807 |
|
808 |
-UNIFIED_SOURCES += [ |
809 |
- 'Test.cpp' |
810 |
-] |
811 |
+if CONFIG['MOZ_RUST']: |
812 |
+ UNIFIED_SOURCES += [ |
813 |
+ 'Test.cpp' |
814 |
+ ] |
815 |
|
816 |
FINAL_LIBRARY = 'xul-gtest' |