From 06f8903786c5111da77bb887548ab771a4ca9380 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Mon, 27 Jan 2014 11:56:53 +0200 Subject: [PATCH 01/76] Bug 959058 - Map GBK and GB2312 decoder constructors to the GB18030 decoder. r=emk. --- intl/uconv/src/nsUConvModule.cpp | 6 ++---- intl/uconv/tests/mochitest.ini | 1 + intl/uconv/tests/test_bug959058.html | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 intl/uconv/tests/test_bug959058.html diff --git a/intl/uconv/src/nsUConvModule.cpp b/intl/uconv/src/nsUConvModule.cpp index 21bfa61652e..93daeccc7e5 100644 --- a/intl/uconv/src/nsUConvModule.cpp +++ b/intl/uconv/src/nsUConvModule.cpp @@ -355,9 +355,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToISO2022JP) NS_GENERIC_FACTORY_CONSTRUCTOR(nsISO2022KRToUnicode) // ucvcn -NS_GENERIC_FACTORY_CONSTRUCTOR(nsGB2312ToUnicodeV2) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGB2312V2) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsGBKToUnicode) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGBK) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHZToUnicode) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToHZ) @@ -839,9 +837,9 @@ static const mozilla::Module::CIDEntry kUConvCIDs[] = { { &kNS_JOHABTOUNICODE_CID, false, nullptr, nsJohabToUnicodeConstructor }, { &kNS_UNICODETOJOHAB_CID, false, nullptr, nsUnicodeToJohabConstructor }, { &kNS_ISO2022KRTOUNICODE_CID, false, nullptr, nsISO2022KRToUnicodeConstructor }, - { &kNS_GB2312TOUNICODE_CID, false, nullptr, nsGB2312ToUnicodeV2Constructor }, + { &kNS_GB2312TOUNICODE_CID, false, nullptr, nsGB18030ToUnicodeConstructor }, { &kNS_UNICODETOGB2312_CID, false, nullptr, nsUnicodeToGB2312V2Constructor }, - { &kNS_GBKTOUNICODE_CID, false, nullptr, nsGBKToUnicodeConstructor }, + { &kNS_GBKTOUNICODE_CID, false, nullptr, nsGB18030ToUnicodeConstructor }, { &kNS_UNICODETOGBK_CID, false, nullptr, nsUnicodeToGBKConstructor }, { &kNS_HZTOUNICODE_CID, false, nullptr, nsHZToUnicodeConstructor }, { &kNS_UNICODETOHZ_CID, false, nullptr, nsUnicodeToHZConstructor }, diff --git a/intl/uconv/tests/mochitest.ini b/intl/uconv/tests/mochitest.ini index a9ce7ac3361..957e5341bda 100644 --- a/intl/uconv/tests/mochitest.ini +++ b/intl/uconv/tests/mochitest.ini @@ -2,6 +2,7 @@ [test_bug335816.html] [test_bug843434.html] +[test_bug959058.html] [test_long_doc.html] [test_singlebyte_overconsumption.html] [test_unicode_noncharacterescapes.html] diff --git a/intl/uconv/tests/test_bug959058.html b/intl/uconv/tests/test_bug959058.html new file mode 100644 index 00000000000..10940939751 --- /dev/null +++ b/intl/uconv/tests/test_bug959058.html @@ -0,0 +1,28 @@ + + + + + + Test for Bug 959058 + + + + + +Mozilla Bug 959058 +

+ +
+
+ + From 674912704c41a8182f7d268bff319db45a59886c Mon Sep 17 00:00:00 2001 From: Adarsh Dinesh Date: Mon, 27 Jan 2014 10:53:47 +0000 Subject: [PATCH 02/76] Bug 961648 - Provide a helpful error message when test variables JSON file cannot be parsed; r=dhunt --- testing/marionette/client/marionette/runner/base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/testing/marionette/client/marionette/runner/base.py b/testing/marionette/client/marionette/runner/base.py index 6e5988a2902..a4621562c4d 100644 --- a/testing/marionette/client/marionette/runner/base.py +++ b/testing/marionette/client/marionette/runner/base.py @@ -538,8 +538,13 @@ class BaseMarionetteTestRunner(object): raise IOError('--testvars file does not exist') import json - with open(testvars) as f: - self.testvars = json.loads(f.read()) + try: + with open(testvars) as f: + self.testvars = json.loads(f.read()) + except ValueError as e: + json_path = os.path.abspath(testvars) + raise Exception("JSON file (%s) is not properly " + "formatted: %s" % (json_path, e.message)) # set up test handlers self.test_handlers = [] From 75a572744bb3fdcbd4c748954a34c2f29a972cdd Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Mon, 27 Jan 2014 14:05:42 +0100 Subject: [PATCH 03/76] Backed out changeset 88549ccbce60 (bug 959058) for mochitest -m7 orange on android on a CLOSED TREE --- intl/uconv/src/nsUConvModule.cpp | 6 ++++-- intl/uconv/tests/mochitest.ini | 1 - intl/uconv/tests/test_bug959058.html | 28 ---------------------------- 3 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 intl/uconv/tests/test_bug959058.html diff --git a/intl/uconv/src/nsUConvModule.cpp b/intl/uconv/src/nsUConvModule.cpp index 93daeccc7e5..21bfa61652e 100644 --- a/intl/uconv/src/nsUConvModule.cpp +++ b/intl/uconv/src/nsUConvModule.cpp @@ -355,7 +355,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToISO2022JP) NS_GENERIC_FACTORY_CONSTRUCTOR(nsISO2022KRToUnicode) // ucvcn +NS_GENERIC_FACTORY_CONSTRUCTOR(nsGB2312ToUnicodeV2) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGB2312V2) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsGBKToUnicode) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGBK) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHZToUnicode) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToHZ) @@ -837,9 +839,9 @@ static const mozilla::Module::CIDEntry kUConvCIDs[] = { { &kNS_JOHABTOUNICODE_CID, false, nullptr, nsJohabToUnicodeConstructor }, { &kNS_UNICODETOJOHAB_CID, false, nullptr, nsUnicodeToJohabConstructor }, { &kNS_ISO2022KRTOUNICODE_CID, false, nullptr, nsISO2022KRToUnicodeConstructor }, - { &kNS_GB2312TOUNICODE_CID, false, nullptr, nsGB18030ToUnicodeConstructor }, + { &kNS_GB2312TOUNICODE_CID, false, nullptr, nsGB2312ToUnicodeV2Constructor }, { &kNS_UNICODETOGB2312_CID, false, nullptr, nsUnicodeToGB2312V2Constructor }, - { &kNS_GBKTOUNICODE_CID, false, nullptr, nsGB18030ToUnicodeConstructor }, + { &kNS_GBKTOUNICODE_CID, false, nullptr, nsGBKToUnicodeConstructor }, { &kNS_UNICODETOGBK_CID, false, nullptr, nsUnicodeToGBKConstructor }, { &kNS_HZTOUNICODE_CID, false, nullptr, nsHZToUnicodeConstructor }, { &kNS_UNICODETOHZ_CID, false, nullptr, nsUnicodeToHZConstructor }, diff --git a/intl/uconv/tests/mochitest.ini b/intl/uconv/tests/mochitest.ini index 957e5341bda..a9ce7ac3361 100644 --- a/intl/uconv/tests/mochitest.ini +++ b/intl/uconv/tests/mochitest.ini @@ -2,7 +2,6 @@ [test_bug335816.html] [test_bug843434.html] -[test_bug959058.html] [test_long_doc.html] [test_singlebyte_overconsumption.html] [test_unicode_noncharacterescapes.html] diff --git a/intl/uconv/tests/test_bug959058.html b/intl/uconv/tests/test_bug959058.html deleted file mode 100644 index 10940939751..00000000000 --- a/intl/uconv/tests/test_bug959058.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - Test for Bug 959058 - - - - - -Mozilla Bug 959058 -

- -
-
- - From 8f2c4f51751b74f30f3bde2e52d578e4a0822f49 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Thu, 16 Jan 2014 16:45:20 -0700 Subject: [PATCH 04/76] Bug 157846 - Remove padding from textbox.plain. r=roc --- editor/reftests/xul/input.css | 1 - toolkit/themes/linux/global/textbox.css | 2 +- toolkit/themes/osx/global/textbox.css | 2 +- toolkit/themes/windows/global/textbox.css | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/editor/reftests/xul/input.css b/editor/reftests/xul/input.css index 599963ac986..ba060ae1fd2 100644 --- a/editor/reftests/xul/input.css +++ b/editor/reftests/xul/input.css @@ -67,7 +67,6 @@ html|input.num { } html|div.plainfield { - -moz-margin-start: 1px; color: -moz-fieldtext; white-space: pre; } diff --git a/toolkit/themes/linux/global/textbox.css b/toolkit/themes/linux/global/textbox.css index c662d64e49e..32f9c6fa22c 100644 --- a/toolkit/themes/linux/global/textbox.css +++ b/toolkit/themes/linux/global/textbox.css @@ -60,7 +60,7 @@ textbox[disabled="true"] { textbox.plain { -moz-appearance: none !important; background-color: transparent; - padding: 0px 1px !important; + padding: 0px !important; margin: 0px !important; border: none !important; } diff --git a/toolkit/themes/osx/global/textbox.css b/toolkit/themes/osx/global/textbox.css index 5acddcc309b..60e496e0a39 100644 --- a/toolkit/themes/osx/global/textbox.css +++ b/toolkit/themes/osx/global/textbox.css @@ -60,7 +60,7 @@ textbox[disabled="true"] { textbox.plain { -moz-appearance: none !important; background-color: transparent; - padding: 0px 1px !important; + padding: 0px !important; margin: 0px !important; border: none !important; } diff --git a/toolkit/themes/windows/global/textbox.css b/toolkit/themes/windows/global/textbox.css index 7bcdb4568fd..06484c6d382 100644 --- a/toolkit/themes/windows/global/textbox.css +++ b/toolkit/themes/windows/global/textbox.css @@ -60,7 +60,7 @@ textbox[disabled="true"] { textbox.plain { -moz-appearance: none !important; background-color: transparent; - padding: 0px 1px !important; + padding: 0px !important; margin: 0px !important; border: none !important; } From 960b22bfa97290e651b5b44020fd8d13d23f083a Mon Sep 17 00:00:00 2001 From: James Kitchener Date: Mon, 27 Jan 2014 08:18:26 -0500 Subject: [PATCH 05/76] Bug 941611 - More consistent rounding of text metrics. r=karlt, r=fredw --- layout/generic/nsTextFrame.cpp | 5 +++-- layout/reftests/mathml/reftest.list | 4 ++-- layout/reftests/mathml/table-width-1-ref.xhtml | 5 ++++- layout/reftests/mathml/table-width-1.xhtml | 5 ++++- layout/reftests/mathml/table-width-3-ref.html | 5 ++++- layout/reftests/mathml/table-width-3.html | 5 ++++- layout/reftests/mathml/table-width-4-ref.html | 5 ++++- layout/reftests/mathml/table-width-4.html | 5 ++++- 8 files changed, 29 insertions(+), 10 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index e3f7c94bd7f..fabeaabda81 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -7382,8 +7382,9 @@ nsTextFrame::GetPrefWidthTightBounds(nsRenderingContext* aContext, ComputeTransformedLength(provider), gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS, aContext->ThebesContext(), &provider); - *aX = metrics.mBoundingBox.x; - *aXMost = metrics.mBoundingBox.XMost(); + // Round it like nsTextFrame::ComputeTightBounds() to ensure consistency. + *aX = NSToCoordFloor(metrics.mBoundingBox.x); + *aXMost = NSToCoordCeil(metrics.mBoundingBox.XMost()); return NS_OK; } diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list index 32b74a65bc4..62647262863 100644 --- a/layout/reftests/mathml/reftest.list +++ b/layout/reftests/mathml/reftest.list @@ -44,8 +44,8 @@ skip-if(B2G) == quotes-1.xhtml quotes-1-ref.xhtml != stretchy-underbar-1.xhtml stretchy-underbar-1-ref.xhtml == table-width-1.xhtml table-width-1-ref.xhtml == table-width-2.html table-width-2-ref.html -fails-if(OSX||/^Windows\x20NT\x206\.[^0]/.test(http.oscpu)||Android) == table-width-3.html table-width-3-ref.html -fails-if((OSX&&(OSX<10.8))||/^Windows\x20NT\x206\.[^0]/.test(http.oscpu)||Android) == table-width-4.html table-width-4-ref.html +== table-width-3.html table-width-3-ref.html +== table-width-4.html table-width-4-ref.html == underbar-width-1.xhtml underbar-width-1-ref.xhtml == mathml-type-supported.xhtml mathml-type-supported-ref.xml == mtable-align-negative-rownumber.html mtable-align-negative-rownumber-ref.html diff --git a/layout/reftests/mathml/table-width-1-ref.xhtml b/layout/reftests/mathml/table-width-1-ref.xhtml index e2cda359614..1aef15435c5 100644 --- a/layout/reftests/mathml/table-width-1-ref.xhtml +++ b/layout/reftests/mathml/table-width-1-ref.xhtml @@ -3,7 +3,10 @@ diff --git a/layout/reftests/mathml/table-width-1.xhtml b/layout/reftests/mathml/table-width-1.xhtml index 0490e2b7891..04948d8e6e3 100644 --- a/layout/reftests/mathml/table-width-1.xhtml +++ b/layout/reftests/mathml/table-width-1.xhtml @@ -4,7 +4,10 @@ diff --git a/layout/reftests/mathml/table-width-3-ref.html b/layout/reftests/mathml/table-width-3-ref.html index 883b5c2de3a..8a4cd4b388a 100644 --- a/layout/reftests/mathml/table-width-3-ref.html +++ b/layout/reftests/mathml/table-width-3-ref.html @@ -6,7 +6,10 @@ diff --git a/layout/reftests/mathml/table-width-4.html b/layout/reftests/mathml/table-width-4.html index 982cdccb491..de9605b44b9 100644 --- a/layout/reftests/mathml/table-width-4.html +++ b/layout/reftests/mathml/table-width-4.html @@ -6,7 +6,10 @@ From c34d2cbbba3b76faec309958ea24b47e4815810e Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Fri, 10 Jan 2014 15:57:15 -0800 Subject: [PATCH 06/76] Bug 957800 - Make codeword longer to avoid collisions. r=abr --- media/mtransport/nricectx.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/media/mtransport/nricectx.cpp b/media/mtransport/nricectx.cpp index c586853b3a9..e49f67b8fb1 100644 --- a/media/mtransport/nricectx.cpp +++ b/media/mtransport/nricectx.cpp @@ -48,6 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "nspr.h" #include "nss.h" #include "pk11pub.h" +#include "plbase64.h" #include "nsCOMPtr.h" #include "nsComponentManagerUtils.h" @@ -718,23 +719,14 @@ void NrIceCtx::SetGatheringState(GatheringState state) { } // close namespace - -extern "C" { -int nr_bin2hex(UCHAR *in,int len,UCHAR *out); -} - // Reimplement nr_ice_compute_codeword to avoid copyright issues void nr_ice_compute_codeword(char *buf, int len,char *codeword) { UINT4 c; - UCHAR cc[2]; r_crc32(buf,len,&c); - c %= 2048; - cc[0] = (c >> 8) & 0xff; - cc[1] = c & 0xff; - - nr_bin2hex(cc, 2, reinterpret_cast(codeword)); + PL_Base64Encode(reinterpret_cast(&c), 3, codeword); + codeword[4] = 0; return; } From bf8637fd08e63f9a298d9328e580ba99ce183475 Mon Sep 17 00:00:00 2001 From: Hsin-Yi Tsai Date: Thu, 23 Jan 2014 13:58:30 +0800 Subject: [PATCH 07/76] Bug 962447 - [fugu][b2g] should getFailCauseCode() even the connection hasn't been established. r=vicamo --- dom/system/gonk/ril_worker.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 49e1f537218..34ea223c47e 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -3657,8 +3657,8 @@ let RIL = { _sendCallError: function(callIndex, errorMsg) { this.sendChromeMessage({rilMessageType: "callError", - callIndex: callIndex, - errorMsg: errorMsg}); + callIndex: callIndex, + errorMsg: errorMsg}); }, _sendDataCallError: function(message, errorCode) { @@ -5095,8 +5095,7 @@ RIL[REQUEST_DIAL] = function REQUEST_DIAL(length, options) { if (options.rilRequestError) { // The connection is not established yet. options.callIndex = -1; - this._sendCallError(options.callIndex, - RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError]); + this.getFailCauseCode(options); } }; RIL[REQUEST_GET_IMSI] = function REQUEST_GET_IMSI(length, options) { From 03f9744cc1e154374c8ef4fa885b4772ac248ec9 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 00:45:12 -0800 Subject: [PATCH 08/76] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/69295b3ba8ca Author: Alive.Kuo Desc: Merge pull request #15673 from alivedise/bugzilla/961569/fullscreen-modal-dialog Bug 961569 - Fix modal dialog under mozfullscreen, r=timdream ======== https://hg.mozilla.org/integration/gaia-central/rev/3d86405ad513 Author: Alive Kuo Desc: Bug 961569 - Fix modal dialog under mozfullscreen ======== https://hg.mozilla.org/integration/gaia-central/rev/8d669fcdb88a Author: Cristian Rodriguez Desc: Merge pull request #15677 from crdlc/bug-922391 Bug 922391 - [B2g] [E.me] UI overlaps when user tries to delete an app f... ======== https://hg.mozilla.org/integration/gaia-central/rev/a606f1ccaad2 Author: crdlc Desc: Bug 922391 - [B2g] [E.me] UI overlaps when user tries to delete an app from the dock area --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index a8ab2313c1f..88f25dcf433 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "c5f8db7e1e71a9bfe0d29665d2b4cf3ae773094e", + "revision": "69295b3ba8ca29022a827d94bd714f70d175bbd1", "repo_path": "/integration/gaia-central" } From 7de6a90f114cfdea3946bf3eaaf90dec1c8b011f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 00:51:00 -0800 Subject: [PATCH 09/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 9fb66a41996..03f28cf5424 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index f509e52d18f..63808ee6bee 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 9fb66a41996..03f28cf5424 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 712a839abb1..c78e078aed3 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 351a0b2ea9d..036d36ce1b0 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index ef1f1fd5156..ee12386f1eb 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 18c19467428..4515902688b 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 47ee9085254..78b3962a077 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index d21d4c160df..f6676adb06c 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From feff91825161c9226da5c49059cace8ddd16da1f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 00:55:11 -0800 Subject: [PATCH 10/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/d6b49ba6226f Author: Jose Antonio Olivera Ortega Desc: Merge pull request #15549 from jaoo/959986 Bug 959986 - [DSDS] When one SIM is active, still user can access Call Settings of another SIM card. r=arthurcc ======== https://hg.mozilla.org/integration/gaia-central/rev/8f9f9129bf60 Author: Jose Antonio Olivera Ortega Desc: Bug 959986 - [DSDS] When one SIM is active, still user can access Call Settings of another SIM card. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 88f25dcf433..641761d696f 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "69295b3ba8ca29022a827d94bd714f70d175bbd1", + "revision": "d6b49ba6226f09df18517f463efc438e5144f692", "repo_path": "/integration/gaia-central" } From f9c07d93c9d96dc8d2bf33f96e0f3e10803d0048 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:01:16 -0800 Subject: [PATCH 11/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 03f28cf5424..3aaa535b49b 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 63808ee6bee..46ef282675d 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 03f28cf5424..3aaa535b49b 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index c78e078aed3..c6163e2d326 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 036d36ce1b0..27a7c128fd1 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index ee12386f1eb..03109704a11 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 4515902688b..a87f81bb614 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 78b3962a077..dc11962d297 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index f6676adb06c..0a90593a9e1 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From edea0147d32341a5a449f00f7a76bdbbe625810c Mon Sep 17 00:00:00 2001 From: Ben Tian Date: Wed, 15 Jan 2014 11:50:27 +0800 Subject: [PATCH 12/76] Bug 957949 - [HFP] Add B2G common bluedroid config file, r=echou --- dom/bluetooth/bluedroid/b2g_bdroid_buildcfg.h | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 dom/bluetooth/bluedroid/b2g_bdroid_buildcfg.h diff --git a/dom/bluetooth/bluedroid/b2g_bdroid_buildcfg.h b/dom/bluetooth/bluedroid/b2g_bdroid_buildcfg.h new file mode 100644 index 00000000000..206b41f019d --- /dev/null +++ b/dom/bluetooth/bluedroid/b2g_bdroid_buildcfg.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef B2G_BDROID_BUILDCFG_H +#define B2G_BDROID_BUILDCFG_H + +/** + * This header defines B2G common bluedroid build configuration. + * + * This header is included by + * $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)/bdroid_buildcfg.h, + * which applies external configuration onto bluedroid. + */ + +/****************************************************************************** +** +** HSP, HFP +** +******************************************************************************/ +/* AG feature masks */ +#define BTIF_HF_FEATURES ( BTA_AG_FEAT_3WAY | \ + BTA_AG_FEAT_REJECT | \ + BTA_AG_FEAT_ECS | \ + BTA_AG_FEAT_EXTERR) + +/* CHLD values */ +#define BTA_AG_CHLD_VAL "(0,1,2)" + +#endif /* B2G_BDROID_BUILDCFG_H */ From f938a26fddc796410d8d371ed1935283fe59c768 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:10:11 -0800 Subject: [PATCH 13/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/f4459936dcab Author: Zac Desc: Merge pull request #15597 from AndreiH/bug962504 Bug 962504 - Investigate intermittent fail on test_cost_control_reset_wi... ======== https://hg.mozilla.org/integration/gaia-central/rev/fdbddb876685 Author: Andrei Hutusoru Desc: Bug 962504 - Investigate intermittent fail on test_cost_control_reset_wifi --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 641761d696f..5c662e330d5 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "d6b49ba6226f09df18517f463efc438e5144f692", + "revision": "f4459936dcab3124917fb884db8283bd5e399cc4", "repo_path": "/integration/gaia-central" } From 8d338b544924e54b278acf5471d4facb95d7303e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:16:06 -0800 Subject: [PATCH 14/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 3aaa535b49b..8470316be27 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 46ef282675d..3f53d26295a 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 3aaa535b49b..8470316be27 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index c6163e2d326..70259f0ed35 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 27a7c128fd1..ae80e6a527b 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 03109704a11..e182e140fd5 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index a87f81bb614..bcaed2c6d82 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index dc11962d297..0e30e2ea225 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 0a90593a9e1..c117a4380a6 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From 22be2d89fb5b992706117cb964035f514f3bddde Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:25:11 -0800 Subject: [PATCH 15/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/30ed848ece50 Author: Zac Desc: Merge pull request #14503 from viorelaioia/bug_942107_settings Bug 942107 - Reduce locators, settings app ======== https://hg.mozilla.org/integration/gaia-central/rev/e912a1a1c349 Author: Viorela Ioia Desc: Reduce locators, settings app --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 5c662e330d5..e379ba64a65 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f4459936dcab3124917fb884db8283bd5e399cc4", + "revision": "30ed848ece50d437c3ffa269878b30c76afd0cee", "repo_path": "/integration/gaia-central" } From 07133f022af7c8d12298c9b7dd8a78b83c6fc835 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:31:00 -0800 Subject: [PATCH 16/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 8470316be27..0dcc0cd5136 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 3f53d26295a..fb5059645db 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 8470316be27..0dcc0cd5136 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 70259f0ed35..a901c4df628 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index ae80e6a527b..69a9e022535 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index e182e140fd5..21d7b0bb7a9 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index bcaed2c6d82..176808b7dad 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 0e30e2ea225..050f7c5a600 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index c117a4380a6..bc7c6cd0d7c 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From 0d8c5d3a1aab73a180a43a8630252162e2996f96 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:35:10 -0800 Subject: [PATCH 17/76] Bumping gaia.json for 1 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/0ba4112681b1 Author: Zac Campbell Desc: Revert "Revert "Bug 946205 - Re-enable Travis tests after 891882 merged" for mochitest 5 timeouts" This reverts commit 213d4eff522a9cc557d659d7a2e7038a9935fe4a. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index e379ba64a65..6c2393387c0 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "30ed848ece50d437c3ffa269878b30c76afd0cee", + "revision": "0ba4112681b15cfae1380462425f50b223ea3807", "repo_path": "/integration/gaia-central" } From 88ef9897ca045e10fb7cc3521b4a71856b8a6150 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:40:55 -0800 Subject: [PATCH 18/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 0dcc0cd5136..7302b10f3c8 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index fb5059645db..5849855cfce 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 0dcc0cd5136..7302b10f3c8 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index a901c4df628..38773b03b87 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 69a9e022535..e98330ce4a9 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 21d7b0bb7a9..8d3f5fb2af7 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 176808b7dad..fa774f27268 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 050f7c5a600..3b0363bc924 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index bc7c6cd0d7c..028b2065180 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From a91077ed5cc21bb4f12a9b135f2f738f8e780b2e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:50:11 -0800 Subject: [PATCH 19/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/9be7377118a2 Author: George Desc: Merge pull request #15406 from cctuan/950185 Bug 950185 - [B2G] [Settings] Network type does not show user friendly o... ======== https://hg.mozilla.org/integration/gaia-central/rev/4720e2783666 Author: cctuan Desc: Bug 950185 - [B2G] [Settings] Network type does not show user friendly options such as 2G and 3G --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 6c2393387c0..d548cb74e20 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "0ba4112681b15cfae1380462425f50b223ea3807", + "revision": "9be7377118a2bfe9df013d7b444833ab4b231913", "repo_path": "/integration/gaia-central" } From b80598365ae6fbc2a163684d497140cd07bac10f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 01:51:01 -0800 Subject: [PATCH 20/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 7302b10f3c8..2d21d0cfae2 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 5849855cfce..199c8961faa 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 7302b10f3c8..2d21d0cfae2 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 38773b03b87..59e7217a25e 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index e98330ce4a9..c0b50150682 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 8d3f5fb2af7..9966b14613a 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index fa774f27268..73761df370f 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 3b0363bc924..01713899693 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 028b2065180..6c8be49d14a 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From 738b907eda6dba52445a32a22fb917d1f971f236 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 02:00:11 -0800 Subject: [PATCH 21/76] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/6338650b81e5 Author: Albert Desc: Merge pull request #15652 from acperez/bug-963061 Bug 963061 - Clear single variant applications stored in persist partition when flashing gaia ======== https://hg.mozilla.org/integration/gaia-central/rev/fee8e7774972 Author: Albert Desc: Bug 963061 - Clear single variant applications stored in persist partition when flashing gaia ======== https://hg.mozilla.org/integration/gaia-central/rev/62e7ecdd9852 Author: gitmai Desc: Merge pull request #15411 from gitmai/bug-928620-CC-set-reset-report-works-abnormal Bug 928620 - [Buri][Data usage]Set the phone and internet data report is... r=salva ======== https://hg.mozilla.org/integration/gaia-central/rev/bb9aba43476e Author: mai Desc: Bug 928620 - [Buri][Data usage]Set the phone and internet data report is abnormal --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index d548cb74e20..36942d43c32 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "9be7377118a2bfe9df013d7b444833ab4b231913", + "revision": "6338650b81e502a005b60e85df8dd89b07790494", "repo_path": "/integration/gaia-central" } From c3e4ede2e19cecbf792ccfe280d6d26b513c2789 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 02:06:14 -0800 Subject: [PATCH 22/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 2d21d0cfae2..a5899aacee7 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 199c8961faa..114b8822c3a 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 2d21d0cfae2..a5899aacee7 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 59e7217a25e..b9d1486694e 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index c0b50150682..cb67fc6c9dd 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 9966b14613a..121901e49d1 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 73761df370f..95d91065a99 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 01713899693..6d7f0cc4977 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 6c8be49d14a..2a6fa9714c5 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From cc5f3bf5d78657d4148189bafe57f847bb3d9cf6 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 02:15:13 -0800 Subject: [PATCH 23/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/8dfeb9483a36 Author: Zac Desc: Merge pull request #14205 from bebef1987/prefs Bug 942909 - Add in the gaia test cleanUp() a option to setup prefs ======== https://hg.mozilla.org/integration/gaia-central/rev/db575d9580c1 Author: Bebe Desc: Bug 942909 - Add in the gaia test cleanUp() a option to setup prefs r=davehunt bsilvergberg --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 36942d43c32..ef2d64256fb 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "6338650b81e502a005b60e85df8dd89b07790494", + "revision": "8dfeb9483a364525c12740adc7adf3cab7e9b448", "repo_path": "/integration/gaia-central" } From fa793678559b3fe81c9b6aa19b4a2bd9e6168fe7 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 02:21:00 -0800 Subject: [PATCH 24/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index a5899aacee7..d54988933a3 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 114b8822c3a..76935633217 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index a5899aacee7..d54988933a3 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index b9d1486694e..b8af496889c 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index cb67fc6c9dd..f79aba17689 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 121901e49d1..58d31f86503 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 95d91065a99..43c960a0247 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 6d7f0cc4977..cd4c50c0fe3 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 2a6fa9714c5..0624fbf0d8f 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From 4eb3af537990f2beee11fceebc0498f39644e72e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 02:25:13 -0800 Subject: [PATCH 25/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/1066534982f2 Author: Florin Strugariu Desc: Merge pull request #15676 from davehunt/bug963476 Bug 963476 - Use a more internationally friendly collection for everything.me collection test ======== https://hg.mozilla.org/integration/gaia-central/rev/4a5732757fba Author: Dave Hunt Desc: Bug 963476 - Use a more internationally friendly collection for everything.me collection test. r=fstrugariu --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index ef2d64256fb..954f9011314 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "8dfeb9483a364525c12740adc7adf3cab7e9b448", + "revision": "1066534982f2e0b036875abc0adceaac1483177d", "repo_path": "/integration/gaia-central" } From 8d8e12e7575973e96ba2f97e616d0945360511d4 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 02:26:19 -0800 Subject: [PATCH 26/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index d54988933a3..8e82d1a99c4 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 76935633217..ce08f7535a2 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index d54988933a3..8e82d1a99c4 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index b8af496889c..33ca60c7040 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index f79aba17689..ab14c45b855 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 58d31f86503..ebd1bf9fe39 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 43c960a0247..bdd5d3bd7a5 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index cd4c50c0fe3..8f1a5a0f122 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 0624fbf0d8f..1febb8c624f 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From 9cec91eaffe76a2081ef7c9db12c2667457bcdcd Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 02:46:06 -0800 Subject: [PATCH 27/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-jb/sources.xml | 1 + b2g/config/mako/sources.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index ce08f7535a2..3adedb4836f 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -24,6 +24,7 @@ + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 8f1a5a0f122..378d353a868 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -24,6 +24,7 @@ + From 9e3240e8444998b82b48c9c76ba3cf6a20fefc95 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 03:05:10 -0800 Subject: [PATCH 28/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/8aef23d0842b Author: Yuren Ju Desc: Merge pull request #15130 from RickyChien/issue-957932 Bug 957932 - Add coverage execute button for test-agent web interface r=@yurenju ======== https://hg.mozilla.org/integration/gaia-central/rev/1dcfdca06ba8 Author: Ricky Chien Desc: Bug 957932 - Add coverage checkbox for test-agent web interface --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 954f9011314..84e7d9839f7 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "1066534982f2e0b036875abc0adceaac1483177d", + "revision": "8aef23d0842b91ff462fc533970439de9f5b0911", "repo_path": "/integration/gaia-central" } From c98cca8636b61ad22b4a89a5772d3461ece04a9c Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 03:10:59 -0800 Subject: [PATCH 29/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 8e82d1a99c4..0e5e3f85f8f 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 3adedb4836f..34499b92438 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 8e82d1a99c4..0e5e3f85f8f 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 33ca60c7040..58c2720d526 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index ab14c45b855..1e6a1d4a602 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index ebd1bf9fe39..42c258d0bad 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index bdd5d3bd7a5..6805b75e712 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 378d353a868..875fa84e2b8 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 1febb8c624f..2f01fd9165e 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From c80f3d031230a21b90e52e4ff8298ef3f91c75fb Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 03:15:12 -0800 Subject: [PATCH 30/76] Bumping gaia.json for 1 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/2f9ca68a745e Author: Viorela Ioia Desc: Bug 963014 - Remove hacks used to avoid update-checker. r=ahutusoru r=dhunt --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 84e7d9839f7..2e2befeb4dd 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "8aef23d0842b91ff462fc533970439de9f5b0911", + "revision": "2f9ca68a745e3968390dcffc37290fcb6cfe4e85", "repo_path": "/integration/gaia-central" } From a3bb95b9040c7ecfc27e53c18528341e8caf6d9a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 03:20:59 -0800 Subject: [PATCH 31/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 0e5e3f85f8f..7a22bc26494 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 34499b92438..46a71081c8c 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 0e5e3f85f8f..7a22bc26494 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 58c2720d526..341d62d3947 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 1e6a1d4a602..aac3d572f1f 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 42c258d0bad..8248c19b20f 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 6805b75e712..6d1920fa1e6 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 875fa84e2b8..170d752fd3a 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 2f01fd9165e..5c2c878eaf5 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From b5ffc73ed408bdf2e4718db7ac83da71855b04e3 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 03:40:11 -0800 Subject: [PATCH 32/76] Bumping gaia.json for 1 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/f5e8e9587a20 Author: AutomatedTester Desc: Bug 959197; Update capability check to use platformName instead of platform; r=dhunt --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 2e2befeb4dd..bb865367364 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "2f9ca68a745e3968390dcffc37290fcb6cfe4e85", + "revision": "f5e8e9587a20bf15b2c830dbb4ce0dbde2617eee", "repo_path": "/integration/gaia-central" } From 62c2bf030d94c0571de5e32b52342f65323fc755 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 03:46:03 -0800 Subject: [PATCH 33/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 7a22bc26494..c10b2713a65 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 46a71081c8c..ffa7cccd72e 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 7a22bc26494..c10b2713a65 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 341d62d3947..aa37c14e539 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index aac3d572f1f..adb79d0ddd2 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 8248c19b20f..1fa2dcba57f 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 6d1920fa1e6..9e5934624f0 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 170d752fd3a..8cab67a916f 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 5c2c878eaf5..71bcef3f170 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From 3535a77cb41dbdd88fd397cb0718d819f6a0ed75 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 03:55:15 -0800 Subject: [PATCH 34/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/0c92e7791796 Author: Jose M. Cantera Desc: Merge pull request #15599 from jmcanterafonseca/fix_fb_index_write Bug 950881 In the Facebook datastore simplify indexing by removing the m... ======== https://hg.mozilla.org/integration/gaia-central/rev/5f2d19440ad0 Author: Jose M. Cantera Desc: Bug 950881 In the Facebook datastore simplify indexing by removing the mapping uids --> dsids --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index bb865367364..2db1ea14d6e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f5e8e9587a20bf15b2c830dbb4ce0dbde2617eee", + "revision": "0c92e7791796ddebe44f322f0775bd9c43797738", "repo_path": "/integration/gaia-central" } From 6a80be3ed7cb02620e230ded8758f2a0fa4b1d91 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 03:56:51 -0800 Subject: [PATCH 35/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index c10b2713a65..6fcf0c0a588 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index ffa7cccd72e..1157114e8d3 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index c10b2713a65..6fcf0c0a588 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index aa37c14e539..4335c19e7d2 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index adb79d0ddd2..55c5ba076ad 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 1fa2dcba57f..d3f7ccf27f1 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 9e5934624f0..3b8277a2fa1 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 8cab67a916f..29c40d5c2e3 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 71bcef3f170..c8ab78b036d 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From 89edcaab87eadf4f659662bdb38292e555b51e02 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 04:30:18 -0800 Subject: [PATCH 36/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/5102fe0a87af Author: Rudy Lu Desc: Merge pull request #15637 from anefzaoui/keyboard-outline-chars-ar Bug 897362 - [InputMethod][Arabic]The characters overflow the keyboard when set the keyboard layouts as the Arabic. r=rudylu ======== https://hg.mozilla.org/integration/gaia-central/rev/5f38da4f3133 Author: Ahmed Nefzaoui Desc: The characters overflow the keyboard when set the keyboard layouts as the Arabic. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 2db1ea14d6e..f1713ae567e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "0c92e7791796ddebe44f322f0775bd9c43797738", + "revision": "5102fe0a87af90712543e4b41356739774919d54", "repo_path": "/integration/gaia-central" } From 5a4c9c9c9fef4b52fa2e0400be19b3edeb14293f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 27 Jan 2014 04:32:10 -0800 Subject: [PATCH 37/76] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 6fcf0c0a588..70e9d8bac93 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 1157114e8d3..0b72739a080 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 6fcf0c0a588..70e9d8bac93 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 4335c19e7d2..c55e9a6598d 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 55c5ba076ad..8b035b1a63f 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -10,7 +10,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index d3f7ccf27f1..e1c14f076af 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -12,7 +12,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 3b8277a2fa1..c9ccc56ec1c 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 29c40d5c2e3..f4518014f64 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -11,7 +11,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index c8ab78b036d..e7b1024f999 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -11,7 +11,7 @@ - + From 6a6aa3a1ea35fac16f496155867a51db268d729b Mon Sep 17 00:00:00 2001 From: Randy Lin Date: Wed, 15 Jan 2014 14:21:14 +0800 Subject: [PATCH 38/76] Bug 891705 - [MediaEncoder] Implement WebM 1.0 container writer. r=giles, r=gps, r=rillian This is an integrated patch which includes: 1. Bug 891705: [MediaEncoder] Implement WebM 1.0 container writer. r=giles, r=gps 2. Bug 950567: [MediaEncoder] Phase-in libmkv library. r=giles 3. bug 883749: Implement Vorbis encoding. r=rillian 4. bug 881840: Implement VP8 track encoder. r=rillian --- browser/confvars.sh | 1 + config/external/moz.build | 3 + configure.in | 5 + content/media/encoder/MediaEncoder.cpp | 5 + content/media/encoder/TrackEncoder.cpp | 14 + content/media/encoder/TrackEncoder.h | 7 + content/media/encoder/TrackMetadataBase.h | 1 + content/media/encoder/VP8TrackEncoder.cpp | 472 +++++++++++++++++++ content/media/encoder/VP8TrackEncoder.h | 93 ++++ content/media/encoder/VorbisTrackEncoder.cpp | 238 ++++++++++ content/media/encoder/VorbisTrackEncoder.h | 54 +++ content/media/encoder/moz.build | 14 +- content/media/webm/EbmlComposer.cpp | 177 +++++++ content/media/webm/EbmlComposer.h | 75 +++ content/media/webm/WebMWriter.cpp | 64 +++ content/media/webm/WebMWriter.h | 70 +++ content/media/webm/moz.build | 6 + layout/media/symbols.def.in | 11 + media/libmkv/AUTHORS | 100 ++++ media/libmkv/EbmlBufferWriter.c | 79 ++++ media/libmkv/EbmlBufferWriter.h | 20 + media/libmkv/EbmlIDs.h | 231 +++++++++ media/libmkv/EbmlWriter.c | 165 +++++++ media/libmkv/EbmlWriter.h | 53 +++ media/libmkv/LICENSE | 31 ++ media/libmkv/README | 139 ++++++ media/libmkv/README_MOZILLA | 6 + media/libmkv/WebMElement.c | 219 +++++++++ media/libmkv/WebMElement.h | 37 ++ media/libmkv/gecko_fix.patch | 133 ++++++ media/libmkv/moz.build | 27 ++ media/libmkv/source_fix.patch | 193 ++++++++ media/libmkv/update.sh | 33 ++ 33 files changed, 2773 insertions(+), 3 deletions(-) create mode 100644 content/media/encoder/VP8TrackEncoder.cpp create mode 100644 content/media/encoder/VP8TrackEncoder.h create mode 100644 content/media/encoder/VorbisTrackEncoder.cpp create mode 100644 content/media/encoder/VorbisTrackEncoder.h create mode 100644 content/media/webm/EbmlComposer.cpp create mode 100644 content/media/webm/EbmlComposer.h create mode 100644 content/media/webm/WebMWriter.cpp create mode 100644 content/media/webm/WebMWriter.h create mode 100644 media/libmkv/AUTHORS create mode 100644 media/libmkv/EbmlBufferWriter.c create mode 100644 media/libmkv/EbmlBufferWriter.h create mode 100644 media/libmkv/EbmlIDs.h create mode 100644 media/libmkv/EbmlWriter.c create mode 100644 media/libmkv/EbmlWriter.h create mode 100644 media/libmkv/LICENSE create mode 100644 media/libmkv/README create mode 100644 media/libmkv/README_MOZILLA create mode 100644 media/libmkv/WebMElement.c create mode 100644 media/libmkv/WebMElement.h create mode 100644 media/libmkv/gecko_fix.patch create mode 100644 media/libmkv/moz.build create mode 100644 media/libmkv/source_fix.patch create mode 100644 media/libmkv/update.sh diff --git a/browser/confvars.sh b/browser/confvars.sh index 83b3581e8d0..403b0201a74 100755 --- a/browser/confvars.sh +++ b/browser/confvars.sh @@ -64,6 +64,7 @@ MOZ_PAY=1 # Enable activities. These are used for FxOS developers currently. MOZ_ACTIVITIES=1 MOZ_JSDOWNLOADS=1 +MOZ_WEBM_ENCODER=1 # Enable exact rooting on desktop. JSGC_USE_EXACT_ROOTING=1 diff --git a/config/external/moz.build b/config/external/moz.build index 59c6a3c8ad9..c22a36cd735 100644 --- a/config/external/moz.build +++ b/config/external/moz.build @@ -27,6 +27,9 @@ if CONFIG['MOZ_OPUS']: if CONFIG['MOZ_WEBM']: external_dirs += ['media/libnestegg'] +if CONFIG['MOZ_WEBM_ENCODER']: + external_dirs += ['media/libmkv'] + if CONFIG['MOZ_VPX'] and not CONFIG['MOZ_NATIVE_LIBVPX']: external_dirs += ['media/libvpx'] diff --git a/configure.in b/configure.in index de9c1c2a653..028d38fc2d7 100644 --- a/configure.in +++ b/configure.in @@ -5546,6 +5546,11 @@ if test -n "$MOZ_OPUS"; then AC_DEFINE(MOZ_OPUS) fi +if test -n "$MOZ_WEBM_ENCODER"; then + AC_DEFINE(MOZ_WEBM_ENCODER) +fi +AC_SUBST(MOZ_WEBM_ENCODER) + dnl ================================== dnl = Check alsa availability on Linux dnl ================================== diff --git a/content/media/encoder/MediaEncoder.cpp b/content/media/encoder/MediaEncoder.cpp index ea50fc20413..b82dbb61677 100644 --- a/content/media/encoder/MediaEncoder.cpp +++ b/content/media/encoder/MediaEncoder.cpp @@ -14,6 +14,11 @@ #endif #ifdef MOZ_OPUS #include "OpusTrackEncoder.h" + +#endif + +#ifdef MOZ_VORBIS +#include "VorbisTrackEncoder.h" #endif #ifdef MOZ_WEBM_ENCODER #include "VorbisTrackEncoder.h" diff --git a/content/media/encoder/TrackEncoder.cpp b/content/media/encoder/TrackEncoder.cpp index 42df784445e..cfc4a1532cb 100644 --- a/content/media/encoder/TrackEncoder.cpp +++ b/content/media/encoder/TrackEncoder.cpp @@ -128,6 +128,20 @@ AudioTrackEncoder::InterleaveTrackData(AudioChunk& aChunk, } } +/*static*/ +void +AudioTrackEncoder::DeInterleaveTrackData(AudioDataValue* aInput, + int32_t aDuration, + int32_t aChannels, + AudioDataValue* aOutput) +{ + for (int32_t i = 0; i < aChannels; ++i) { + for(int32_t j = 0; j < aDuration; ++j) { + aOutput[i * aDuration + j] = aInput[i + j * aChannels]; + } + } +} + void VideoTrackEncoder::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID, diff --git a/content/media/encoder/TrackEncoder.h b/content/media/encoder/TrackEncoder.h index f322fc93126..d5311241a4f 100644 --- a/content/media/encoder/TrackEncoder.h +++ b/content/media/encoder/TrackEncoder.h @@ -158,6 +158,13 @@ public: uint32_t aOutputChannels, AudioDataValue* aOutput); + /** + * De-interleaves the aInput data and stores the result into aOutput. + * No up-mix or down-mix operations inside. + */ + static void DeInterleaveTrackData(AudioDataValue* aInput, int32_t aDuration, + int32_t aChannels, AudioDataValue* aOutput); + protected: /** * Number of samples per channel in a pcm buffer. This is also the value of diff --git a/content/media/encoder/TrackMetadataBase.h b/content/media/encoder/TrackMetadataBase.h index b0cb320f5d0..8a0ea0c51df 100644 --- a/content/media/encoder/TrackMetadataBase.h +++ b/content/media/encoder/TrackMetadataBase.h @@ -18,6 +18,7 @@ public: enum MetadataKind { METADATA_OPUS, // Represent the Opus metadata METADATA_VP8, + METADATA_VORBIS, METADATA_AVC, METADATA_AAC, METADATA_UNKNOWN // Metadata Kind not set diff --git a/content/media/encoder/VP8TrackEncoder.cpp b/content/media/encoder/VP8TrackEncoder.cpp new file mode 100644 index 00000000000..d4408fe9b6b --- /dev/null +++ b/content/media/encoder/VP8TrackEncoder.cpp @@ -0,0 +1,472 @@ +/* -*- 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 "VP8TrackEncoder.h" +#include "vpx/vp8cx.h" +#include "vpx/vpx_encoder.h" +#include "VideoUtils.h" +#include "prsystem.h" +#include "WebMWriter.h" + +namespace mozilla { + +#ifdef PR_LOGGING +PRLogModuleInfo* gVP8TrackEncoderLog; +#define VP8LOG(msg, ...) PR_LOG(gVP8TrackEncoderLog, PR_LOG_DEBUG, \ + (msg, ##__VA_ARGS__)) +// Debug logging macro with object pointer and class name. +#else +#define VP8LOG(msg, ...) +#endif + +#define DEFAULT_BITRATE 2500 // in kbit/s +#define DEFAULT_ENCODE_FRAMERATE 30 + +VP8TrackEncoder::VP8TrackEncoder() + : VideoTrackEncoder() + , mEncodedFrameDuration(0) + , mEncodedTimestamp(0) + , mRemainingTicks(0) + , mVPXContext(new vpx_codec_ctx_t()) + , mVPXImageWrapper(new vpx_image_t()) +{ + MOZ_COUNT_CTOR(VP8TrackEncoder); +#ifdef PR_LOGGING + if (!gVP8TrackEncoderLog) { + gVP8TrackEncoderLog = PR_NewLogModule("VP8TrackEncoder"); + } +#endif +} + +VP8TrackEncoder::~VP8TrackEncoder() +{ + if (mInitialized) { + vpx_codec_destroy(mVPXContext); + } + + if (mVPXImageWrapper) { + vpx_img_free(mVPXImageWrapper); + } + MOZ_COUNT_DTOR(VP8TrackEncoder); +} + +nsresult +VP8TrackEncoder::Init(int32_t aWidth, int32_t aHeight, TrackRate aTrackRate) +{ + if (aWidth < 1 || aHeight < 1 || aTrackRate <= 0) { + return NS_ERROR_FAILURE; + } + + ReentrantMonitorAutoEnter mon(mReentrantMonitor); + + mTrackRate = aTrackRate; + mEncodedFrameRate = DEFAULT_ENCODE_FRAMERATE; + mEncodedFrameDuration = mTrackRate / mEncodedFrameRate; + mFrameWidth = aWidth; + mFrameHeight = aHeight; + + // Encoder configuration structure. + vpx_codec_enc_cfg_t config; + memset(&config, 0, sizeof(vpx_codec_enc_cfg_t)); + if (vpx_codec_enc_config_default(vpx_codec_vp8_cx(), &config, 0)) { + return NS_ERROR_FAILURE; + } + + // Creating a wrapper to the image - setting image data to NULL. Actual + // pointer will be set in encode. Setting align to 1, as it is meaningless + // (actual memory is not allocated). + vpx_img_wrap(mVPXImageWrapper, IMG_FMT_I420, + mFrameWidth, mFrameHeight, 1, nullptr); + + config.g_w = mFrameWidth; + config.g_h = mFrameHeight; + // TODO: Maybe we should have various aFrameRate bitrate pair for each devices? + // or for different platform + config.rc_target_bitrate = DEFAULT_BITRATE; // in kbit/s + + // Setting the time base of the codec + config.g_timebase.num = 1; + config.g_timebase.den = mTrackRate; + + config.g_error_resilient = 0; + + config.g_lag_in_frames = 0; // 0- no frame lagging + + int32_t number_of_cores = PR_GetNumberOfProcessors(); + if (mFrameWidth * mFrameHeight > 1280 * 960 && number_of_cores >= 6) { + config.g_threads = 3; // 3 threads for 1080p. + } else if (mFrameWidth * mFrameHeight > 640 * 480 && number_of_cores >= 3) { + config.g_threads = 2; // 2 threads for qHD/HD. + } else { + config.g_threads = 1; // 1 thread for VGA or less + } + + // rate control settings + config.rc_dropframe_thresh = 0; + config.rc_end_usage = VPX_CBR; + config.g_pass = VPX_RC_ONE_PASS; + config.rc_resize_allowed = 1; + config.rc_undershoot_pct = 100; + config.rc_overshoot_pct = 15; + config.rc_buf_initial_sz = 500; + config.rc_buf_optimal_sz = 600; + config.rc_buf_sz = 1000; + + config.kf_mode = VPX_KF_AUTO; + // Ensure that we can output one I-frame per second. + config.kf_max_dist = mEncodedFrameRate; + + vpx_codec_flags_t flags = 0; + flags |= VPX_CODEC_USE_OUTPUT_PARTITION; + if (vpx_codec_enc_init(mVPXContext, vpx_codec_vp8_cx(), &config, flags)) { + return NS_ERROR_FAILURE; + } + + vpx_codec_control(mVPXContext, VP8E_SET_STATIC_THRESHOLD, 1); + vpx_codec_control(mVPXContext, VP8E_SET_CPUUSED, -6); + vpx_codec_control(mVPXContext, VP8E_SET_TOKEN_PARTITIONS, + VP8_ONE_TOKENPARTITION); + + mInitialized = true; + mon.NotifyAll(); + + return NS_OK; +} + +already_AddRefed +VP8TrackEncoder::GetMetadata() +{ + { + // Wait if mEncoder is not initialized. + ReentrantMonitorAutoEnter mon(mReentrantMonitor); + while (!mCanceled && !mInitialized) { + mon.Wait(); + } + } + + if (mCanceled || mEncodingComplete) { + return nullptr; + } + + nsRefPtr meta = new VP8Metadata(); + meta->mWidth = mFrameWidth; + meta->mHeight = mFrameHeight; + meta->mEncodedFrameRate = mEncodedFrameRate; + + return meta.forget(); +} + +nsresult +VP8TrackEncoder::GetEncodedPartitions(EncodedFrameContainer& aData) +{ + vpx_codec_iter_t iter = nullptr; + EncodedFrame::FrameType frameType = EncodedFrame::P_FRAME; + nsTArray frameData; + const vpx_codec_cx_pkt_t *pkt = nullptr; + while ((pkt = vpx_codec_get_cx_data(mVPXContext, &iter)) != nullptr) { + switch (pkt->kind) { + case VPX_CODEC_CX_FRAME_PKT: { + // Copy the encoded data from libvpx to frameData + frameData.AppendElements((uint8_t*)pkt->data.frame.buf, + pkt->data.frame.sz); + break; + } + default: { + break; + } + } + // End of frame + if ((pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT) == 0) { + if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) { + frameType = EncodedFrame::I_FRAME; + } + break; + } + } + + if (!frameData.IsEmpty() && + (pkt->data.frame.pts == mEncodedTimestamp)) { + // Copy the encoded data to aData. + EncodedFrame* videoData = new EncodedFrame(); + videoData->SetFrameType(frameType); + // Convert the timestamp and duration to Usecs. + CheckedInt64 timestamp = FramesToUsecs(mEncodedTimestamp, mTrackRate); + if (timestamp.isValid()) { + videoData->SetTimeStamp( + (uint64_t)FramesToUsecs(mEncodedTimestamp, mTrackRate).value()); + } + CheckedInt64 duration = FramesToUsecs(pkt->data.frame.duration, mTrackRate); + if (duration.isValid()) { + videoData->SetDuration( + (uint64_t)FramesToUsecs(pkt->data.frame.duration, mTrackRate).value()); + } + videoData->SetFrameData(&frameData); + VP8LOG("GetEncodedPartitions TimeStamp %lld Duration %lld\n", + videoData->GetTimeStamp(), videoData->GetDuration()); + VP8LOG("frameType %d\n", videoData->GetFrameType()); + aData.AppendEncodedFrame(videoData); + } + + return NS_OK; +} + +void VP8TrackEncoder::PrepareMutedFrame() +{ + if (mMuteFrame.IsEmpty()) { + CreateMutedFrame(&mMuteFrame); + } + + uint32_t yPlanSize = mFrameWidth * mFrameHeight; + uint32_t halfWidth = (mFrameWidth + 1) / 2; + uint32_t halfHeight = (mFrameHeight + 1) / 2; + uint32_t uvPlanSize = halfWidth * halfHeight; + + MOZ_ASSERT(mMuteFrame.Length() >= (yPlanSize + uvPlanSize)); + uint8_t *y = mMuteFrame.Elements(); + uint8_t *cb = mMuteFrame.Elements() + yPlanSize; + uint8_t *cr = mMuteFrame.Elements() + yPlanSize + uvPlanSize; + + mVPXImageWrapper->planes[PLANE_Y] = y; + mVPXImageWrapper->planes[PLANE_U] = cb; + mVPXImageWrapper->planes[PLANE_V] = cr; + mVPXImageWrapper->stride[VPX_PLANE_Y] = mFrameWidth; + mVPXImageWrapper->stride[VPX_PLANE_U] = halfWidth; + mVPXImageWrapper->stride[VPX_PLANE_V] = halfWidth; +} + +nsresult VP8TrackEncoder::PrepareRawFrame(VideoChunk &aChunk) +{ + if (aChunk.mFrame.GetForceBlack()) { + PrepareMutedFrame(); + } else { + layers::Image* img = aChunk.mFrame.GetImage(); + if (NS_WARN_IF(!img)) { + return NS_ERROR_NULL_POINTER; + } + ImageFormat format = img->GetFormat(); + if (format != PLANAR_YCBCR) { + VP8LOG("Unsupported video format\n"); + return NS_ERROR_FAILURE; + } + + // Cast away constness b/c some of the accessors are non-const + layers::PlanarYCbCrImage* yuv = + const_cast(static_cast(img)); + // Big-time assumption here that this is all contiguous data coming + // from getUserMedia or other sources. + MOZ_ASSERT(yuv); + const layers::PlanarYCbCrImage::Data *data = yuv->GetData(); + + mVPXImageWrapper->planes[PLANE_Y] = data->mYChannel; + mVPXImageWrapper->planes[PLANE_U] = data->mCbChannel; + mVPXImageWrapper->planes[PLANE_V] = data->mCrChannel; + mVPXImageWrapper->stride[VPX_PLANE_Y] = data->mYStride; + mVPXImageWrapper->stride[VPX_PLANE_U] = data->mCbCrStride; + mVPXImageWrapper->stride[VPX_PLANE_V] = data->mCbCrStride; + } + return NS_OK; +} + +// These two define value used in GetNextEncodeOperation to determine the +// EncodeOperation for next target frame. +#define I_FRAME_RATIO (0.5) +#define SKIP_FRAME_RATIO (0.75) + +/** + * Compares the elapsed time from the beginning of GetEncodedTrack and + * the processed frame duration in mSourceSegment + * in order to set the nextEncodeOperation for next target frame. + */ +VP8TrackEncoder::EncodeOperation +VP8TrackEncoder::GetNextEncodeOperation(TimeDuration aTimeElapsed, + TrackTicks aProcessedDuration) +{ + int64_t durationInUsec = + FramesToUsecs(aProcessedDuration + mEncodedFrameDuration, + mTrackRate).value(); + if (aTimeElapsed.ToMicroseconds() > (durationInUsec * SKIP_FRAME_RATIO)) { + // The encoder is too slow. + // We should skip next frame to consume the mSourceSegment. + return SKIP_FRAME; + } else if (aTimeElapsed.ToMicroseconds() > (durationInUsec * I_FRAME_RATIO)) { + // The encoder is a little slow. + // We force the encoder to encode an I-frame to accelerate. + return ENCODE_I_FRAME; + } else { + return ENCODE_NORMAL_FRAME; + } +} + +TrackTicks +VP8TrackEncoder::CalculateRemainingTicks(TrackTicks aDurationCopied, + TrackTicks aEncodedDuration) +{ + return mRemainingTicks + aEncodedDuration - aDurationCopied; +} + +// Try to extend the encodedDuration as long as possible if the target frame +// has a long duration. +TrackTicks +VP8TrackEncoder::CalculateEncodedDuration(TrackTicks aDurationCopied) +{ + TrackTicks temp64 = aDurationCopied; + TrackTicks encodedDuration = mEncodedFrameDuration; + temp64 -= mRemainingTicks; + while (temp64 > mEncodedFrameDuration) { + temp64 -= mEncodedFrameDuration; + encodedDuration += mEncodedFrameDuration; + } + return encodedDuration; +} + +/** + * Encoding flow in GetEncodedTrack(): + * 1: Check the mInitialized state and the packet duration. + * 2: Move the data from mRawSegment to mSourceSegment. + * 3: Encode the video chunks in mSourceSegment in a for-loop. + * 3.1: Pick the video chunk by mRemainingTicks. + * 3.2: Calculate the encoding duration for the parameter of vpx_codec_encode(). + * The encoding duration is a multiple of mEncodedFrameDuration. + * 3.3: Setup the video chunk to mVPXImageWrapper by PrepareRawFrame(). + * 3.4: Send frame into vp8 encoder by vpx_codec_encode(). + * 3.5: Get the output frame from encoder by calling GetEncodedPartitions(). + * 3.6: Calculate the mRemainingTicks for next target frame. + * 3.7: Set the nextEncodeOperation for the next target frame. + * There is a heuristic: If the frame duration we have processed in + * mSourceSegment is 100ms, means that we can't spend more than 100ms to + * encode it. + * 4. Remove the encoded chunks in mSourceSegment after for-loop. + * + * Ex1: Input frame rate is 100 => input frame duration is 10ms for each. + * mEncodedFrameRate is 30 => output frame duration is 33ms. + * In this case, the frame duration in mSourceSegment will be: + * 1st : 0~10ms + * 2nd : 10~20ms + * 3rd : 20~30ms + * 4th : 30~40ms + * ... + * The VP8 encoder will take the 1st and 4th frames to encode. At beginning + * mRemainingTicks is 0 for 1st frame, then the mRemainingTicks is set + * to 23 to pick the 4th frame. (mEncodedFrameDuration - 1st frame duration) + * + * Ex2: Input frame rate is 25 => frame duration is 40ms for each. + * mEncodedFrameRate is 30 => output frame duration is 33ms. + * In this case, the frame duration in mSourceSegment will be: + * 1st : 0~40ms + * 2nd : 40~80ms + * 3rd : 80~120ms + * 4th : 120~160ms + * ... + * Because the input frame duration is 40ms larger than 33ms, so the first + * encoded frame duration will be 66ms by calling CalculateEncodedDuration. + * And the mRemainingTicks will be set to 26 + * (CalculateRemainingTicks 0+66-40) in order to pick the next frame(2nd) + * in mSourceSegment. + */ +nsresult +VP8TrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData) +{ + { + // Move all the samples from mRawSegment to mSourceSegment. We only hold + // the monitor in this block. + ReentrantMonitorAutoEnter mon(mReentrantMonitor); + // Wait if mEncoder is not initialized, or when not enough raw data, but is + // not the end of stream nor is being canceled. + while (!mCanceled && (!mInitialized || + (mRawSegment.GetDuration() + mSourceSegment.GetDuration() < + mEncodedFrameDuration && !mEndOfStream))) { + mon.Wait(); + } + if (mCanceled || mEncodingComplete) { + return NS_ERROR_FAILURE; + } + mSourceSegment.AppendFrom(&mRawSegment); + } + + VideoSegment::ChunkIterator iter(mSourceSegment); + TrackTicks durationCopied = 0; + TrackTicks totalProcessedDuration = 0; + TimeStamp timebase = TimeStamp::Now(); + EncodeOperation nextEncodeOperation = ENCODE_NORMAL_FRAME; + + for (; !iter.IsEnded(); iter.Next()) { + VideoChunk &chunk = *iter; + // Accumulate chunk's duration to durationCopied until it reaches + // mRemainingTicks. + durationCopied += chunk.GetDuration(); + MOZ_ASSERT(mRemainingTicks <= mEncodedFrameDuration); + VP8LOG("durationCopied %lld mRemainingTicks %lld\n", + durationCopied, mRemainingTicks); + if (durationCopied >= mRemainingTicks) { + VP8LOG("nextEncodeOperation is %d\n",nextEncodeOperation); + // Calculate encodedDuration for this target frame. + TrackTicks encodedDuration = CalculateEncodedDuration(durationCopied); + + // Encode frame. + if (nextEncodeOperation != SKIP_FRAME) { + nsresult rv = PrepareRawFrame(chunk); + NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); + + // Encode the data with VP8 encoder + int flags = (nextEncodeOperation == ENCODE_NORMAL_FRAME) ? + 0 : VPX_EFLAG_FORCE_KF; + if (vpx_codec_encode(mVPXContext, mVPXImageWrapper, mEncodedTimestamp, + (unsigned long)encodedDuration, flags, + VPX_DL_REALTIME)) { + return NS_ERROR_FAILURE; + } + // Get the encoded data from VP8 encoder. + GetEncodedPartitions(aData); + } else { + // SKIP_FRAME + // Extend the duration of the last encoded data in aData + // because this frame will be skip. + nsRefPtr last = nullptr; + last = aData.GetEncodedFrames().LastElement(); + if (last) { + last->SetDuration(last->GetDuration() + encodedDuration); + } + } + // Move forward the mEncodedTimestamp. + mEncodedTimestamp += encodedDuration; + totalProcessedDuration += durationCopied; + // Calculate mRemainingTicks for next target frame. + mRemainingTicks = CalculateRemainingTicks(durationCopied, + encodedDuration); + + // Check the remain data is enough for next target frame. + if (mSourceSegment.GetDuration() - totalProcessedDuration + >= mEncodedFrameDuration) { + TimeDuration elapsedTime = TimeStamp::Now() - timebase; + nextEncodeOperation = GetNextEncodeOperation(elapsedTime, + totalProcessedDuration); + // Reset durationCopied for next iteration. + durationCopied = 0; + } else { + // Process done, there is no enough data left for next iteration, + // break the for-loop. + break; + } + } + } + // Remove the chunks we have processed. + mSourceSegment.RemoveLeading(totalProcessedDuration); + VP8LOG("RemoveLeading %lld\n",totalProcessedDuration); + + // End of stream, pull the rest frames in encoder. + if (mEndOfStream) { + VP8LOG("mEndOfStream is true\n"); + mEncodingComplete = true; + if (vpx_codec_encode(mVPXContext, nullptr, mEncodedTimestamp, + mEncodedFrameDuration, 0, VPX_DL_REALTIME)) { + return NS_ERROR_FAILURE; + } + GetEncodedPartitions(aData); + } + + return NS_OK ; +} + +} // namespace mozilla diff --git a/content/media/encoder/VP8TrackEncoder.h b/content/media/encoder/VP8TrackEncoder.h new file mode 100644 index 00000000000..af77a6838df --- /dev/null +++ b/content/media/encoder/VP8TrackEncoder.h @@ -0,0 +1,93 @@ +/* -*- 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/. */ + +#ifndef VP8TrackEncoder_h_ +#define VP8TrackEncoder_h_ + +#include "TrackEncoder.h" +#include "vpx/vpx_codec.h" + +namespace mozilla { + +typedef struct vpx_codec_ctx vpx_codec_ctx_t; +typedef struct vpx_codec_enc_cfg vpx_codec_enc_cfg_t; +typedef struct vpx_image vpx_image_t; + +/** + * VP8TrackEncoder implements VideoTrackEncoder by using libvpx library. + * We implement a realtime and fixed FPS encoder. In order to achieve that, + * there is a pick target frame and drop frame encoding policy implemented in + * GetEncodedTrack. + */ +class VP8TrackEncoder : public VideoTrackEncoder +{ + enum EncodeOperation { + ENCODE_NORMAL_FRAME, // VP8 track encoder works normally. + ENCODE_I_FRAME, // The next frame will be encoded as I-Frame. + SKIP_FRAME, // Skip the next frame. + }; +public: + VP8TrackEncoder(); + virtual ~VP8TrackEncoder(); + + already_AddRefed GetMetadata() MOZ_FINAL MOZ_OVERRIDE; + + nsresult GetEncodedTrack(EncodedFrameContainer& aData) MOZ_FINAL MOZ_OVERRIDE; + +protected: + nsresult Init(int32_t aWidth, int32_t aHeight, + TrackRate aTrackRate) MOZ_FINAL MOZ_OVERRIDE; + +private: + // Calculate the target frame's encoded duration. + TrackTicks CalculateEncodedDuration(TrackTicks aDurationCopied); + + // Calculate the mRemainingTicks for next target frame. + TrackTicks CalculateRemainingTicks(TrackTicks aDurationCopied, + TrackTicks aEncodedDuration); + + // Get the EncodeOperation for next target frame. + EncodeOperation GetNextEncodeOperation(TimeDuration aTimeElapsed, + TrackTicks aProcessedDuration); + + // Get the encoded data from encoder to aData. + nsresult GetEncodedPartitions(EncodedFrameContainer& aData); + + // Prepare the input data to the mVPXImageWrapper for encoding. + nsresult PrepareRawFrame(VideoChunk &aChunk); + + // Prepare the muted frame data to the mVPXImageWrapper for encoding. + void PrepareMutedFrame(); + + // Output frame rate. + uint32_t mEncodedFrameRate; + // Duration for the output frame, reciprocal to mEncodedFrameRate. + TrackTicks mEncodedFrameDuration; + // Encoded timestamp. + TrackTicks mEncodedTimestamp; + // Duration to the next encode frame. + TrackTicks mRemainingTicks; + + // Muted frame, we only create it once. + nsTArray mMuteFrame; + + /** + * A local segment queue which takes the raw data out from mRawSegment in the + * call of GetEncodedTrack(). Since we implement the fixed FPS encoding + * policy, it needs to be global in order to store the leftover segments + * taken from mRawSegment. + */ + VideoSegment mSourceSegment; + + // VP8 relative members. + // Codec context structure. + nsAutoPtr mVPXContext; + // Image Descriptor. + nsAutoPtr mVPXImageWrapper; +}; + +} // namespace mozilla + +#endif diff --git a/content/media/encoder/VorbisTrackEncoder.cpp b/content/media/encoder/VorbisTrackEncoder.cpp new file mode 100644 index 00000000000..e8ee529563f --- /dev/null +++ b/content/media/encoder/VorbisTrackEncoder.cpp @@ -0,0 +1,238 @@ +/* -*- 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 "VorbisTrackEncoder.h" +#include +#include +#include "WebMWriter.h" + +// One actually used: Encoding using a VBR quality mode. The usable range is -.1 +// (lowest quality, smallest file) to 1. (highest quality, largest file). +// Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR +// ret = vorbis_encode_init_vbr(&vi,2,44100,.4); +static const float BASE_QUALITY = 0.4f; + +namespace mozilla { + +#undef LOG +#ifdef PR_LOGGING +PRLogModuleInfo* gVorbisTrackEncoderLog; +#define VORBISLOG(msg, ...) PR_LOG(gVorbisTrackEncoderLog, PR_LOG_DEBUG, \ + (msg, ##__VA_ARGS__)) +#else +#define VORBISLOG(msg, ...) +#endif + +VorbisTrackEncoder::VorbisTrackEncoder() + : AudioTrackEncoder() +{ + MOZ_COUNT_CTOR(VorbisTrackEncoder); +#ifdef PR_LOGGING + if (!gVorbisTrackEncoderLog) { + gVorbisTrackEncoderLog = PR_NewLogModule("VorbisTrackEncoder"); + } +#endif +} + +VorbisTrackEncoder::~VorbisTrackEncoder() +{ + MOZ_COUNT_DTOR(VorbisTrackEncoder); + if (mInitialized) { + vorbis_block_clear(&mVorbisBlock); + vorbis_dsp_clear(&mVorbisDsp); + vorbis_info_clear(&mVorbisInfo); + } +} + +nsresult +VorbisTrackEncoder::Init(int aChannels, int aSamplingRate) +{ + if (aChannels <= 0 || aChannels > 8) { + VORBISLOG("aChannels <= 0 || aChannels > 8"); + return NS_ERROR_INVALID_ARG; + } + + // This monitor is used to wake up other methods that are waiting for encoder + // to be completely initialized. + ReentrantMonitorAutoEnter mon(mReentrantMonitor); + mChannels = aChannels; + mSamplingRate = aSamplingRate; + + int ret = 0; + vorbis_info_init(&mVorbisInfo); + + ret = vorbis_encode_init_vbr(&mVorbisInfo, mChannels, mSamplingRate, + BASE_QUALITY); + + mInitialized = (ret == 0); + + if (mInitialized) { + // Set up the analysis state and auxiliary encoding storage + vorbis_analysis_init(&mVorbisDsp, &mVorbisInfo); + vorbis_block_init(&mVorbisDsp, &mVorbisBlock); + } + + mon.NotifyAll(); + + return ret == 0 ? NS_OK : NS_ERROR_FAILURE; +} + +void VorbisTrackEncoder::WriteLacing(nsTArray *aOutput, int32_t aLacing) +{ + while (aLacing > 255) { + aLacing -= 255; + aOutput->AppendElement(255); + } + aOutput->AppendElement((uint8_t)aLacing); +} + +already_AddRefed +VorbisTrackEncoder::GetMetadata() +{ + { + // Wait if encoder is not initialized. + ReentrantMonitorAutoEnter mon(mReentrantMonitor); + while (!mCanceled && !mInitialized) { + mon.Wait(); + } + } + + if (mCanceled || mEncodingComplete) { + return nullptr; + } + + // Vorbis codec specific data + // http://matroska.org/technical/specs/codecid/index.html + nsRefPtr meta = new VorbisMetadata(); + meta->mBitDepth = 32; // float for desktop + meta->mChannels = mChannels; + meta->mSamplingFrequency = mSamplingRate; + ogg_packet header; + ogg_packet header_comm; + ogg_packet header_code; + // Add comment + vorbis_comment vorbisComment; + vorbis_comment_init(&vorbisComment); + vorbis_comment_add_tag(&vorbisComment, "ENCODER", + NS_LITERAL_CSTRING("Mozilla VorbisTrackEncoder " MOZ_APP_UA_VERSION).get()); + vorbis_analysis_headerout(&mVorbisDsp, &vorbisComment, + &header,&header_comm, &header_code); + vorbis_comment_clear(&vorbisComment); + // number of distinct packets - 1 + meta->mData.AppendElement(2); + // Xiph-style lacing header.bytes, header_comm.bytes + WriteLacing(&(meta->mData), header.bytes); + WriteLacing(&(meta->mData), header_comm.bytes); + + // Append the three packets + meta->mData.AppendElements(header.packet, header.bytes); + meta->mData.AppendElements(header_comm.packet, header_comm.bytes); + meta->mData.AppendElements(header_code.packet, header_code.bytes); + + return meta.forget(); +} + +void +VorbisTrackEncoder::GetEncodedFrames(EncodedFrameContainer& aData) +{ + // vorbis does some data preanalysis, then divvies up blocks for + // more involved (potentially parallel) processing. Get a single + // block for encoding now. + while (vorbis_analysis_blockout(&mVorbisDsp, &mVorbisBlock) == 1) { + ogg_packet oggPacket; + if (vorbis_analysis(&mVorbisBlock, &oggPacket) == 0) { + VORBISLOG("vorbis_analysis_blockout block size %d", oggPacket.bytes); + EncodedFrame* audiodata = new EncodedFrame(); + audiodata->SetFrameType(EncodedFrame::AUDIO_FRAME); + nsTArray frameData; + frameData.AppendElements(oggPacket.packet, oggPacket.bytes); + audiodata->SetFrameData(&frameData); + aData.AppendEncodedFrame(audiodata); + } + } +} + +nsresult +VorbisTrackEncoder::GetEncodedTrack(EncodedFrameContainer& aData) +{ + if (mEosSetInEncoder) { + return NS_OK; + } + + nsAutoPtr sourceSegment; + sourceSegment = new AudioSegment(); + { + // Move all the samples from mRawSegment to sourceSegment. We only hold + // the monitor in this block. + ReentrantMonitorAutoEnter mon(mReentrantMonitor); + + // Wait if mEncoder is not initialized, or when not enough raw data, but is + // not the end of stream nor is being canceled. + while (!mCanceled && mRawSegment.GetDuration() < GetPacketDuration() && + !mEndOfStream) { + mon.Wait(); + } + VORBISLOG("GetEncodedTrack passes wait, duration is %lld\n", + mRawSegment.GetDuration()); + if (mCanceled || mEncodingComplete) { + return NS_ERROR_FAILURE; + } + + sourceSegment->AppendFrom(&mRawSegment); + } + + if (mEndOfStream && (sourceSegment->GetDuration() == 0) + && !mEosSetInEncoder) { + mEncodingComplete = true; + mEosSetInEncoder = true; + VORBISLOG("[Vorbis] Done encoding."); + vorbis_analysis_wrote(&mVorbisDsp, 0); + GetEncodedFrames(aData); + + return NS_OK; + } + + // Start encoding data. + AudioSegment::ChunkIterator iter(*sourceSegment); + + AudioDataValue **vorbisBuffer = + vorbis_analysis_buffer(&mVorbisDsp, (int)sourceSegment->GetDuration()); + + int framesCopied = 0; + nsAutoTArray interleavedPcm; + nsAutoTArray nonInterleavedPcm; + interleavedPcm.SetLength(sourceSegment->GetDuration() * mChannels); + nonInterleavedPcm.SetLength(sourceSegment->GetDuration() * mChannels); + while (!iter.IsEnded()) { + AudioChunk chunk = *iter; + int frameToCopy = chunk.GetDuration(); + if (!chunk.IsNull()) { + InterleaveTrackData(chunk, frameToCopy, mChannels, + interleavedPcm.Elements() + framesCopied * mChannels); + } else { // empty data + memset(interleavedPcm.Elements() + framesCopied * mChannels, 0, + frameToCopy * mChannels * sizeof(AudioDataValue)); + } + framesCopied += frameToCopy; + iter.Next(); + } + // De-interleave the interleavedPcm. + DeInterleaveTrackData(interleavedPcm.Elements(), framesCopied, mChannels, + nonInterleavedPcm.Elements()); + // Copy the nonInterleavedPcm to vorbis buffer. + for(uint8_t i = 0; i < mChannels; ++i) { + memcpy(vorbisBuffer[i], nonInterleavedPcm.Elements() + framesCopied * i, + framesCopied * sizeof(AudioDataValue)); + } + + // Now the vorbisBuffer contain the all data in non-interleaved. + // Tell the library how much we actually submitted. + vorbis_analysis_wrote(&mVorbisDsp, framesCopied); + VORBISLOG("vorbis_analysis_wrote framesCopied %d\n", framesCopied); + GetEncodedFrames(aData); + + return NS_OK; +} + +} // namespace mozilla diff --git a/content/media/encoder/VorbisTrackEncoder.h b/content/media/encoder/VorbisTrackEncoder.h new file mode 100644 index 00000000000..2b0fe94c7cd --- /dev/null +++ b/content/media/encoder/VorbisTrackEncoder.h @@ -0,0 +1,54 @@ +/* -*- 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/. */ + +#ifndef VorbisTrackEncoder_h_ +#define VorbisTrackEncoder_h_ + +#include "TrackEncoder.h" +#include "nsCOMPtr.h" +#include + +namespace mozilla { + +class VorbisTrackEncoder : public AudioTrackEncoder +{ +public: + VorbisTrackEncoder(); + virtual ~VorbisTrackEncoder(); + + already_AddRefed GetMetadata() MOZ_FINAL MOZ_OVERRIDE; + + nsresult GetEncodedTrack(EncodedFrameContainer& aData) MOZ_FINAL MOZ_OVERRIDE; + +protected: + /** + * http://xiph.org/vorbis/doc/libvorbis/vorbis_analysis_buffer.html + * We use 1024 samples for the write buffer; libvorbis will construct packets + * with the appropriate duration for the encoding mode internally. + */ + int GetPacketDuration() MOZ_FINAL MOZ_OVERRIDE { + return 1024; + } + + nsresult Init(int aChannels, int aSamplingRate) MOZ_FINAL MOZ_OVERRIDE; + +private: + // Write Xiph-style lacing to aOutput. + void WriteLacing(nsTArray *aOutput, int32_t aLacing); + + // Get the encoded data from vorbis encoder and append into aData. + void GetEncodedFrames(EncodedFrameContainer& aData); + + // vorbis codec members + // Struct that stores all the static vorbis bitstream settings. + vorbis_info mVorbisInfo; + // Central working state for the PCM->packet encoder. + vorbis_dsp_state mVorbisDsp; + // Local working space for PCM->packet encode. + vorbis_block mVorbisBlock; +}; + +} +#endif diff --git a/content/media/encoder/moz.build b/content/media/encoder/moz.build index 6220155e870..5db303e7681 100644 --- a/content/media/encoder/moz.build +++ b/content/media/encoder/moz.build @@ -20,13 +20,21 @@ UNIFIED_SOURCES += [ 'TrackEncoder.cpp', ] +if CONFIG['MOZ_OMX_ENCODER']: + EXPORTS += ['OmxTrackEncoder.h'] + UNIFIED_SOURCES += ['OmxTrackEncoder.cpp'] + if CONFIG['MOZ_OPUS']: EXPORTS += ['OpusTrackEncoder.h'] UNIFIED_SOURCES += ['OpusTrackEncoder.cpp'] -if CONFIG['MOZ_OMX_ENCODER']: - EXPORTS += ['OmxTrackEncoder.h'] - UNIFIED_SOURCES += ['OmxTrackEncoder.cpp'] +if CONFIG['MOZ_WEBM_ENCODER']: + EXPORTS += ['VorbisTrackEncoder.h', + 'VP8TrackEncoder.h', + ] + UNIFIED_SOURCES += ['VorbisTrackEncoder.cpp', + 'VP8TrackEncoder.cpp', + ] FAIL_ON_WARNINGS = True diff --git a/content/media/webm/EbmlComposer.cpp b/content/media/webm/EbmlComposer.cpp new file mode 100644 index 00000000000..81b51d669b5 --- /dev/null +++ b/content/media/webm/EbmlComposer.cpp @@ -0,0 +1,177 @@ +/* -*- 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 "EbmlComposer.h" +#include "libmkv/EbmlIDs.h" +#include "libmkv/EbmlWriter.h" +#include "libmkv/WebMElement.h" +#include "prtime.h" + +namespace mozilla { + +// Timecode scale in nanoseconds +static const unsigned long TIME_CODE_SCALE = 1000000; +// The WebM header size without audio CodecPrivateData +static const int32_t DEFAULT_HEADER_SIZE = 1024; + +void EbmlComposer::GenerateHeader() +{ + // Write the EBML header. + EbmlGlobal ebml; + // The WEbM header default size usually smaller than 1k. + nsAutoArrayPtr buffer(new uint8_t[DEFAULT_HEADER_SIZE + + mCodecPrivateData.Length()]); + ebml.buf = buffer.get(); + ebml.offset = 0; + writeHeader(&ebml); + { + EbmlLoc segEbmlLoc, ebmlLocseg, ebmlLoc; + Ebml_StartSubElement(&ebml, &segEbmlLoc, Segment); + { + Ebml_StartSubElement(&ebml, &ebmlLocseg, SeekHead); + // Todo: We don't know the exact sizes of encoded data and ignore this section. + Ebml_EndSubElement(&ebml, &ebmlLocseg); + writeSegmentInformation(&ebml, &ebmlLoc, TIME_CODE_SCALE, 0); + { + EbmlLoc trackLoc; + Ebml_StartSubElement(&ebml, &trackLoc, Tracks); + { + char cid_string[8]; + // Video + if (mWidth > 0 && mHeight > 0) { + strcpy(cid_string, "V_VP8"); + writeVideoTrack(&ebml, 0x1, 0, cid_string, + mWidth, mHeight, mFrameRate); + } + // Audio + if (mCodecPrivateData.Length() > 0) { + strcpy(cid_string, "A_VORBIS"); + writeAudioTrack(&ebml, 0x2, 0x0, cid_string, mSampleFreq, + mChannels, mCodecPrivateData.Elements(), + mCodecPrivateData.Length()); + } + } + Ebml_EndSubElement(&ebml, &trackLoc); + } + } + // The Recording length is unknow and ignore write the whole Segment element size + } + MOZ_ASSERT_IF(ebml.offset > DEFAULT_HEADER_SIZE + mCodecPrivateData.Length(), + "write more data > EBML_BUFFER_SIZE"); + mClusterBuffs.AppendElement(); + mClusterBuffs.LastElement().SetLength(ebml.offset); + memcpy(mClusterBuffs.LastElement().Elements(), ebml.buf, ebml.offset); +} + +void EbmlComposer::FinishCluster() +{ + MOZ_ASSERT(mClusterLengthLoc > 0 ); + MOZ_ASSERT(mClusterHeaderIndex > 0); + for (uint32_t i = 0; i < mClusterBuffs.Length(); i ++ ) { + mClusterCanFlushBuffs.AppendElement()->SwapElements(mClusterBuffs[i]); + } + mClusterBuffs.Clear(); + EbmlGlobal ebml; + EbmlLoc ebmlLoc; + ebmlLoc.offset = mClusterLengthLoc; + ebml.offset = mClusterCanFlushBuffs[mClusterHeaderIndex].Length(); + ebml.buf = mClusterCanFlushBuffs[mClusterHeaderIndex].Elements(); + Ebml_EndSubElement(&ebml, &ebmlLoc); + mClusterHeaderIndex = 0; + mClusterLengthLoc = 0; +} + +void +EbmlComposer::WriteSimpleBlock(EncodedFrame* aFrame) +{ + EbmlGlobal ebml; + ebml.offset = 0; + + if (aFrame->GetFrameType() == EncodedFrame::FrameType::I_FRAME && mClusterHeaderIndex > 0) { + FinishCluster(); + } + + mClusterBuffs.AppendElement(); + mClusterBuffs.LastElement().SetLength(aFrame->GetFrameData().Length() + DEFAULT_HEADER_SIZE); + ebml.buf = mClusterBuffs.LastElement().Elements(); + + if (aFrame->GetFrameType() == EncodedFrame::FrameType::I_FRAME) { + EbmlLoc ebmlLoc; + Ebml_StartSubElement(&ebml, &ebmlLoc, Cluster); + mClusterHeaderIndex = mClusterBuffs.Length() - 1; // current cluster header array index + mClusterLengthLoc = ebmlLoc.offset; + if (aFrame->GetFrameType() != EncodedFrame::FrameType::AUDIO_FRAME) { + mClusterTimecode = aFrame->GetTimeStamp() / PR_USEC_PER_MSEC; + } + Ebml_SerializeUnsigned(&ebml, Timecode, mClusterTimecode); + } + + if (aFrame->GetFrameType() != EncodedFrame::FrameType::AUDIO_FRAME) { + short timeCode = aFrame->GetTimeStamp() / PR_USEC_PER_MSEC - mClusterTimecode; + writeSimpleBlock(&ebml, 0x1, timeCode, aFrame->GetFrameType() == + EncodedFrame::FrameType::I_FRAME, + 0, 0, (unsigned char*)aFrame->GetFrameData().Elements(), + aFrame->GetFrameData().Length()); + } else { + writeSimpleBlock(&ebml, 0x2, 0, false, + 0, 0, (unsigned char*)aFrame->GetFrameData().Elements(), + aFrame->GetFrameData().Length()); + } + MOZ_ASSERT_IF(ebml.offset > DEFAULT_HEADER_SIZE + aFrame->GetFrameData().Length(), + "write more data > EBML_BUFFER_SIZE"); + mClusterBuffs.LastElement().SetLength(ebml.offset); +} + +void +EbmlComposer::SetVideoConfig(uint32_t aWidth, uint32_t aHeight, + float aFrameRate) +{ + MOZ_ASSERT(aWidth > 0, "Width should > 0"); + MOZ_ASSERT(aHeight > 0, "Height should > 0"); + MOZ_ASSERT(aFrameRate > 0, "FrameRate should > 0"); + mWidth = aWidth; + mHeight = aHeight; + mFrameRate = aFrameRate; +} + +void +EbmlComposer::SetAudioConfig(uint32_t aSampleFreq, uint32_t aChannels, + uint32_t aBitDepth) +{ + MOZ_ASSERT(aSampleFreq > 0, "SampleFreq should > 0"); + MOZ_ASSERT(aBitDepth > 0, "BitDepth should > 0"); + MOZ_ASSERT(aChannels > 0, "Channels should > 0"); + mSampleFreq = aSampleFreq; + mBitDepth = aBitDepth; + mChannels = aChannels; +} + +void +EbmlComposer::ExtractBuffer(nsTArray >* aDestBufs, + uint32_t aFlag) +{ + if ((aFlag & ContainerWriter::FLUSH_NEEDED) && mClusterHeaderIndex > 0) { + FinishCluster(); + } + // aDestBufs may have some element + for (uint32_t i = 0; i < mClusterCanFlushBuffs.Length(); i ++ ) { + aDestBufs->AppendElement()->SwapElements(mClusterCanFlushBuffs[i]); + } + mClusterCanFlushBuffs.Clear(); +} + +EbmlComposer::EbmlComposer() + : mClusterHeaderIndex(0) + , mClusterLengthLoc(0) + , mClusterTimecode(0) + , mWidth(0) + , mHeight(0) + , mFrameRate(0) + , mSampleFreq(0) + , mBitDepth(0) + , mChannels(0) +{} + +} diff --git a/content/media/webm/EbmlComposer.h b/content/media/webm/EbmlComposer.h new file mode 100644 index 00000000000..e8f195a3f87 --- /dev/null +++ b/content/media/webm/EbmlComposer.h @@ -0,0 +1,75 @@ +/* -*- 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/. */ + +#ifndef EbmlComposer_h_ +#define EbmlComposer_h_ +#include "nsTArray.h" +#include "ContainerWriter.h" + +namespace mozilla { + +/* + * A WebM muxer helper for package the valid WebM format. + */ +class EbmlComposer { +public: + EbmlComposer(); + /* + * Assign the parameter which header required. + */ + void SetVideoConfig(uint32_t aWidth, uint32_t aHeight, float aFrameRate); + + void SetAudioConfig(uint32_t aSampleFreq, uint32_t aChannels, + uint32_t bitDepth); + /* + * Set the CodecPrivateData for writing in header. + */ + void SetAudioCodecPrivateData(nsTArray& aBufs) + { + mCodecPrivateData.AppendElements(aBufs); + } + /* + * Generate the whole WebM header and output to mBuff. + */ + void GenerateHeader(); + /* + * Insert media encoded buffer into muxer and it would be package + * into SimpleBlock. If no cluster is opened, new cluster will start for writing. + */ + void WriteSimpleBlock(EncodedFrame* aFrame); + /* + * Get valid cluster data. + */ + void ExtractBuffer(nsTArray >* aDestBufs, + uint32_t aFlag = 0); +private: + // Close current cluster and move data to mClusterCanFlushBuffs. + void FinishCluster(); + // The temporary storage for cluster data. + nsTArray > mClusterBuffs; + // The storage which contain valid cluster data. + nsTArray > mClusterCanFlushBuffs; + // Indicate the header index in mClusterBuffs. + uint32_t mClusterHeaderIndex; + // The cluster length position. + uint64_t mClusterLengthLoc; + // Audio codec specific header data. + nsTArray mCodecPrivateData; + + // The timecode of the cluster. + uint64_t mClusterTimecode; + + // Video configuration + int mWidth; + int mHeight; + float mFrameRate; + // Audio configuration + float mSampleFreq; + int mBitDepth; + int mChannels; +}; + +} +#endif diff --git a/content/media/webm/WebMWriter.cpp b/content/media/webm/WebMWriter.cpp new file mode 100644 index 00000000000..872b2e06828 --- /dev/null +++ b/content/media/webm/WebMWriter.cpp @@ -0,0 +1,64 @@ +/* -*- 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 "WebMWriter.h" +#include "EbmlComposer.h" + +namespace mozilla { + +WebMWriter::WebMWriter(uint32_t aTrackTypes) : ContainerWriter() +{ + mMetadataRequiredFlag = aTrackTypes; + mEbmlComposer = new EbmlComposer(); +} + +nsresult +WebMWriter::WriteEncodedTrack(const EncodedFrameContainer& aData, + uint32_t aFlags) +{ + for (uint32_t i = 0 ; i < aData.GetEncodedFrames().Length(); i++) { + mEbmlComposer->WriteSimpleBlock(aData.GetEncodedFrames().ElementAt(i).get()); + } + return NS_OK; +} + +nsresult +WebMWriter::GetContainerData(nsTArray >* aOutputBufs, + uint32_t aFlags) +{ + mEbmlComposer->ExtractBuffer(aOutputBufs, aFlags); + if (aFlags & ContainerWriter::FLUSH_NEEDED) { + mIsWritingComplete = true; + } + return NS_OK; +} + +nsresult +WebMWriter::SetMetadata(TrackMetadataBase* aMetadata) +{ + MOZ_ASSERT(aMetadata); + if (aMetadata->GetKind() == TrackMetadataBase::METADATA_VP8) { + VP8Metadata* meta = static_cast(aMetadata); + MOZ_ASSERT(meta, "Cannot find vp8 encoder metadata"); + mEbmlComposer->SetVideoConfig(meta->mWidth, meta->mHeight, + meta->mEncodedFrameRate); + mMetadataRequiredFlag = mMetadataRequiredFlag & ~ContainerWriter::HAS_VIDEO; + } + + if (aMetadata->GetKind() == TrackMetadataBase::METADATA_VORBIS) { + VorbisMetadata* meta = static_cast(aMetadata); + MOZ_ASSERT(meta, "Cannot find vorbis encoder metadata"); + mEbmlComposer->SetAudioConfig(meta->mSamplingFrequency, meta->mChannels, meta->mBitDepth); + mEbmlComposer->SetAudioCodecPrivateData(meta->mData); + mMetadataRequiredFlag = mMetadataRequiredFlag & ~ContainerWriter::HAS_AUDIO; + } + + if (!mMetadataRequiredFlag) { + mEbmlComposer->GenerateHeader(); + } + return NS_OK; +} + +} // mozilla namespace diff --git a/content/media/webm/WebMWriter.h b/content/media/webm/WebMWriter.h new file mode 100644 index 00000000000..ba4b03f4395 --- /dev/null +++ b/content/media/webm/WebMWriter.h @@ -0,0 +1,70 @@ +/* -*- 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/. */ + +#ifndef WebMWriter_h_ +#define WebMWriter_h_ + +#include "ContainerWriter.h" + +namespace mozilla { + +class EbmlComposer; + +// Vorbis meta data structure +class VorbisMetadata : public TrackMetadataBase +{ +public: + nsTArray mData; + int32_t mChannels; + int32_t mBitDepth; + float mSamplingFrequency; + MetadataKind GetKind() const MOZ_OVERRIDE { return METADATA_VORBIS; } +}; + +// VP8 meta data structure +class VP8Metadata : public TrackMetadataBase +{ +public: + int32_t mWidth; + int32_t mHeight; + int32_t mEncodedFrameRate; + MetadataKind GetKind() const MOZ_OVERRIDE { return METADATA_VP8; } +}; + +/** + * WebM writer helper + * This class accepts encoder to set audio or video meta data or + * encoded data to ebml Composer, and get muxing data through GetContainerData. + * The ctor/dtor run in the MediaRecorder thread, others run in MediaEncoder thread. + */ +class WebMWriter : public ContainerWriter +{ +public: + // aTrackTypes indicate this muxer should multiplex into Video only or A/V foramt. + // Run in MediaRecorder thread + WebMWriter(uint32_t aTrackTypes); + // WriteEncodedTrack inserts raw packets into WebM stream. + nsresult WriteEncodedTrack(const EncodedFrameContainer &aData, + uint32_t aFlags = 0) MOZ_OVERRIDE; + + // GetContainerData outputs multiplexing data. + // aFlags indicates the muxer should enter into finished stage and flush out + // queue data. + nsresult GetContainerData(nsTArray >* aOutputBufs, + uint32_t aFlags = 0) MOZ_OVERRIDE; + + // Assign metadata into muxer + nsresult SetMetadata(TrackMetadataBase* aMetadata) MOZ_OVERRIDE; + +private: + nsAutoPtr mEbmlComposer; + + // Indicate what kind of meta data needed in the writer. + // If this value become 0, it means writer can start to generate header. + uint8_t mMetadataRequiredFlag; +}; + +} +#endif diff --git a/content/media/webm/moz.build b/content/media/webm/moz.build index 500af3e7ce6..f857ee62096 100644 --- a/content/media/webm/moz.build +++ b/content/media/webm/moz.build @@ -15,6 +15,12 @@ UNIFIED_SOURCES += [ 'WebMReader.cpp', ] +if CONFIG['MOZ_WEBM_ENCODER']: + EXPORTS += ['WebMWriter.h'] + UNIFIED_SOURCES += ['EbmlComposer.cpp', + 'WebMWriter.cpp', + ] + FAIL_ON_WARNINGS = True FINAL_LIBRARY = 'gklayout' diff --git a/layout/media/symbols.def.in b/layout/media/symbols.def.in index bc4a56b9946..1d308a318d1 100644 --- a/layout/media/symbols.def.in +++ b/layout/media/symbols.def.in @@ -29,6 +29,17 @@ nestegg_tstamp_scale nestegg_has_cues nestegg_sniff #endif +#ifdef MOZ_WEBM_ENCODER +writeSimpleBlock +writeHeader +writeSegmentInformation +writeVideoTrack +writeAudioTrack +Ebml_Serialize +Ebml_SerializeUnsigned +Ebml_StartSubElement +Ebml_EndSubElement +#endif #ifdef MOZ_VPX #ifndef MOZ_NATIVE_LIBVPX vpx_codec_control_ diff --git a/media/libmkv/AUTHORS b/media/libmkv/AUTHORS new file mode 100644 index 00000000000..a9aa4810634 --- /dev/null +++ b/media/libmkv/AUTHORS @@ -0,0 +1,100 @@ +# This file is automatically generated from the git commit history +# by tools/gen_authors.sh. + +Aaron Watry +Abo Talib Mahfoodh +Adrian Grange +Ahmad Sharif +Alexander Voronov +Alex Converse +Alexis Ballier +Alok Ahuja +Alpha Lam +A.Mahfoodh +Ami Fischman +Andoni Morales Alastruey +Andres Mejia +Aron Rosenberg +Attila Nagy +changjun.yang +chm +Christian Duvivier +Daniel Kang +Deb Mukherjee +Dmitry Kovalev +Dragan Mrdjan +Erik Niemeyer +Fabio Pedretti +Frank Galligan +Fredrik S枚derquist +Fritz Koenig +Gaute Strokkenes +Giuseppe Scrivano +Guillaume Martres +Guillermo Ballester Valor +Hangyu Kuang +Henrik Lundin +Hui Su +Ivan Maltz +James Berry +James Zern +Jan Kratochvil +Janne Salonen +Jeff Faust +Jeff Muizelaar +Jeff Petkau +Jim Bankoski +Jingning Han +Johann Koenig +John Koleszar +Joshua Bleecher Snyder +Joshua Litt +Justin Clift +Justin Lebar +KO Myung-Hun +Lou Quillio +Luca Barbato +Makoto Kato +Mans Rullgard +Marco Paniconi +Mark Mentovai +Martin Ettl +Martin Storsjo +Matthew Heaney +Michael Kohler +Mike Frysinger +Mike Hommey +Mikhal Shemer +Morton Jonuschat +Parag Salasakar +Pascal Massimino +Patrik Westin +Paul Wilkins +Pavol Rusnak +Pawe艂 Hajdan +Philip J盲genstedt +Priit Laes +Rafael 脕vila de Esp铆ndola +Rafa毛l Carr茅 +Ralph Giles +Rob Bradford +Ronald S. Bultje +Sami Pietil盲 +Scott Graham +Scott LaVarnway +Shimon Doodkin +Stefan Holmer +Suman Sunkara +Taekhyun Kim +Takanori MATSUURA +Tamar Levy +Tero Rintaluoma +Thijs Vermeir +Timothy B. Terriberry +Tom Finegan +Vignesh Venkatasubramanian +Yaowu Xu +Yunqing Wang +Google Inc. +The Mozilla Foundation +The Xiph.Org Foundation diff --git a/media/libmkv/EbmlBufferWriter.c b/media/libmkv/EbmlBufferWriter.c new file mode 100644 index 00000000000..8c26e80656e --- /dev/null +++ b/media/libmkv/EbmlBufferWriter.c @@ -0,0 +1,79 @@ +// #include +#include "EbmlBufferWriter.h" +#include "EbmlWriter.h" +// #include +// #include +// #include //_alloca +#include +#include +#include + +void +Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, int buffer_size, unsigned long len) +{ + /* buffer_size: + * 1 - int8_t; + * 2 - int16_t; + * 3 - int32_t; + * 4 - int64_t; + */ + long i; + for(i = len-1; i >= 0; i--) { + unsigned char x; + if (buffer_size == 1) { + x = (char)(*(const int8_t *)buffer_in >> (i * 8)); + } else if (buffer_size == 2) { + x = (char)(*(const int16_t *)buffer_in >> (i * 8)); + } else if (buffer_size == 4) { + x = (char)(*(const int32_t *)buffer_in >> (i * 8)); + } else if (buffer_size == 8) { + x = (char)(*(const int64_t *)buffer_in >> (i * 8)); + } + Ebml_Write(glob, &x, 1); + } +} + +void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len) { + unsigned char *src = glob->buf; + src += glob->offset; + memcpy(src, buffer_in, len); + glob->offset += len; +} + +static void _Serialize(EbmlGlobal *glob, const unsigned char *p, const unsigned char *q) { + while (q != p) { + --q; + + memcpy(&(glob->buf[glob->offset]), q, 1); + glob->offset++; + } +} + +/* +void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, unsigned long len) { + // assert(buf); + + const unsigned char *const p = (const unsigned char *)(buffer_in); + const unsigned char *const q = p + len; + + _Serialize(glob, p, q); +} +*/ + +void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id) { + unsigned long long unknownLen = 0x01FFFFFFFFFFFFFFLL; + Ebml_WriteID(glob, class_id); + ebmlLoc->offset = glob->offset; + // todo this is always taking 8 bytes, this may need later optimization + Ebml_Serialize(glob, (void *)&unknownLen,sizeof(unknownLen), 8); // this is a key that says lenght unknown +} + +void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc) { + unsigned long long size = glob->offset - ebmlLoc->offset - 8; + unsigned long long curOffset = glob->offset; + glob->offset = ebmlLoc->offset; + size |= 0x0100000000000000LL; + Ebml_Serialize(glob, &size,sizeof(size), 8); + glob->offset = curOffset; +} + diff --git a/media/libmkv/EbmlBufferWriter.h b/media/libmkv/EbmlBufferWriter.h new file mode 100644 index 00000000000..d5116ce37ba --- /dev/null +++ b/media/libmkv/EbmlBufferWriter.h @@ -0,0 +1,20 @@ +#ifndef EBMLBUFFERWRITER_HPP +#define EBMLBUFFERWRITER_HPP + +typedef struct { + unsigned long long offset; +} EbmlLoc; + +typedef struct { + unsigned char *buf; + unsigned int length; + unsigned int offset; +} EbmlGlobal; + +void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len); +void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, + int buffer_size, unsigned long len); +void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id); +void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc); + +#endif diff --git a/media/libmkv/EbmlIDs.h b/media/libmkv/EbmlIDs.h new file mode 100644 index 00000000000..3b5da19ad7e --- /dev/null +++ b/media/libmkv/EbmlIDs.h @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ +#ifndef MKV_DEFS_HPP +#define MKV_DEFS_HPP 1 + +/* Commenting out values not available in webm, but available in matroska */ + +enum mkv { + EBML = 0x1A45DFA3, + EBMLVersion = 0x4286, + EBMLReadVersion = 0x42F7, + EBMLMaxIDLength = 0x42F2, + EBMLMaxSizeLength = 0x42F3, + DocType = 0x4282, + DocTypeVersion = 0x4287, + DocTypeReadVersion = 0x4285, +/* CRC_32 = 0xBF, */ + Void = 0xEC, + SignatureSlot = 0x1B538667, + SignatureAlgo = 0x7E8A, + SignatureHash = 0x7E9A, + SignaturePublicKey = 0x7EA5, + Signature = 0x7EB5, + SignatureElements = 0x7E5B, + SignatureElementList = 0x7E7B, + SignedElement = 0x6532, + /* segment */ + Segment = 0x18538067, + /* Meta Seek Information */ + SeekHead = 0x114D9B74, + Seek = 0x4DBB, + SeekID = 0x53AB, + SeekPosition = 0x53AC, + /* Segment Information */ + Info = 0x1549A966, +/* SegmentUID = 0x73A4, */ +/* SegmentFilename = 0x7384, */ +/* PrevUID = 0x3CB923, */ +/* PrevFilename = 0x3C83AB, */ +/* NextUID = 0x3EB923, */ +/* NextFilename = 0x3E83BB, */ +/* SegmentFamily = 0x4444, */ +/* ChapterTranslate = 0x6924, */ +/* ChapterTranslateEditionUID = 0x69FC, */ +/* ChapterTranslateCodec = 0x69BF, */ +/* ChapterTranslateID = 0x69A5, */ + TimecodeScale = 0x2AD7B1, + Segment_Duration = 0x4489, + DateUTC = 0x4461, +/* Title = 0x7BA9, */ + MuxingApp = 0x4D80, + WritingApp = 0x5741, + /* Cluster */ + Cluster = 0x1F43B675, + Timecode = 0xE7, +/* SilentTracks = 0x5854, */ +/* SilentTrackNumber = 0x58D7, */ +/* Position = 0xA7, */ + PrevSize = 0xAB, + BlockGroup = 0xA0, + Block = 0xA1, +/* BlockVirtual = 0xA2, */ + BlockAdditions = 0x75A1, + BlockMore = 0xA6, + BlockAddID = 0xEE, + BlockAdditional = 0xA5, + BlockDuration = 0x9B, +/* ReferencePriority = 0xFA, */ + ReferenceBlock = 0xFB, +/* ReferenceVirtual = 0xFD, */ +/* CodecState = 0xA4, */ +/* Slices = 0x8E, */ +/* TimeSlice = 0xE8, */ + LaceNumber = 0xCC, +/* FrameNumber = 0xCD, */ +/* BlockAdditionID = 0xCB, */ +/* MkvDelay = 0xCE, */ +/* Cluster_Duration = 0xCF, */ + SimpleBlock = 0xA3, +/* EncryptedBlock = 0xAF, */ + /* Track */ + Tracks = 0x1654AE6B, + TrackEntry = 0xAE, + TrackNumber = 0xD7, + TrackUID = 0x73C5, + TrackType = 0x83, + FlagEnabled = 0xB9, + FlagDefault = 0x88, + FlagForced = 0x55AA, + FlagLacing = 0x9C, +/* MinCache = 0x6DE7, */ +/* MaxCache = 0x6DF8, */ + DefaultDuration = 0x23E383, +/* TrackTimecodeScale = 0x23314F, */ +/* TrackOffset = 0x537F, */ + MaxBlockAdditionID = 0x55EE, + Name = 0x536E, + Language = 0x22B59C, + CodecID = 0x86, + CodecPrivate = 0x63A2, + CodecName = 0x258688, +/* AttachmentLink = 0x7446, */ +/* CodecSettings = 0x3A9697, */ +/* CodecInfoURL = 0x3B4040, */ +/* CodecDownloadURL = 0x26B240, */ +/* CodecDecodeAll = 0xAA, */ +/* TrackOverlay = 0x6FAB, */ +/* TrackTranslate = 0x6624, */ +/* TrackTranslateEditionUID = 0x66FC, */ +/* TrackTranslateCodec = 0x66BF, */ +/* TrackTranslateTrackID = 0x66A5, */ + /* video */ + Video = 0xE0, + FlagInterlaced = 0x9A, + WEBM_StereoMode = 0x53B8, + AlphaMode = 0x53C0, + PixelWidth = 0xB0, + PixelHeight = 0xBA, + PixelCropBottom = 0x54AA, + PixelCropTop = 0x54BB, + PixelCropLeft = 0x54CC, + PixelCropRight = 0x54DD, + DisplayWidth = 0x54B0, + DisplayHeight = 0x54BA, + DisplayUnit = 0x54B2, + AspectRatioType = 0x54B3, +/* ColourSpace = 0x2EB524, */ +/* GammaValue = 0x2FB523, */ + FrameRate = 0x2383E3, + /* end video */ + /* audio */ + Audio = 0xE1, + SamplingFrequency = 0xB5, + OutputSamplingFrequency = 0x78B5, + Channels = 0x9F, +/* ChannelPositions = 0x7D7B, */ + BitDepth = 0x6264, + /* end audio */ + /* content encoding */ +/* ContentEncodings = 0x6d80, */ +/* ContentEncoding = 0x6240, */ +/* ContentEncodingOrder = 0x5031, */ +/* ContentEncodingScope = 0x5032, */ +/* ContentEncodingType = 0x5033, */ +/* ContentCompression = 0x5034, */ +/* ContentCompAlgo = 0x4254, */ +/* ContentCompSettings = 0x4255, */ +/* ContentEncryption = 0x5035, */ +/* ContentEncAlgo = 0x47e1, */ +/* ContentEncKeyID = 0x47e2, */ +/* ContentSignature = 0x47e3, */ +/* ContentSigKeyID = 0x47e4, */ +/* ContentSigAlgo = 0x47e5, */ +/* ContentSigHashAlgo = 0x47e6, */ + /* end content encoding */ + /* Cueing Data */ + Cues = 0x1C53BB6B, + CuePoint = 0xBB, + CueTime = 0xB3, + CueTrackPositions = 0xB7, + CueTrack = 0xF7, + CueClusterPosition = 0xF1, + CueBlockNumber = 0x5378 +/* CueCodecState = 0xEA, */ +/* CueReference = 0xDB, */ +/* CueRefTime = 0x96, */ +/* CueRefCluster = 0x97, */ +/* CueRefNumber = 0x535F, */ +/* CueRefCodecState = 0xEB, */ + /* Attachment */ +/* Attachments = 0x1941A469, */ +/* AttachedFile = 0x61A7, */ +/* FileDescription = 0x467E, */ +/* FileName = 0x466E, */ +/* FileMimeType = 0x4660, */ +/* FileData = 0x465C, */ +/* FileUID = 0x46AE, */ +/* FileReferral = 0x4675, */ + /* Chapters */ +/* Chapters = 0x1043A770, */ +/* EditionEntry = 0x45B9, */ +/* EditionUID = 0x45BC, */ +/* EditionFlagHidden = 0x45BD, */ +/* EditionFlagDefault = 0x45DB, */ +/* EditionFlagOrdered = 0x45DD, */ +/* ChapterAtom = 0xB6, */ +/* ChapterUID = 0x73C4, */ +/* ChapterTimeStart = 0x91, */ +/* ChapterTimeEnd = 0x92, */ +/* ChapterFlagHidden = 0x98, */ +/* ChapterFlagEnabled = 0x4598, */ +/* ChapterSegmentUID = 0x6E67, */ +/* ChapterSegmentEditionUID = 0x6EBC, */ +/* ChapterPhysicalEquiv = 0x63C3, */ +/* ChapterTrack = 0x8F, */ +/* ChapterTrackNumber = 0x89, */ +/* ChapterDisplay = 0x80, */ +/* ChapString = 0x85, */ +/* ChapLanguage = 0x437C, */ +/* ChapCountry = 0x437E, */ +/* ChapProcess = 0x6944, */ +/* ChapProcessCodecID = 0x6955, */ +/* ChapProcessPrivate = 0x450D, */ +/* ChapProcessCommand = 0x6911, */ +/* ChapProcessTime = 0x6922, */ +/* ChapProcessData = 0x6933, */ + /* Tagging */ +/* Tags = 0x1254C367, */ +/* Tag = 0x7373, */ +/* Targets = 0x63C0, */ +/* TargetTypeValue = 0x68CA, */ +/* TargetType = 0x63CA, */ +/* Tagging_TrackUID = 0x63C5, */ +/* Tagging_EditionUID = 0x63C9, */ +/* Tagging_ChapterUID = 0x63C4, */ +/* AttachmentUID = 0x63C6, */ +/* SimpleTag = 0x67C8, */ +/* TagName = 0x45A3, */ +/* TagLanguage = 0x447A, */ +/* TagDefault = 0x4484, */ +/* TagString = 0x4487, */ +/* TagBinary = 0x4485, */ +}; +#endif diff --git a/media/libmkv/EbmlWriter.c b/media/libmkv/EbmlWriter.c new file mode 100644 index 00000000000..087e8176a59 --- /dev/null +++ b/media/libmkv/EbmlWriter.c @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ +#include "EbmlWriter.h" +#include +#include +#include +#include +#include "EbmlBufferWriter.h" +#if defined(_MSC_VER) +#define LITERALU64(n) n +#else +#define LITERALU64(n) n##LLU +#endif + +void Ebml_WriteLen(EbmlGlobal *glob, int64_t val) { + /* TODO check and make sure we are not > than 0x0100000000000000LLU */ + unsigned char size = 8; /* size in bytes to output */ + + /* mask to compare for byte size */ + int64_t minVal = 0xff; + + for (size = 1; size < 8; size ++) { + if (val < minVal) + break; + + minVal = (minVal << 7); + } + + val |= (((uint64_t)0x80) << ((size - 1) * 7)); + + Ebml_Serialize(glob, (void *) &val, sizeof(val), size); +} + +void Ebml_WriteString(EbmlGlobal *glob, const char *str) { + const size_t size_ = strlen(str); + const uint64_t size = size_; + Ebml_WriteLen(glob, size); + /* TODO: it's not clear from the spec whether the nul terminator + * should be serialized too. For now we omit the null terminator. + */ + Ebml_Write(glob, str, (unsigned long)size); +} + +void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr) { + const size_t strlen = wcslen(wstr); + + /* TODO: it's not clear from the spec whether the nul terminator + * should be serialized too. For now we include it. + */ + const uint64_t size = strlen; + + Ebml_WriteLen(glob, size); + Ebml_Write(glob, wstr, (unsigned long)size); +} + +void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id) { + int len; + + if (class_id >= 0x01000000) + len = 4; + else if (class_id >= 0x00010000) + len = 3; + else if (class_id >= 0x00000100) + len = 2; + else + len = 1; + + Ebml_Serialize(glob, (void *)&class_id, sizeof(class_id), len); +} + +void Ebml_SerializeUnsigned32(EbmlGlobal *glob, unsigned long class_id, uint32_t ui) { + unsigned char sizeSerialized = 8 | 0x80; + Ebml_WriteID(glob, class_id); + Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1); + Ebml_Serialize(glob, &ui, sizeof(ui), 4); +} + +void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui) { + unsigned char sizeSerialized = 8 | 0x80; + Ebml_WriteID(glob, class_id); + Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1); + Ebml_Serialize(glob, &ui, sizeof(ui), 8); +} + +void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui) { + unsigned char size = 8; /* size in bytes to output */ + unsigned char sizeSerialized = 0; + unsigned long minVal; + + Ebml_WriteID(glob, class_id); + minVal = 0x7fLU; /* mask to compare for byte size */ + + for (size = 1; size < 4; size ++) { + if (ui < minVal) { + break; + } + + minVal <<= 7; + } + + sizeSerialized = 0x80 | size; + Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1); + Ebml_Serialize(glob, &ui, sizeof(ui), size); +} +/* TODO: perhaps this is a poor name for this id serializer helper function */ +void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long bin) { + int size; + for (size = 4; size > 1; size--) { + if (bin & (unsigned int)0x000000ff << ((size - 1) * 8)) + break; + } + Ebml_WriteID(glob, class_id); + Ebml_WriteLen(glob, size); + Ebml_WriteID(glob, bin); +} + +void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d) { + unsigned char len = 0x88; + + Ebml_WriteID(glob, class_id); + Ebml_Serialize(glob, &len, sizeof(len), 1); + Ebml_Serialize(glob, &d, sizeof(d), 8); +} + +void Ebml_WriteSigned16(EbmlGlobal *glob, short val) { + signed long out = ((val & 0x003FFFFF) | 0x00200000) << 8; + Ebml_Serialize(glob, &out, sizeof(out), 3); +} + +void Ebml_SerializeString(EbmlGlobal *glob, unsigned long class_id, const char *s) { + Ebml_WriteID(glob, class_id); + Ebml_WriteString(glob, s); +} + +void Ebml_SerializeUTF8(EbmlGlobal *glob, unsigned long class_id, wchar_t *s) { + Ebml_WriteID(glob, class_id); + Ebml_WriteUTF8(glob, s); +} + +void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char *data, unsigned long data_length) { + Ebml_WriteID(glob, class_id); + Ebml_WriteLen(glob, data_length); + Ebml_Write(glob, data, data_length); +} + +void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize) { + unsigned char tmp = 0; + unsigned long i = 0; + + Ebml_WriteID(glob, 0xEC); + Ebml_WriteLen(glob, vSize); + + for (i = 0; i < vSize; i++) { + Ebml_Write(glob, &tmp, 1); + } +} + +/* TODO Serialize Date */ diff --git a/media/libmkv/EbmlWriter.h b/media/libmkv/EbmlWriter.h new file mode 100644 index 00000000000..3aee2b30314 --- /dev/null +++ b/media/libmkv/EbmlWriter.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef EBMLWRITER_HPP +#define EBMLWRITER_HPP +#include +#include "vpx/vpx_integer.h" +#include "EbmlBufferWriter.h" + +/* note: you must define write and serialize functions as well as your own + * EBML_GLOBAL + * + * These functions MUST be implemented + */ + +// typedef struct EbmlGlobal EbmlGlobal; +// void Ebml_Serialize(EbmlGlobal *glob, const void *, int, unsigned long); +// void Ebml_Write(EbmlGlobal *glob, const void *, unsigned long); + +/*****/ + +void Ebml_WriteLen(EbmlGlobal *glob, int64_t val); +void Ebml_WriteString(EbmlGlobal *glob, const char *str); +void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr); +void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id); +void Ebml_SerializeUnsigned32(EbmlGlobal *glob, unsigned long class_id, uint32_t ui); +void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui); +void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui); +void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long ui); +void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d); +/* TODO make this more generic to signed */ +void Ebml_WriteSigned16(EbmlGlobal *glob, short val); +void Ebml_SerializeString(EbmlGlobal *glob, unsigned long class_id, const char *s); +void Ebml_SerializeUTF8(EbmlGlobal *glob, unsigned long class_id, wchar_t *s); +void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char *data, unsigned long data_length); +void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize); +/* TODO need date function */ +#endif + +#ifdef __cplusplus +} +#endif diff --git a/media/libmkv/LICENSE b/media/libmkv/LICENSE new file mode 100644 index 00000000000..1ce44343c4a --- /dev/null +++ b/media/libmkv/LICENSE @@ -0,0 +1,31 @@ +Copyright (c) 2010, The WebM Project authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google, nor the WebM Project, nor the names + of its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/media/libmkv/README b/media/libmkv/README new file mode 100644 index 00000000000..ce9c1c6945c --- /dev/null +++ b/media/libmkv/README @@ -0,0 +1,139 @@ +vpx Multi-Format Codec SDK +README - 1 August 2013 + +Welcome to the WebM VP8/VP9 Codec SDK! + +COMPILING THE APPLICATIONS/LIBRARIES: + The build system used is similar to autotools. Building generally consists of + "configuring" with your desired build options, then using GNU make to build + the application. + + 1. Prerequisites + + * All x86 targets require the Yasm[1] assembler be installed. + * All Windows builds require that Cygwin[2] be installed. + * Building the documentation requires PHP[3] and Doxygen[4]. If you do not + have these packages, you must pass --disable-install-docs to the + configure script. + * Downloading the data for the unit tests requires curl[5] and sha1sum. + sha1sum is provided via the GNU coreutils, installed by default on + many *nix platforms, as well as MinGW and Cygwin. If coreutils is not + available, a compatible version of sha1sum can be built from + source[6]. These requirements are optional if not running the unit + tests. + + [1]: http://www.tortall.net/projects/yasm + [2]: http://www.cygwin.com + [3]: http://php.net + [4]: http://www.doxygen.org + [5]: http://curl.haxx.se + [6]: http://www.microbrew.org/tools/md5sha1sum/ + + 2. Out-of-tree builds + Out of tree builds are a supported method of building the application. For + an out of tree build, the source tree is kept separate from the object + files produced during compilation. For instance: + + $ mkdir build + $ cd build + $ ../libvpx/configure + $ make + + 3. Configuration options + The 'configure' script supports a number of options. The --help option can be + used to get a list of supported options: + $ ../libvpx/configure --help + + 4. Cross development + For cross development, the most notable option is the --target option. The + most up-to-date list of supported targets can be found at the bottom of the + --help output of the configure script. As of this writing, the list of + available targets is: + + armv5te-android-gcc + armv5te-linux-rvct + armv5te-linux-gcc + armv5te-none-rvct + armv6-darwin-gcc + armv6-linux-rvct + armv6-linux-gcc + armv6-none-rvct + armv7-android-gcc + armv7-darwin-gcc + armv7-linux-rvct + armv7-linux-gcc + armv7-none-rvct + armv7-win32-vs11 + armv7-win32-vs12 + mips32-linux-gcc + ppc32-darwin8-gcc + ppc32-darwin9-gcc + ppc32-linux-gcc + ppc64-darwin8-gcc + ppc64-darwin9-gcc + ppc64-linux-gcc + sparc-solaris-gcc + x86-android-gcc + x86-darwin8-gcc + x86-darwin8-icc + x86-darwin9-gcc + x86-darwin9-icc + x86-darwin10-gcc + x86-darwin11-gcc + x86-darwin12-gcc + x86-darwin13-gcc + x86-linux-gcc + x86-linux-icc + x86-os2-gcc + x86-solaris-gcc + x86-win32-gcc + x86-win32-vs7 + x86-win32-vs8 + x86-win32-vs9 + x86-win32-vs10 + x86-win32-vs11 + x86-win32-vs12 + x86_64-darwin9-gcc + x86_64-darwin10-gcc + x86_64-darwin11-gcc + x86_64-darwin12-gcc + x86_64-darwin13-gcc + x86_64-linux-gcc + x86_64-linux-icc + x86_64-solaris-gcc + x86_64-win64-gcc + x86_64-win64-vs8 + x86_64-win64-vs9 + x86_64-win64-vs10 + x86_64-win64-vs11 + x86_64-win64-vs12 + universal-darwin8-gcc + universal-darwin9-gcc + universal-darwin10-gcc + universal-darwin11-gcc + universal-darwin12-gcc + universal-darwin13-gcc + generic-gnu + + The generic-gnu target, in conjunction with the CROSS environment variable, + can be used to cross compile architectures that aren't explicitly listed, if + the toolchain is a cross GNU (gcc/binutils) toolchain. Other POSIX toolchains + will likely work as well. For instance, to build using the mipsel-linux-uclibc + toolchain, the following command could be used (note, POSIX SH syntax, adapt + to your shell as necessary): + + $ CROSS=mipsel-linux-uclibc- ../libvpx/configure + + In addition, the executables to be invoked can be overridden by specifying the + environment variables: CC, AR, LD, AS, STRIP, NM. Additional flags can be + passed to these executables with CFLAGS, LDFLAGS, and ASFLAGS. + + 5. Configuration errors + If the configuration step fails, the first step is to look in the error log. + This defaults to config.log. This should give a good indication of what went + wrong. If not, contact us for support. + +SUPPORT + This library is an open source project supported by its community. Please + please email webm-discuss@webmproject.org for help. + diff --git a/media/libmkv/README_MOZILLA b/media/libmkv/README_MOZILLA new file mode 100644 index 00000000000..ce1112ad1c1 --- /dev/null +++ b/media/libmkv/README_MOZILLA @@ -0,0 +1,6 @@ +The source from this directory was copied from the libvpx/third_party/libmkv +git repository using the update.sh script. + +The libvpx git repository is: http://git.chromium.org/webm/libvpx.git + +The git commit ID used was c5aaf923d80e9f71e0c93d7d99dc1e2f83d7acbf. diff --git a/media/libmkv/WebMElement.c b/media/libmkv/WebMElement.c new file mode 100644 index 00000000000..0d5056d462b --- /dev/null +++ b/media/libmkv/WebMElement.c @@ -0,0 +1,219 @@ +// Copyright (c) 2010 The WebM project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#include "EbmlIDs.h" +#include "WebMElement.h" +#include +#include +#include +#include + +#define kVorbisPrivateMaxSize 4000 +#define UInt64 uint64_t + +void writeHeader(EbmlGlobal *glob) { + EbmlLoc start; + Ebml_StartSubElement(glob, &start, EBML); + Ebml_SerializeUnsigned(glob, EBMLVersion, 1); + Ebml_SerializeUnsigned(glob, EBMLReadVersion, 1); // EBML Read Version + Ebml_SerializeUnsigned(glob, EBMLMaxIDLength, 4); // EBML Max ID Length + Ebml_SerializeUnsigned(glob, EBMLMaxSizeLength, 8); // EBML Max Size Length + Ebml_SerializeString(glob, DocType, "webm"); // Doc Type + Ebml_SerializeUnsigned(glob, DocTypeVersion, 2); // Doc Type Version + Ebml_SerializeUnsigned(glob, DocTypeReadVersion, 2); // Doc Type Read Version + Ebml_EndSubElement(glob, &start); +} + +void writeSimpleBlock(EbmlGlobal *glob, unsigned char trackNumber, short timeCode, + int isKeyframe, unsigned char lacingFlag, int discardable, + unsigned char *data, unsigned long dataLength) { + unsigned long blockLength = 4 + dataLength; + unsigned char flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) | discardable; + Ebml_WriteID(glob, SimpleBlock); + blockLength |= 0x10000000; // TODO check length < 0x0FFFFFFFF + Ebml_Serialize(glob, &blockLength, sizeof(blockLength), 4); + trackNumber |= 0x80; // TODO check track nubmer < 128 + Ebml_Write(glob, &trackNumber, 1); + // Ebml_WriteSigned16(glob, timeCode,2); //this is 3 bytes + Ebml_Serialize(glob, &timeCode, sizeof(timeCode), 2); + flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) | discardable; + Ebml_Write(glob, &flags, 1); + Ebml_Write(glob, data, dataLength); +} + +static UInt64 generateTrackID(unsigned int trackNumber) { + UInt64 t = time(NULL) * trackNumber; + UInt64 r = rand(); + r = r << 32; + r += rand(); +// UInt64 rval = t ^ r; + return t ^ r; +} + +void writeVideoTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, + char *codecId, unsigned int pixelWidth, unsigned int pixelHeight, + double frameRate) { + EbmlLoc start; + UInt64 trackID; + Ebml_StartSubElement(glob, &start, TrackEntry); + Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber); + trackID = generateTrackID(trackNumber); + Ebml_SerializeUnsigned(glob, TrackUID, trackID); + Ebml_SerializeString(glob, CodecName, "VP8"); // TODO shouldn't be fixed + + Ebml_SerializeUnsigned(glob, TrackType, 1); // video is always 1 + Ebml_SerializeString(glob, CodecID, codecId); + { + EbmlLoc videoStart; + Ebml_StartSubElement(glob, &videoStart, Video); + Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth); + Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight); + Ebml_SerializeFloat(glob, FrameRate, frameRate); + Ebml_EndSubElement(glob, &videoStart); // Video + } + Ebml_EndSubElement(glob, &start); // Track Entry +} +void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, + char *codecId, double samplingFrequency, unsigned int channels, + unsigned char *private, unsigned long privateSize) { + EbmlLoc start; + UInt64 trackID; + Ebml_StartSubElement(glob, &start, TrackEntry); + Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber); + trackID = generateTrackID(trackNumber); + Ebml_SerializeUnsigned(glob, TrackUID, trackID); + Ebml_SerializeUnsigned(glob, TrackType, 2); // audio is always 2 + // I am using defaults for thesed required fields + /* Ebml_SerializeUnsigned(glob, FlagEnabled, 1); + Ebml_SerializeUnsigned(glob, FlagDefault, 1); + Ebml_SerializeUnsigned(glob, FlagForced, 1); + Ebml_SerializeUnsigned(glob, FlagLacing, flagLacing);*/ + Ebml_SerializeString(glob, CodecID, codecId); + Ebml_SerializeData(glob, CodecPrivate, private, privateSize); + + Ebml_SerializeString(glob, CodecName, "VORBIS"); // fixed for now + { + EbmlLoc AudioStart; + Ebml_StartSubElement(glob, &AudioStart, Audio); + Ebml_SerializeFloat(glob, SamplingFrequency, samplingFrequency); + Ebml_SerializeUnsigned(glob, Channels, channels); + Ebml_EndSubElement(glob, &AudioStart); + } + Ebml_EndSubElement(glob, &start); +} +void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc *startInfo, unsigned long timeCodeScale, double duration) { + Ebml_StartSubElement(ebml, startInfo, Info); + Ebml_SerializeUnsigned(ebml, TimecodeScale, timeCodeScale); + Ebml_SerializeFloat(ebml, Segment_Duration, duration * 1000.0); // Currently fixed to using milliseconds + Ebml_SerializeString(ebml, 0x4D80, "QTmuxingAppLibWebM-0.0.1"); + Ebml_SerializeString(ebml, 0x5741, "QTwritingAppLibWebM-0.0.1"); + Ebml_EndSubElement(ebml, startInfo); +} + +/* +void Mkv_InitializeSegment(Ebml& ebml_out, EbmlLoc& ebmlLoc) +{ + Ebml_StartSubElement(ebml_out, ebmlLoc, 0x18538067); +} + +void Mkv_InitializeSeek(Ebml& ebml_out, EbmlLoc& ebmlLoc) +{ + Ebml_StartSubElement(ebml_out, ebmlLoc, 0x114d9b74); +} +void Mkv_WriteSeekInformation(Ebml& ebml_out, SeekStruct& seekInformation) +{ + EbmlLoc ebmlLoc; + Ebml_StartSubElement(ebml_out, ebmlLoc, 0x4dbb); + Ebml_SerializeString(ebml_out, 0x53ab, seekInformation.SeekID); + Ebml_SerializeUnsigned(ebml_out, 0x53ac, seekInformation.SeekPosition); + Ebml_EndSubElement(ebml_out, ebmlLoc); +} + +void Mkv_WriteSegmentInformation(Ebml& ebml_out, SegmentInformationStruct& segmentInformation) +{ + Ebml_SerializeUnsigned(ebml_out, 0x73a4, segmentInformation.segmentUID); + if (segmentInformation.filename != 0) + Ebml_SerializeString(ebml_out, 0x7384, segmentInformation.filename); + Ebml_SerializeUnsigned(ebml_out, 0x2AD7B1, segmentInformation.TimecodeScale); + Ebml_SerializeUnsigned(ebml_out, 0x4489, segmentInformation.Duration); + // TODO date + Ebml_SerializeWString(ebml_out, 0x4D80, L"MKVMUX"); + Ebml_SerializeWString(ebml_out, 0x5741, segmentInformation.WritingApp); +} + +void Mkv_InitializeTrack(Ebml& ebml_out, EbmlLoc& ebmlLoc) +{ + Ebml_StartSubElement(ebml_out, ebmlLoc, 0x1654AE6B); +} + +static void Mkv_WriteGenericTrackData(Ebml& ebml_out, TrackStruct& track) +{ + Ebml_SerializeUnsigned(ebml_out, 0xD7, track.TrackNumber); + Ebml_SerializeUnsigned(ebml_out, 0x73C5, track.TrackUID); + Ebml_SerializeUnsigned(ebml_out, 0x83, track.TrackType); + Ebml_SerializeUnsigned(ebml_out, 0xB9, track.FlagEnabled ? 1 :0); + Ebml_SerializeUnsigned(ebml_out, 0x88, track.FlagDefault ? 1 :0); + Ebml_SerializeUnsigned(ebml_out, 0x55AA, track.FlagForced ? 1 :0); + if (track.Language != 0) + Ebml_SerializeString(ebml_out, 0x22B59C, track.Language); + if (track.CodecID != 0) + Ebml_SerializeString(ebml_out, 0x86, track.CodecID); + if (track.CodecPrivate != 0) + Ebml_SerializeData(ebml_out, 0x63A2, track.CodecPrivate, track.CodecPrivateLength); + if (track.CodecName != 0) + Ebml_SerializeWString(ebml_out, 0x258688, track.CodecName); +} + +void Mkv_WriteVideoTrack(Ebml& ebml_out, TrackStruct & track, VideoTrackStruct& video) +{ + EbmlLoc trackHeadLoc, videoHeadLoc; + Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); // start Track + Mkv_WriteGenericTrackData(ebml_out, track); + Ebml_StartSubElement(ebml_out, videoHeadLoc, 0xE0); // start Video + Ebml_SerializeUnsigned(ebml_out, 0x9A, video.FlagInterlaced ? 1 :0); + Ebml_SerializeUnsigned(ebml_out, 0xB0, video.PixelWidth); + Ebml_SerializeUnsigned(ebml_out, 0xBA, video.PixelHeight); + Ebml_SerializeUnsigned(ebml_out, 0x54B0, video.PixelDisplayWidth); + Ebml_SerializeUnsigned(ebml_out, 0x54BA, video.PixelDisplayHeight); + Ebml_SerializeUnsigned(ebml_out, 0x54B2, video.displayUnit); + Ebml_SerializeFloat(ebml_out, 0x2383E3, video.FrameRate); + Ebml_EndSubElement(ebml_out, videoHeadLoc); + Ebml_EndSubElement(ebml_out, trackHeadLoc); + +} + +void Mkv_WriteAudioTrack(Ebml& ebml_out, TrackStruct & track, AudioTrackStruct& video) +{ + EbmlLoc trackHeadLoc, audioHeadLoc; + Ebml_StartSubElement(ebml_out, trackHeadLoc, 0xAE); + Mkv_WriteGenericTrackData(ebml_out, track); + Ebml_StartSubElement(ebml_out, audioHeadLoc, 0xE0); // start Audio + Ebml_SerializeFloat(ebml_out, 0xB5, video.SamplingFrequency); + Ebml_SerializeUnsigned(ebml_out, 0x9F, video.Channels); + Ebml_SerializeUnsigned(ebml_out, 0x6264, video.BitDepth); + Ebml_EndSubElement(ebml_out, audioHeadLoc); // end audio + Ebml_EndSubElement(ebml_out, trackHeadLoc); +} + +void Mkv_WriteEbmlClusterHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, ClusterHeadStruct & clusterHead) +{ + Ebml_StartSubElement(ebml_out, ebmlLoc, 0x1F43B675); + Ebml_SerializeUnsigned(ebml_out, 0x6264, clusterHead.TimeCode); +} + +void Mkv_WriteSimpleBlockHead(Ebml& ebml_out, EbmlLoc& ebmlLoc, SimpleBlockStruct& block) +{ + Ebml_StartSubElement(ebml_out, ebmlLoc, 0xA3); + Ebml_Write1UInt(ebml_out, block.TrackNumber); + Ebml_WriteSigned16(ebml_out,block.TimeCode); + unsigned char flags = 0x00 | (block.iskey ? 0x80:0x00) | (block.lacing << 1) | block.discardable; + Ebml_Write1UInt(ebml_out, flags); // TODO this may be the wrong function + Ebml_Serialize(ebml_out, block.data, block.dataLength); + Ebml_EndSubElement(ebml_out,ebmlLoc); +} +*/ diff --git a/media/libmkv/WebMElement.h b/media/libmkv/WebMElement.h new file mode 100644 index 00000000000..8fd19163fea --- /dev/null +++ b/media/libmkv/WebMElement.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 The WebM project authors. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MKV_CONTEXT_HPP +#define MKV_CONTEXT_HPP 1 + +#include "EbmlWriter.h" + +// these are helper functions +void writeHeader(EbmlGlobal *ebml); +void writeSegmentInformation(EbmlGlobal *ebml, EbmlLoc *startInfo, unsigned long timeCodeScale, double duration); +// this function is a helper only, it assumes a lot of defaults +void writeVideoTrack(EbmlGlobal *ebml, unsigned int trackNumber, int flagLacing, + char *codecId, unsigned int pixelWidth, unsigned int pixelHeight, + double frameRate); +void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, + char *codecId, double samplingFrequency, unsigned int channels, + unsigned char *private_, unsigned long privateSize); + +void writeSimpleBlock(EbmlGlobal *ebml, unsigned char trackNumber, short timeCode, + int isKeyframe, unsigned char lacingFlag, int discardable, + unsigned char *data, unsigned long dataLength); + +#endif + +#ifdef __cplusplus +} +#endif diff --git a/media/libmkv/gecko_fix.patch b/media/libmkv/gecko_fix.patch new file mode 100644 index 00000000000..19015fd0881 --- /dev/null +++ b/media/libmkv/gecko_fix.patch @@ -0,0 +1,133 @@ +diff --git a/EbmlBufferWriter.h b/EbmlBufferWriter.h +index c135f29..d5116ce 100644 +--- a/EbmlBufferWriter.h ++++ b/EbmlBufferWriter.h +@@ -11,6 +11,9 @@ typedef struct { + unsigned int offset; + } EbmlGlobal; + ++void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len); ++void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, ++ int buffer_size, unsigned long len); + void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id); + void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc); + +diff --git a/EbmlIDs.h b/EbmlIDs.h +index 44d4385..3b5da19 100644 +--- a/EbmlIDs.h ++++ b/EbmlIDs.h +@@ -119,7 +119,7 @@ enum mkv { + /* video */ + Video = 0xE0, + FlagInterlaced = 0x9A, +- StereoMode = 0x53B8, ++ WEBM_StereoMode = 0x53B8, + AlphaMode = 0x53C0, + PixelWidth = 0xB0, + PixelHeight = 0xBA, +diff --git a/EbmlWriter.c b/EbmlWriter.c +index ebefc1a..087e817 100644 +--- a/EbmlWriter.c ++++ b/EbmlWriter.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include "EbmlBufferWriter.h" + #if defined(_MSC_VER) + #define LITERALU64(n) n + #else +diff --git a/EbmlWriter.h b/EbmlWriter.h +index a0a848b..3aee2b3 100644 +--- a/EbmlWriter.h ++++ b/EbmlWriter.h +@@ -7,10 +7,16 @@ + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + #ifndef EBMLWRITER_HPP + #define EBMLWRITER_HPP + #include + #include "vpx/vpx_integer.h" ++#include "EbmlBufferWriter.h" + + /* note: you must define write and serialize functions as well as your own + * EBML_GLOBAL +@@ -18,9 +24,9 @@ + * These functions MUST be implemented + */ + +-typedef struct EbmlGlobal EbmlGlobal; +-void Ebml_Serialize(EbmlGlobal *glob, const void *, int, unsigned long); +-void Ebml_Write(EbmlGlobal *glob, const void *, unsigned long); ++// typedef struct EbmlGlobal EbmlGlobal; ++// void Ebml_Serialize(EbmlGlobal *glob, const void *, int, unsigned long); ++// void Ebml_Write(EbmlGlobal *glob, const void *, unsigned long); + + /*****/ + +@@ -41,3 +47,7 @@ void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char + void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize); + /* TODO need date function */ + #endif ++ ++#ifdef __cplusplus ++} ++#endif +diff --git a/WebMElement.c b/WebMElement.c +index 02eefa4..0d5056d 100644 +--- a/WebMElement.c ++++ b/WebMElement.c +@@ -6,8 +6,6 @@ + // in the file PATENTS. All contributing project authors may + // be found in the AUTHORS file in the root of the source tree. + +- +-#include "EbmlBufferWriter.h" + #include "EbmlIDs.h" + #include "WebMElement.h" + #include +diff --git a/WebMElement.h b/WebMElement.h +index d9ad0a0..987582a 100644 +--- a/WebMElement.h ++++ b/WebMElement.h +@@ -6,10 +6,15 @@ + // in the file PATENTS. All contributing project authors may + // be found in the AUTHORS file in the root of the source tree. + ++#ifdef __cplusplus ++extern "C" { ++#endif + + #ifndef MKV_CONTEXT_HPP + #define MKV_CONTEXT_HPP 1 + ++#include "EbmlWriter.h" ++ + void writeSimpleBock(EbmlGlobal *ebml, unsigned char trackNumber, unsigned short timeCode, + int isKeyframe, unsigned char lacingFlag, int discardable, + unsigned char *data, unsigned long dataLength); +@@ -24,12 +29,14 @@ void writeVideoTrack(EbmlGlobal *ebml, unsigned int trackNumber, int flagLacing, + double frameRate); + void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, + char *codecId, double samplingFrequency, unsigned int channels, +- unsigned char *private, unsigned long privateSize); ++ unsigned char *private_, unsigned long privateSize); + + void writeSimpleBlock(EbmlGlobal *ebml, unsigned char trackNumber, short timeCode, + int isKeyframe, unsigned char lacingFlag, int discardable, + unsigned char *data, unsigned long dataLength); + ++#endif + +- +-#endif +\ No newline at end of file ++#ifdef __cplusplus ++} ++#endif diff --git a/media/libmkv/moz.build b/media/libmkv/moz.build new file mode 100644 index 00000000000..f1d46acf363 --- /dev/null +++ b/media/libmkv/moz.build @@ -0,0 +1,27 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +EXPORTS.libmkv += [ + 'EbmlBufferWriter.h', + 'EbmlIDs.h', + 'EbmlWriter.h', + 'WebMElement.h', +] + +UNIFIED_SOURCES += [ +] + +# These files can't be unified because of function redefinitions. +SOURCES += [ + 'EbmlBufferWriter.c', + 'EbmlWriter.c', + 'WebMElement.c', +] + +if CONFIG['GKMEDIAS_SHARED_LIBRARY']: + NO_VISIBILITY_FLAGS = True + +FINAL_LIBRARY = 'gkmedias' diff --git a/media/libmkv/source_fix.patch b/media/libmkv/source_fix.patch new file mode 100644 index 00000000000..a50ca1d8a9a --- /dev/null +++ b/media/libmkv/source_fix.patch @@ -0,0 +1,193 @@ +diff --git a/EbmlBufferWriter.c b/EbmlBufferWriter.c +index 574e478..8c26e80 100644 +--- a/EbmlBufferWriter.c ++++ b/EbmlBufferWriter.c +@@ -8,6 +8,31 @@ + #include + #include + ++void ++Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, int buffer_size, unsigned long len) ++{ ++ /* buffer_size: ++ * 1 - int8_t; ++ * 2 - int16_t; ++ * 3 - int32_t; ++ * 4 - int64_t; ++ */ ++ long i; ++ for(i = len-1; i >= 0; i--) { ++ unsigned char x; ++ if (buffer_size == 1) { ++ x = (char)(*(const int8_t *)buffer_in >> (i * 8)); ++ } else if (buffer_size == 2) { ++ x = (char)(*(const int16_t *)buffer_in >> (i * 8)); ++ } else if (buffer_size == 4) { ++ x = (char)(*(const int32_t *)buffer_in >> (i * 8)); ++ } else if (buffer_size == 8) { ++ x = (char)(*(const int64_t *)buffer_in >> (i * 8)); ++ } ++ Ebml_Write(glob, &x, 1); ++ } ++} ++ + void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len) { + unsigned char *src = glob->buf; + src += glob->offset; +@@ -19,12 +44,12 @@ static void _Serialize(EbmlGlobal *glob, const unsigned char *p, const unsigned + while (q != p) { + --q; + +- unsigned long cbWritten; + memcpy(&(glob->buf[glob->offset]), q, 1); + glob->offset++; + } + } + ++/* + void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, unsigned long len) { + // assert(buf); + +@@ -33,22 +58,22 @@ void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, unsigned long len) + + _Serialize(glob, p, q); + } +- ++*/ + + void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id) { ++ unsigned long long unknownLen = 0x01FFFFFFFFFFFFFFLL; + Ebml_WriteID(glob, class_id); + ebmlLoc->offset = glob->offset; + // todo this is always taking 8 bytes, this may need later optimization +- unsigned long long unknownLen = 0x01FFFFFFFFFFFFFFLLU; +- Ebml_Serialize(glob, (void *)&unknownLen, 8); // this is a key that says lenght unknown ++ Ebml_Serialize(glob, (void *)&unknownLen,sizeof(unknownLen), 8); // this is a key that says lenght unknown + } + + void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc) { + unsigned long long size = glob->offset - ebmlLoc->offset - 8; + unsigned long long curOffset = glob->offset; + glob->offset = ebmlLoc->offset; +- size |= 0x0100000000000000LLU; +- Ebml_Serialize(glob, &size, 8); ++ size |= 0x0100000000000000LL; ++ Ebml_Serialize(glob, &size,sizeof(size), 8); + glob->offset = curOffset; + } + +diff --git a/EbmlBufferWriter.h b/EbmlBufferWriter.h +index acd5c2a..c135f29 100644 +--- a/EbmlBufferWriter.h ++++ b/EbmlBufferWriter.h +@@ -11,9 +11,7 @@ typedef struct { + unsigned int offset; + } EbmlGlobal; + +- + void Ebml_StartSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc, unsigned long class_id); + void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc); + +- + #endif +diff --git a/EbmlWriter.c b/EbmlWriter.c +index 27cfe86..ebefc1a 100644 +--- a/EbmlWriter.c ++++ b/EbmlWriter.c +@@ -74,6 +74,13 @@ void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id) { + Ebml_Serialize(glob, (void *)&class_id, sizeof(class_id), len); + } + ++void Ebml_SerializeUnsigned32(EbmlGlobal *glob, unsigned long class_id, uint32_t ui) { ++ unsigned char sizeSerialized = 8 | 0x80; ++ Ebml_WriteID(glob, class_id); ++ Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1); ++ Ebml_Serialize(glob, &ui, sizeof(ui), 4); ++} ++ + void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui) { + unsigned char sizeSerialized = 8 | 0x80; + Ebml_WriteID(glob, class_id); +diff --git a/EbmlWriter.h b/EbmlWriter.h +index b94f757..a0a848b 100644 +--- a/EbmlWriter.h ++++ b/EbmlWriter.h +@@ -28,6 +28,7 @@ void Ebml_WriteLen(EbmlGlobal *glob, int64_t val); + void Ebml_WriteString(EbmlGlobal *glob, const char *str); + void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr); + void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id); ++void Ebml_SerializeUnsigned32(EbmlGlobal *glob, unsigned long class_id, uint32_t ui); + void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui); + void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui); + void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long ui); +diff --git a/WebMElement.c b/WebMElement.c +index 2f79a3c..02eefa4 100644 +--- a/WebMElement.c ++++ b/WebMElement.c +@@ -11,8 +11,12 @@ + #include "EbmlIDs.h" + #include "WebMElement.h" + #include ++#include ++#include ++#include + + #define kVorbisPrivateMaxSize 4000 ++#define UInt64 uint64_t + + void writeHeader(EbmlGlobal *glob) { + EbmlLoc start; +@@ -30,15 +34,16 @@ void writeHeader(EbmlGlobal *glob) { + void writeSimpleBlock(EbmlGlobal *glob, unsigned char trackNumber, short timeCode, + int isKeyframe, unsigned char lacingFlag, int discardable, + unsigned char *data, unsigned long dataLength) { +- Ebml_WriteID(glob, SimpleBlock); + unsigned long blockLength = 4 + dataLength; ++ unsigned char flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) | discardable; ++ Ebml_WriteID(glob, SimpleBlock); + blockLength |= 0x10000000; // TODO check length < 0x0FFFFFFFF + Ebml_Serialize(glob, &blockLength, sizeof(blockLength), 4); + trackNumber |= 0x80; // TODO check track nubmer < 128 + Ebml_Write(glob, &trackNumber, 1); + // Ebml_WriteSigned16(glob, timeCode,2); //this is 3 bytes + Ebml_Serialize(glob, &timeCode, sizeof(timeCode), 2); +- unsigned char flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) | discardable; ++ flags = 0x00 | (isKeyframe ? 0x80 : 0x00) | (lacingFlag << 1) | discardable; + Ebml_Write(glob, &flags, 1); + Ebml_Write(glob, data, dataLength); + } +@@ -48,17 +53,18 @@ static UInt64 generateTrackID(unsigned int trackNumber) { + UInt64 r = rand(); + r = r << 32; + r += rand(); +- UInt64 rval = t ^ r; +- return rval; ++// UInt64 rval = t ^ r; ++ return t ^ r; + } + + void writeVideoTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, + char *codecId, unsigned int pixelWidth, unsigned int pixelHeight, + double frameRate) { + EbmlLoc start; ++ UInt64 trackID; + Ebml_StartSubElement(glob, &start, TrackEntry); + Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber); +- UInt64 trackID = generateTrackID(trackNumber); ++ trackID = generateTrackID(trackNumber); + Ebml_SerializeUnsigned(glob, TrackUID, trackID); + Ebml_SerializeString(glob, CodecName, "VP8"); // TODO shouldn't be fixed + +@@ -78,9 +84,10 @@ void writeAudioTrack(EbmlGlobal *glob, unsigned int trackNumber, int flagLacing, + char *codecId, double samplingFrequency, unsigned int channels, + unsigned char *private, unsigned long privateSize) { + EbmlLoc start; ++ UInt64 trackID; + Ebml_StartSubElement(glob, &start, TrackEntry); + Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber); +- UInt64 trackID = generateTrackID(trackNumber); ++ trackID = generateTrackID(trackNumber); + Ebml_SerializeUnsigned(glob, TrackUID, trackID); + Ebml_SerializeUnsigned(glob, TrackType, 2); // audio is always 2 + // I am using defaults for thesed required fields + diff --git a/media/libmkv/update.sh b/media/libmkv/update.sh new file mode 100644 index 00000000000..5029b3f4750 --- /dev/null +++ b/media/libmkv/update.sh @@ -0,0 +1,33 @@ +# Usage: sh update.sh +set -e +echo "copy source from libvpx" + +cp $1/third_party/libmkv/EbmlBufferWriter.c . +cp $1/third_party/libmkv/WebMElement.c . +cp $1/third_party/libmkv/EbmlWriter.c . +cp $1/third_party/libmkv/EbmlWriter.h . +cp $1/third_party/libmkv/EbmlBufferWriter.h . +cp $1/third_party/libmkv/WebMElement.h . +cp $1/third_party/libmkv/EbmlIDs.h . + +cp $1/LICENSE . +cp $1/README . +cp $1/AUTHORS . +if [ -d $1/.git ]; then + rev=$(cd $1 && git rev-parse --verify HEAD) + dirty=$(cd $1 && git diff-index --name-only HEAD) +fi + +if [ -n "$rev" ]; then + version=$rev + if [ -n "$dirty" ]; then + version=$version-dirty + echo "WARNING: updating from a dirty git repository." + fi + sed -i.bak -e "/The git commit ID used was/ s/[0-9a-f]\{40\}\(-dirty\)\{0,1\}\./$version./" README_MOZILLA + rm README_MOZILLA.bak +else + echo "Remember to update README_MOZILLA with the version details." +fi + +echo "please apply source_fix.patch and gecko_fix.patch" From 5e7bc772929c3905574d5a181a8d3fd4ec9cab8e Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Mon, 27 Jan 2014 08:18:27 -0500 Subject: [PATCH 39/76] Bug 963031 - AArch support for Graphics. r=doublec --- gfx/ycbcr/chromium_types.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gfx/ycbcr/chromium_types.h b/gfx/ycbcr/chromium_types.h index 98dcf154075..48708a239d3 100644 --- a/gfx/ycbcr/chromium_types.h +++ b/gfx/ycbcr/chromium_types.h @@ -46,6 +46,10 @@ typedef uint32_t uint32; #define ARCH_CPU_SPARC_FAMILY 1 #define ARCH_CPU_SPARC 1 #define ARCH_CPU_64_BITS 1 +#elif defined(__aarch64__) +#define ARCH_CPU_AARCH64_FAMILY 1 +#define ARCH_CPU_AARCH64 1 +#define ARCH_CPU_64_BITS 1 #else #warning Please add support for your architecture in chromium_types.h #endif From 219b6a3b2fcaeec182b98f9a048a035a385cc1c7 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Mon, 27 Jan 2014 08:18:27 -0500 Subject: [PATCH 40/76] Bug 963166 - Add getWindowHandles end-point for WebDriver compatibility. r=dburns --- testing/marionette/client/marionette/marionette.py | 3 +-- testing/marionette/marionette-server.js | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/marionette/client/marionette/marionette.py b/testing/marionette/client/marionette/marionette.py index c7e64a5bd41..006b523efed 100644 --- a/testing/marionette/client/marionette/marionette.py +++ b/testing/marionette/client/marionette/marionette.py @@ -808,8 +808,7 @@ class Marionette(object): """ - response = self._send_message("getCurrentWindowHandles", - "value") + response = self._send_message("getWindowHandles", "value") return response @property diff --git a/testing/marionette/marionette-server.js b/testing/marionette/marionette-server.js index aa37802c127..05f249b1a9a 100644 --- a/testing/marionette/marionette-server.js +++ b/testing/marionette/marionette-server.js @@ -2444,7 +2444,8 @@ MarionetteServerConnection.prototype.requestTypes = { "getWindowHandle": MarionetteServerConnection.prototype.getWindowHandle, "getCurrentWindowHandle": MarionetteServerConnection.prototype.getWindowHandle, // Selenium 2 compat "getWindow": MarionetteServerConnection.prototype.getWindowHandle, // deprecated - "getCurrentWindowHandles": MarionetteServerConnection.prototype.getWindowHandles, + "getWindowHandles": MarionetteServerConnection.prototype.getWindowHandles, + "getCurrentWindowHandles": MarionetteServerConnection.prototype.getWindowHandles, // Selenium 2 compat "getWindows": MarionetteServerConnection.prototype.getWindowHandles, // deprecated "getActiveFrame": MarionetteServerConnection.prototype.getActiveFrame, "switchToFrame": MarionetteServerConnection.prototype.switchToFrame, From cc3a4c0c6b00eb28248343c888b5a948b1fd38ad Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Mon, 27 Jan 2014 08:25:19 -0500 Subject: [PATCH 41/76] Bug 961041 - Replace infallible allocation in DOMStorage::BroadcastChangeNotification with fallible allocation. r=smaug --- js/xpconnect/src/event_impl_gen.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/xpconnect/src/event_impl_gen.py b/js/xpconnect/src/event_impl_gen.py index d6b0960a1b4..280113ae588 100644 --- a/js/xpconnect/src/event_impl_gen.py +++ b/js/xpconnect/src/event_impl_gen.py @@ -81,7 +81,7 @@ def print_header_file(fd, conf): fd.write("NS_NewDOM%s(nsIDOMEvent** aInstance, " % e) fd.write("mozilla::dom::EventTarget* aOwner, ") fd.write("nsPresContext* aPresContext, mozilla::WidgetEvent* aEvent);\n") - + fd.write("\n#endif\n") def print_classes_file(fd, conf): @@ -441,7 +441,12 @@ def write_cpp(eventname, iface, fd, conf): fd.write(");\n"); fd.write(" NS_ENSURE_SUCCESS(rv, rv);\n") for a in attributes: - fd.write(" m%s = a%s;\n" % (firstCap(a.name), firstCap(a.name))) + if a.realtype.nativeType("in").count("nsAString"): + fd.write(" if (!m%s.Assign(a%s, fallible_t())) {\n" % (firstCap(a.name), firstCap(a.name))) + fd.write(" return NS_ERROR_OUT_OF_MEMORY;\n") + fd.write(" }\n") + else: + fd.write(" m%s = a%s;\n" % (firstCap(a.name), firstCap(a.name))) fd.write(" return NS_OK;\n") fd.write("}\n\n") From fec16a322473e499f7834856a9b783cb23e6c573 Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Wed, 22 Jan 2014 16:50:52 -0800 Subject: [PATCH 42/76] Bug 961313 - Add the transport protocol to candidate labels. r=abr --- .../third_party/nICEr/src/net/transport_addr.c | 16 ++++++++++++++-- .../third_party/nICEr/src/net/transport_addr.h | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/media/mtransport/third_party/nICEr/src/net/transport_addr.c b/media/mtransport/third_party/nICEr/src/net/transport_addr.c index d2a364131df..10498b2e12b 100644 --- a/media/mtransport/third_party/nICEr/src/net/transport_addr.c +++ b/media/mtransport/third_party/nICEr/src/net/transport_addr.c @@ -57,17 +57,29 @@ int nr_transport_addr_fmt_addr_string(nr_transport_addr *addr) int _status; /* Max length for normalized IPv6 address string represntation is 39 */ char buffer[40]; + const char *protocol; + + switch(addr->protocol){ + case IPPROTO_TCP: + protocol = "TCP"; + break; + case IPPROTO_UDP: + protocol = "UDP"; + break; + default: + ABORT(R_INTERNAL); + } switch(addr->ip_version){ case NR_IPV4: if (!inet_ntop(AF_INET, &addr->u.addr4.sin_addr,buffer,sizeof(buffer))) strcpy(buffer, "[error]"); - snprintf(addr->as_string,sizeof(addr->as_string),"IP4:%s:%d",buffer,ntohs(addr->u.addr4.sin_port)); + snprintf(addr->as_string,sizeof(addr->as_string),"IP4:%s:%d/%s",buffer,ntohs(addr->u.addr4.sin_port),protocol); break; case NR_IPV6: if (!inet_ntop(AF_INET6, &addr->u.addr6.sin6_addr,buffer,sizeof(buffer))) strcpy(buffer, "[error]"); - snprintf(addr->as_string,sizeof(addr->as_string),"IP6:[%s]:%d",buffer,ntohs(addr->u.addr6.sin6_port)); + snprintf(addr->as_string,sizeof(addr->as_string),"IP6:[%s]:%d/%s",buffer,ntohs(addr->u.addr6.sin6_port),protocol); break; default: ABORT(R_INTERNAL); diff --git a/media/mtransport/third_party/nICEr/src/net/transport_addr.h b/media/mtransport/third_party/nICEr/src/net/transport_addr.h index 9bf6504f606..6ae014b80b9 100644 --- a/media/mtransport/third_party/nICEr/src/net/transport_addr.h +++ b/media/mtransport/third_party/nICEr/src/net/transport_addr.h @@ -67,8 +67,8 @@ typedef struct nr_transport_addr_ { } u; char ifname[MAXIFNAME]; /* A string version. - 52 = 5 ("IP6:[") + 39 (ipv6 address) + 2 ("]:") + 5 (port) + 1 (null) */ - char as_string[52]; + 56 = 5 ("IP6:[") + 39 (ipv6 address) + 2 ("]:") + 5 (port) + 4 (/UDP) + 1 (null) */ + char as_string[56]; } nr_transport_addr; int nr_sockaddr_to_transport_addr(struct sockaddr *saddr, int saddr_len, int protocol, int keep, nr_transport_addr *addr); From 6bbf31de9b41366efbe71adad1b125ce07937f49 Mon Sep 17 00:00:00 2001 From: Ali Akhtarzada Date: Mon, 27 Jan 2014 08:25:50 -0500 Subject: [PATCH 43/76] Bug 963491 - Implement MacIOSurface::GetAsSourceSurface. r=nical --- gfx/layers/MacIOSurfaceImage.cpp | 32 ++++++++++++++++++++++++++++++++ gfx/layers/MacIOSurfaceImage.h | 2 ++ 2 files changed, 34 insertions(+) diff --git a/gfx/layers/MacIOSurfaceImage.cpp b/gfx/layers/MacIOSurfaceImage.cpp index 4ede0a4b8b0..259691e8602 100644 --- a/gfx/layers/MacIOSurfaceImage.cpp +++ b/gfx/layers/MacIOSurfaceImage.cpp @@ -6,6 +6,7 @@ #include "MacIOSurfaceImage.h" #include "mozilla/layers/MacIOSurfaceTextureClientOGL.h" +using namespace mozilla; using namespace mozilla::layers; TextureClient* @@ -19,3 +20,34 @@ MacIOSurfaceImage::GetTextureClient() } return mTextureClient; } + +TemporaryRef +MacIOSurfaceImage::GetAsSourceSurface() +{ + mSurface->Lock(); + size_t bytesPerRow = mSurface->GetBytesPerRow(); + size_t ioWidth = mSurface->GetDevicePixelWidth(); + size_t ioHeight = mSurface->GetDevicePixelHeight(); + + unsigned char* ioData = (unsigned char*)mSurface->GetBaseAddress(); + + RefPtr dataSurface + = gfx::Factory::CreateDataSourceSurface(gfx::IntSize(ioWidth, ioHeight), gfx::SurfaceFormat::B8G8R8A8); + if (!dataSurface) + return nullptr; + + gfx::DataSourceSurface::MappedSurface mappedSurface; + if (!dataSurface->Map(gfx::DataSourceSurface::WRITE, &mappedSurface)) + return nullptr; + + for (size_t i = 0; i < ioHeight; ++i) { + memcpy(mappedSurface.mData + i * mappedSurface.mStride, + ioData + i * bytesPerRow, + ioWidth * 4); + } + + dataSurface->Unmap(); + mSurface->Unlock(); + + return dataSurface; +} diff --git a/gfx/layers/MacIOSurfaceImage.h b/gfx/layers/MacIOSurfaceImage.h index c5d329c96d9..fd15fcccd9f 100644 --- a/gfx/layers/MacIOSurfaceImage.h +++ b/gfx/layers/MacIOSurfaceImage.h @@ -49,6 +49,8 @@ public: return imgSurface.forget(); } + virtual TemporaryRef GetAsSourceSurface(); + virtual TextureClient* GetTextureClient() MOZ_OVERRIDE; virtual uint8_t* GetBuffer() MOZ_OVERRIDE { return nullptr; } From c1752a8ad0533e898baf7684e3dfeda29aec8928 Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Wed, 22 Jan 2014 14:13:43 -0800 Subject: [PATCH 44/76] Bug 962371 - Part 1: Make priority for TCP relayed candidates lower than UDP relayed candidates. r=abr --- media/mtransport/nricectx.cpp | 3 ++- .../third_party/nICEr/src/ice/ice_candidate.c | 16 ++++++++++++++-- .../third_party/nICEr/src/ice/ice_reg.h | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/media/mtransport/nricectx.cpp b/media/mtransport/nricectx.cpp index e49f67b8fb1..9a1bfff2a4d 100644 --- a/media/mtransport/nricectx.cpp +++ b/media/mtransport/nricectx.cpp @@ -374,7 +374,8 @@ RefPtr NrIceCtx::Create(const std::string& name, NR_reg_set_uchar((char *)"ice.pref.type.srv_rflx", 100); NR_reg_set_uchar((char *)"ice.pref.type.peer_rflx", 110); NR_reg_set_uchar((char *)"ice.pref.type.host", 126); - NR_reg_set_uchar((char *)"ice.pref.type.relayed", 0); + NR_reg_set_uchar((char *)"ice.pref.type.relayed", 5); + NR_reg_set_uchar((char *)"ice.pref.type.relayed_tcp", 0); if (set_interface_priorities) { NR_reg_set_uchar((char *)"ice.pref.interface.rl0", 255); diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c b/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c index 5cfc2fa2e20..0b75053f75e 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_candidate.c @@ -356,8 +356,20 @@ int nr_ice_candidate_compute_priority(nr_ice_candidate *cand) stun_priority=0; break; case RELAYED: - if(r=NR_reg_get_uchar(NR_ICE_REG_PREF_TYPE_RELAYED,&type_preference)) - ABORT(r); + if(cand->base.protocol == IPPROTO_UDP) { + if(r=NR_reg_get_uchar(NR_ICE_REG_PREF_TYPE_RELAYED,&type_preference)) + ABORT(r); + } + else if(cand->base.protocol == IPPROTO_TCP) { + if(r=NR_reg_get_uchar(NR_ICE_REG_PREF_TYPE_RELAYED_TCP,&type_preference)) + ABORT(r); + + } + else { + r_log(LOG_ICE,LOG_ERR,"Unknown protocol type %u", + (unsigned int)cand->base.protocol); + ABORT(R_INTERNAL); + } stun_priority=255-cand->stun_server->index; break; case SERVER_REFLEXIVE: diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_reg.h b/media/mtransport/third_party/nICEr/src/ice/ice_reg.h index 7e318ba7862..28791f82272 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_reg.h +++ b/media/mtransport/third_party/nICEr/src/ice/ice_reg.h @@ -43,6 +43,7 @@ extern "C" { #define NR_ICE_REG_PREF_TYPE_RELAYED "ice.pref.type.relayed" #define NR_ICE_REG_PREF_TYPE_SRV_RFLX "ice.pref.type.srv_rflx" #define NR_ICE_REG_PREF_TYPE_PEER_RFLX "ice.pref.type.peer_rflx" +#define NR_ICE_REG_PREF_TYPE_RELAYED_TCP "ice.pref.type.relayed_tcp" #define NR_ICE_REG_PREF_INTERFACE_PRFX "ice.pref.interface" #define NR_ICE_REG_SUPPRESS_INTERFACE_PRFX "ice.suppress.interface" From 2bee0325a6470c50843609b9cea7b0c35d45bcf3 Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Thu, 23 Jan 2014 11:00:32 -0800 Subject: [PATCH 45/76] Bug 962371 - Part 2: Remove some magic constants. r=abr --- media/mtransport/nricectx.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/media/mtransport/nricectx.cpp b/media/mtransport/nricectx.cpp index 9a1bfff2a4d..f89cb5bcf5c 100644 --- a/media/mtransport/nricectx.cpp +++ b/media/mtransport/nricectx.cpp @@ -66,6 +66,7 @@ extern "C" { #include "async_timer.h" #include "r_crc32.h" #include "r_memory.h" +#include "ice_reg.h" #include "ice_util.h" #include "transport_addr.h" #include "nr_crypto.h" @@ -371,11 +372,11 @@ RefPtr NrIceCtx::Create(const std::string& name, // Set the priorites for candidate type preferences. // These numbers come from RFC 5245 S. 4.1.2.2 - NR_reg_set_uchar((char *)"ice.pref.type.srv_rflx", 100); - NR_reg_set_uchar((char *)"ice.pref.type.peer_rflx", 110); - NR_reg_set_uchar((char *)"ice.pref.type.host", 126); - NR_reg_set_uchar((char *)"ice.pref.type.relayed", 5); - NR_reg_set_uchar((char *)"ice.pref.type.relayed_tcp", 0); + NR_reg_set_uchar((char *)NR_ICE_REG_PREF_TYPE_SRV_RFLX, 100); + NR_reg_set_uchar((char *)NR_ICE_REG_PREF_TYPE_PEER_RFLX, 110); + NR_reg_set_uchar((char *)NR_ICE_REG_PREF_TYPE_HOST, 126); + NR_reg_set_uchar((char *)NR_ICE_REG_PREF_TYPE_RELAYED, 5); + NR_reg_set_uchar((char *)NR_ICE_REG_PREF_TYPE_RELAYED_TCP, 0); if (set_interface_priorities) { NR_reg_set_uchar((char *)"ice.pref.interface.rl0", 255); From 463fd0d06ec8f8ef1f8e9290fc0496a08538b704 Mon Sep 17 00:00:00 2001 From: Jed Parsons Date: Fri, 24 Jan 2014 13:23:21 -0800 Subject: [PATCH 46/76] Bug 963674 - Remove xul appinfo from xpcshell tests. r=MattN --- toolkit/identity/MinimalIdentity.jsm | 15 ++++++---- toolkit/identity/tests/unit/head_identity.js | 29 ------------------- toolkit/identity/tests/unit/test_log_utils.js | 4 +-- .../tests/unit/test_minimalidentity.js | 2 +- .../identity/tests/unit/test_relying_party.js | 2 +- 5 files changed, 13 insertions(+), 39 deletions(-) diff --git a/toolkit/identity/MinimalIdentity.jsm b/toolkit/identity/MinimalIdentity.jsm index a48b5a11d33..7c3e215b59a 100644 --- a/toolkit/identity/MinimalIdentity.jsm +++ b/toolkit/identity/MinimalIdentity.jsm @@ -93,12 +93,15 @@ IDService.prototype = { observe: function observe(aSubject, aTopic, aData) { switch (aTopic) { case "quit-application-granted": - Services.obs.removeObserver(this, "quit-application-granted"); - // Services.obs.removeObserver(this, "identity-auth-complete"); + this.shutdown(); break; } }, + shutdown: function() { + Services.obs.removeObserver(this, "quit-application-granted"); + }, + /** * Parse an email into username and domain if it is valid, else return null */ @@ -228,7 +231,7 @@ IDService.prototype = { doLogin: function doLogin(aRpCallerId, aAssertion, aInternalParams) { let rp = this._rpFlows[aRpCallerId]; if (!rp) { - dump("WARNING: doLogin found no rp to go with callerId " + aRpCallerId + "\n"); + log("WARNING: doLogin found no rp to go with callerId " + aRpCallerId); return; } @@ -238,7 +241,7 @@ IDService.prototype = { doLogout: function doLogout(aRpCallerId) { let rp = this._rpFlows[aRpCallerId]; if (!rp) { - dump("WARNING: doLogout found no rp to go with callerId " + aRpCallerId + "\n"); + log("WARNING: doLogout found no rp to go with callerId " + aRpCallerId); return; } @@ -255,7 +258,7 @@ IDService.prototype = { doReady: function doReady(aRpCallerId) { let rp = this._rpFlows[aRpCallerId]; if (!rp) { - dump("WARNING: doReady found no rp to go with callerId " + aRpCallerId + "\n"); + log("WARNING: doReady found no rp to go with callerId " + aRpCallerId); return; } @@ -265,7 +268,7 @@ IDService.prototype = { doCancel: function doCancel(aRpCallerId) { let rp = this._rpFlows[aRpCallerId]; if (!rp) { - dump("WARNING: doCancel found no rp to go with callerId " + aRpCallerId + "\n"); + log("WARNING: doCancel found no rp to go with callerId " + aRpCallerId); return; } diff --git a/toolkit/identity/tests/unit/head_identity.js b/toolkit/identity/tests/unit/head_identity.js index c226a85ddc8..13ee25c6fc9 100644 --- a/toolkit/identity/tests/unit/head_identity.js +++ b/toolkit/identity/tests/unit/head_identity.js @@ -45,35 +45,6 @@ const TEST_IDPPARAMS = { provisioning: "/foo/provision.html" }; -let XULAppInfo = { - vendor: "Mozilla", - name: "XPCShell", - ID: "xpcshell@tests.mozilla.org", - version: "1", - appBuildID: "20100621", - platformVersion: "", - platformBuildID: "20100621", - inSafeMode: false, - logConsoleErrors: true, - OS: "XPCShell", - XPCOMABI: "noarch-spidermonkey", - QueryInterface: XPCOMUtils.generateQI([Ci.nsIXULAppInfo, Ci.nsIXULRuntime]), - invalidateCachesOnRestart: function invalidateCachesOnRestart() { } -}; - -let XULAppInfoFactory = { - createInstance: function (outer, iid) { - if (outer != null) - throw Cr.NS_ERROR_NO_AGGREGATION; - return XULAppInfo.QueryInterface(iid); - } -}; - -let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); -registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"), - "XULAppInfo", "@mozilla.org/xre/app-info;1", - XULAppInfoFactory); - // The following are utility functions for Identity testing function log(...aMessageArgs) { diff --git a/toolkit/identity/tests/unit/test_log_utils.js b/toolkit/identity/tests/unit/test_log_utils.js index 6c40cdadc33..8703924280f 100644 --- a/toolkit/identity/tests/unit/test_log_utils.js +++ b/toolkit/identity/tests/unit/test_log_utils.js @@ -64,11 +64,11 @@ let TESTS = [ // toggle_debug, test_log, test_reportError, - test_wrappers + test_wrappers, ]; TESTS.forEach(add_test); function run_test() { run_next_test(); -} \ No newline at end of file +} diff --git a/toolkit/identity/tests/unit/test_minimalidentity.js b/toolkit/identity/tests/unit/test_minimalidentity.js index 6b86f8c8178..c96c4e29ad2 100644 --- a/toolkit/identity/tests/unit/test_minimalidentity.js +++ b/toolkit/identity/tests/unit/test_minimalidentity.js @@ -174,7 +174,7 @@ let TESTS = [ test_logout, test_logoutBeforeWatch, test_requestBeforeWatch, - test_unwatchBeforeWatch + test_unwatchBeforeWatch, ]; TESTS.forEach(add_test); diff --git a/toolkit/identity/tests/unit/test_relying_party.js b/toolkit/identity/tests/unit/test_relying_party.js index 20e83f804dc..75f61e7d643 100644 --- a/toolkit/identity/tests/unit/test_relying_party.js +++ b/toolkit/identity/tests/unit/test_relying_party.js @@ -245,7 +245,7 @@ let TESTS = [ test_request, test_request_forceAuthentication, test_request_forceIssuer, - test_logout + test_logout, ]; TESTS.forEach(add_test); From af36dc1ee2b4cde5dc7411c847f4d2a538ec8a5f Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Mon, 27 Jan 2014 11:56:53 +0200 Subject: [PATCH 47/76] Bug 959058 - Map GBK and GB2312 decoder constructors to the GB18030 decoder. r=emk. --- intl/uconv/src/nsUConvModule.cpp | 6 ++---- intl/uconv/tests/mochitest.ini | 1 + intl/uconv/tests/test_bug959058.html | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 intl/uconv/tests/test_bug959058.html diff --git a/intl/uconv/src/nsUConvModule.cpp b/intl/uconv/src/nsUConvModule.cpp index 21bfa61652e..93daeccc7e5 100644 --- a/intl/uconv/src/nsUConvModule.cpp +++ b/intl/uconv/src/nsUConvModule.cpp @@ -355,9 +355,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToISO2022JP) NS_GENERIC_FACTORY_CONSTRUCTOR(nsISO2022KRToUnicode) // ucvcn -NS_GENERIC_FACTORY_CONSTRUCTOR(nsGB2312ToUnicodeV2) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGB2312V2) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsGBKToUnicode) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToGBK) NS_GENERIC_FACTORY_CONSTRUCTOR(nsHZToUnicode) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToHZ) @@ -839,9 +837,9 @@ static const mozilla::Module::CIDEntry kUConvCIDs[] = { { &kNS_JOHABTOUNICODE_CID, false, nullptr, nsJohabToUnicodeConstructor }, { &kNS_UNICODETOJOHAB_CID, false, nullptr, nsUnicodeToJohabConstructor }, { &kNS_ISO2022KRTOUNICODE_CID, false, nullptr, nsISO2022KRToUnicodeConstructor }, - { &kNS_GB2312TOUNICODE_CID, false, nullptr, nsGB2312ToUnicodeV2Constructor }, + { &kNS_GB2312TOUNICODE_CID, false, nullptr, nsGB18030ToUnicodeConstructor }, { &kNS_UNICODETOGB2312_CID, false, nullptr, nsUnicodeToGB2312V2Constructor }, - { &kNS_GBKTOUNICODE_CID, false, nullptr, nsGBKToUnicodeConstructor }, + { &kNS_GBKTOUNICODE_CID, false, nullptr, nsGB18030ToUnicodeConstructor }, { &kNS_UNICODETOGBK_CID, false, nullptr, nsUnicodeToGBKConstructor }, { &kNS_HZTOUNICODE_CID, false, nullptr, nsHZToUnicodeConstructor }, { &kNS_UNICODETOHZ_CID, false, nullptr, nsUnicodeToHZConstructor }, diff --git a/intl/uconv/tests/mochitest.ini b/intl/uconv/tests/mochitest.ini index a9ce7ac3361..957e5341bda 100644 --- a/intl/uconv/tests/mochitest.ini +++ b/intl/uconv/tests/mochitest.ini @@ -2,6 +2,7 @@ [test_bug335816.html] [test_bug843434.html] +[test_bug959058.html] [test_long_doc.html] [test_singlebyte_overconsumption.html] [test_unicode_noncharacterescapes.html] diff --git a/intl/uconv/tests/test_bug959058.html b/intl/uconv/tests/test_bug959058.html new file mode 100644 index 00000000000..10940939751 --- /dev/null +++ b/intl/uconv/tests/test_bug959058.html @@ -0,0 +1,28 @@ + + + + + + Test for Bug 959058 + + + + + +Mozilla Bug 959058 +

+ +
+
+ + From 013d54c06a19e30aeb12ce9d765fc598aa477d12 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Mon, 27 Jan 2014 16:29:35 +0200 Subject: [PATCH 48/76] Additional test for bug 959058 - Check that 0x80 still decodes as euro on pages labeled as gbk. r=emk. --HG-- rename : intl/uconv/tests/test_bug959058.html => intl/uconv/tests/test_bug959058-1.html rename : intl/uconv/tests/test_bug959058.html => intl/uconv/tests/test_bug959058-2.html --- intl/uconv/tests/mochitest.ini | 3 +- ...t_bug959058.html => test_bug959058-1.html} | 0 intl/uconv/tests/test_bug959058-2.html | 28 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) rename intl/uconv/tests/{test_bug959058.html => test_bug959058-1.html} (100%) create mode 100644 intl/uconv/tests/test_bug959058-2.html diff --git a/intl/uconv/tests/mochitest.ini b/intl/uconv/tests/mochitest.ini index 957e5341bda..a0360d47f2d 100644 --- a/intl/uconv/tests/mochitest.ini +++ b/intl/uconv/tests/mochitest.ini @@ -2,7 +2,8 @@ [test_bug335816.html] [test_bug843434.html] -[test_bug959058.html] +[test_bug959058-1.html] +[test_bug959058-2.html] [test_long_doc.html] [test_singlebyte_overconsumption.html] [test_unicode_noncharacterescapes.html] diff --git a/intl/uconv/tests/test_bug959058.html b/intl/uconv/tests/test_bug959058-1.html similarity index 100% rename from intl/uconv/tests/test_bug959058.html rename to intl/uconv/tests/test_bug959058-1.html diff --git a/intl/uconv/tests/test_bug959058-2.html b/intl/uconv/tests/test_bug959058-2.html new file mode 100644 index 00000000000..73fd66bfc31 --- /dev/null +++ b/intl/uconv/tests/test_bug959058-2.html @@ -0,0 +1,28 @@ + + + + + + Test for Bug 959058 + + + + + +Mozilla Bug 959058 +

+ +
+
+ + From f22a8b79ea94194e41116bc1dc254e4ac4e89488 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 27 Jan 2014 09:41:48 -0500 Subject: [PATCH 49/76] Backed out changeset ce887b471785 (bug 961313) for buffered_stun_socket_unittest crashes, again. --- .../third_party/nICEr/src/net/transport_addr.c | 16 ++-------------- .../third_party/nICEr/src/net/transport_addr.h | 4 ++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/media/mtransport/third_party/nICEr/src/net/transport_addr.c b/media/mtransport/third_party/nICEr/src/net/transport_addr.c index 10498b2e12b..d2a364131df 100644 --- a/media/mtransport/third_party/nICEr/src/net/transport_addr.c +++ b/media/mtransport/third_party/nICEr/src/net/transport_addr.c @@ -57,29 +57,17 @@ int nr_transport_addr_fmt_addr_string(nr_transport_addr *addr) int _status; /* Max length for normalized IPv6 address string represntation is 39 */ char buffer[40]; - const char *protocol; - - switch(addr->protocol){ - case IPPROTO_TCP: - protocol = "TCP"; - break; - case IPPROTO_UDP: - protocol = "UDP"; - break; - default: - ABORT(R_INTERNAL); - } switch(addr->ip_version){ case NR_IPV4: if (!inet_ntop(AF_INET, &addr->u.addr4.sin_addr,buffer,sizeof(buffer))) strcpy(buffer, "[error]"); - snprintf(addr->as_string,sizeof(addr->as_string),"IP4:%s:%d/%s",buffer,ntohs(addr->u.addr4.sin_port),protocol); + snprintf(addr->as_string,sizeof(addr->as_string),"IP4:%s:%d",buffer,ntohs(addr->u.addr4.sin_port)); break; case NR_IPV6: if (!inet_ntop(AF_INET6, &addr->u.addr6.sin6_addr,buffer,sizeof(buffer))) strcpy(buffer, "[error]"); - snprintf(addr->as_string,sizeof(addr->as_string),"IP6:[%s]:%d/%s",buffer,ntohs(addr->u.addr6.sin6_port),protocol); + snprintf(addr->as_string,sizeof(addr->as_string),"IP6:[%s]:%d",buffer,ntohs(addr->u.addr6.sin6_port)); break; default: ABORT(R_INTERNAL); diff --git a/media/mtransport/third_party/nICEr/src/net/transport_addr.h b/media/mtransport/third_party/nICEr/src/net/transport_addr.h index 6ae014b80b9..9bf6504f606 100644 --- a/media/mtransport/third_party/nICEr/src/net/transport_addr.h +++ b/media/mtransport/third_party/nICEr/src/net/transport_addr.h @@ -67,8 +67,8 @@ typedef struct nr_transport_addr_ { } u; char ifname[MAXIFNAME]; /* A string version. - 56 = 5 ("IP6:[") + 39 (ipv6 address) + 2 ("]:") + 5 (port) + 4 (/UDP) + 1 (null) */ - char as_string[56]; + 52 = 5 ("IP6:[") + 39 (ipv6 address) + 2 ("]:") + 5 (port) + 1 (null) */ + char as_string[52]; } nr_transport_addr; int nr_sockaddr_to_transport_addr(struct sockaddr *saddr, int saddr_len, int protocol, int keep, nr_transport_addr *addr); From 1a2792afbbfb6e95dff73f3413a2a6ef72645025 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Mon, 27 Jan 2014 09:09:33 -0600 Subject: [PATCH 50/76] Bug 951120 - Don't process native events on the main thread during xpcom shutdown in metro widget. r=bbondy --- widget/windows/winrt/MetroApp.cpp | 3 +++ widget/windows/winrt/MetroApp.h | 2 ++ widget/windows/winrt/MetroAppShell.cpp | 13 +++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/widget/windows/winrt/MetroApp.cpp b/widget/windows/winrt/MetroApp.cpp index 3469bcff531..26a3ffbc262 100644 --- a/widget/windows/winrt/MetroApp.cpp +++ b/widget/windows/winrt/MetroApp.cpp @@ -42,6 +42,7 @@ namespace winrt { ComPtr sFrameworkView; ComPtr sMetroApp; ComPtr sCoreApp; +bool MetroApp::sGeckoShuttingDown = false; //////////////////////////////////////////////////// // IFrameworkViewSource impl. @@ -109,6 +110,8 @@ MetroApp::ShutdownXPCOM() sFrameworkView->ShutdownXPCOM(); } + MetroApp::sGeckoShuttingDown = true; + // Shut down xpcom XRE_metroShutdown(); diff --git a/widget/windows/winrt/MetroApp.h b/widget/windows/winrt/MetroApp.h index d7f1b1c4960..e33f9838fe4 100644 --- a/widget/windows/winrt/MetroApp.h +++ b/widget/windows/winrt/MetroApp.h @@ -46,6 +46,8 @@ public: void CoreExit(); void ShutdownXPCOM(); + // Set when gecko enters xpcom shutdown. + static bool sGeckoShuttingDown; // Shared pointers between framework and widget static void SetBaseWidget(MetroWidget* aPtr); diff --git a/widget/windows/winrt/MetroAppShell.cpp b/widget/windows/winrt/MetroAppShell.cpp index e5869b8affa..ce7568a91d9 100644 --- a/widget/windows/winrt/MetroAppShell.cpp +++ b/widget/windows/winrt/MetroAppShell.cpp @@ -324,8 +324,8 @@ MetroAppShell::InputEventsDispatched() void MetroAppShell::DispatchAllGeckoEvents() { - // Only do this if requested - if (!sShouldPurgeThreadQueue) { + // Only do this if requested and when we're not shutting down + if (!sShouldPurgeThreadQueue || MetroApp::sGeckoShuttingDown) { return; } @@ -414,6 +414,15 @@ void MetroAppShell::NativeCallback() { NS_ASSERTION(NS_IsMainThread(), "Native callbacks must be on the metro main thread"); + + // We shouldn't process native events during xpcom shutdown - this can + // trigger unexpected xpcom event dispatching for the main thread when + // the thread manager is in the process of shutting down non-main threads, + // resulting in shutdown hangs. + if (MetroApp::sGeckoShuttingDown) { + return; + } + NativeEventCallback(); } From 57e83260d24c66b37489657ee7df65db80a3d888 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Mon, 27 Jan 2014 09:09:33 -0600 Subject: [PATCH 51/76] Bug 951120 - Detach ICoreWindow related events prior to shutdown, plus some misc. code cleanup. r=bbondy --- widget/windows/winrt/FrameworkView.cpp | 64 ++++++++++++++++++-------- widget/windows/winrt/FrameworkView.h | 4 +- widget/windows/winrt/MetroApp.cpp | 4 +- widget/windows/winrt/MetroApp.h | 2 +- widget/windows/winrt/MetroAppShell.cpp | 2 +- 5 files changed, 49 insertions(+), 27 deletions(-) diff --git a/widget/windows/winrt/FrameworkView.cpp b/widget/windows/winrt/FrameworkView.cpp index 405a409115b..db434b38c20 100644 --- a/widget/windows/winrt/FrameworkView.cpp +++ b/widget/windows/winrt/FrameworkView.cpp @@ -51,6 +51,19 @@ FrameworkView::FrameworkView(MetroApp* aMetroApp) : mWinVisible(false), mWinActiveState(false) { + mActivated.value = 0; + mWindowActivated.value = 0; + mWindowVisibilityChanged.value = 0; + mWindowSizeChanged.value = 0; + mSoftKeyboardHidden.value = 0; + mSoftKeyboardShown.value = 0; + mDisplayPropertiesChanged.value = 0; + mAutomationProviderRequested.value = 0; + mDataTransferRequested.value = 0; + mSearchQuerySubmitted.value = 0; + mPlayToRequested.value = 0; + mSettingsPane.value = 0; + mPrintManager.value = 0; memset(&sKeyboardRect, 0, sizeof(Rect)); sSettingsArray = new nsTArray(); LogFunction(); @@ -151,8 +164,6 @@ FrameworkView::AddEventHandlers() { this, &FrameworkView::OnWindowVisibilityChanged).Get(), &mWindowVisibilityChanged); mWindow->add_Activated(Callback<__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowActivatedEventArgs_t>( this, &FrameworkView::OnWindowActivated).Get(), &mWindowActivated); - mWindow->add_Closed(Callback<__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CCoreWindowEventArgs_t>( - this, &FrameworkView::OnWindowClosed).Get(), &mWindowClosed); mWindow->add_SizeChanged(Callback<__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs_t>( this, &FrameworkView::OnWindowSizeChanged).Get(), &mWindowSizeChanged); @@ -181,11 +192,35 @@ FrameworkView::AddEventHandlers() { // Called by MetroApp void -FrameworkView::ShutdownXPCOM() +FrameworkView::Shutdown() { LogFunction(); mShuttingDown = true; + if (mWindow && mWindowVisibilityChanged.value) { + mWindow->remove_VisibilityChanged(mWindowVisibilityChanged); + mWindow->remove_Activated(mWindowActivated); + mWindow->remove_Closed(mWindowClosed); + mWindow->remove_SizeChanged(mWindowSizeChanged); + mWindow->remove_AutomationProviderRequested(mAutomationProviderRequested); + } + + ComPtr dispProps; + if (mDisplayPropertiesChanged.value && + SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), dispProps.GetAddressOf()))) { + dispProps->remove_LogicalDpiChanged(mDisplayPropertiesChanged); + } + + ComPtr inputStatic; + if (mSoftKeyboardHidden.value && + SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(), inputStatic.GetAddressOf()))) { + ComPtr inputPane; + if (SUCCEEDED(inputStatic->GetForCurrentView(inputPane.GetAddressOf()))) { + inputPane->remove_Hiding(mSoftKeyboardHidden); + inputPane->remove_Showing(mSoftKeyboardShown); + } + } + if (mAutomationProvider) { ComPtr provider; mAutomationProvider.As(&provider); @@ -352,6 +387,10 @@ FrameworkView::OnActivated(ICoreApplicationView* aApplicationView, { LogFunction(); + if (mShuttingDown) { + return S_OK; + } + aArgs->get_PreviousExecutionState(&mPreviousExecutionState); bool startup = mPreviousExecutionState == ApplicationExecutionState::ApplicationExecutionState_Terminated || mPreviousExecutionState == ApplicationExecutionState::ApplicationExecutionState_ClosedByUser || @@ -371,8 +410,6 @@ FrameworkView::OnSoftkeyboardHidden(IInputPane* aSender, IInputPaneVisibilityEventArgs* aArgs) { LogFunction(); - if (mShuttingDown) - return S_OK; sKeyboardIsVisible = false; memset(&sKeyboardRect, 0, sizeof(Rect)); MetroUtils::FireObserver("metro_softkeyboard_hidden"); @@ -385,8 +422,6 @@ FrameworkView::OnSoftkeyboardShown(IInputPane* aSender, IInputPaneVisibilityEventArgs* aArgs) { LogFunction(); - if (mShuttingDown) - return S_OK; sKeyboardIsVisible = true; aSender->get_OccludedRect(&sKeyboardRect); MetroUtils::FireObserver("metro_softkeyboard_shown"); @@ -394,22 +429,10 @@ FrameworkView::OnSoftkeyboardShown(IInputPane* aSender, return S_OK; } -HRESULT -FrameworkView::OnWindowClosed(ICoreWindow* aSender, ICoreWindowEventArgs* aArgs) -{ - // this doesn't seem very reliable - return S_OK; -} - HRESULT FrameworkView::OnWindowSizeChanged(ICoreWindow* aSender, IWindowSizeChangedEventArgs* aArgs) { LogFunction(); - - if (mShuttingDown) { - return S_OK; - } - UpdateWidgetSizeAndPosition(); return S_OK; } @@ -418,8 +441,9 @@ HRESULT FrameworkView::OnWindowActivated(ICoreWindow* aSender, IWindowActivatedEventArgs* aArgs) { LogFunction(); - if (mShuttingDown || !mWidget) + if (!mWidget) { return S_OK; + } CoreWindowActivationState state; aArgs->get_WindowActivationState(&state); mWinActiveState = !(state == CoreWindowActivationState::CoreWindowActivationState_Deactivated); diff --git a/widget/windows/winrt/FrameworkView.h b/widget/windows/winrt/FrameworkView.h index ba41092143a..d95d8e1ad20 100644 --- a/widget/windows/winrt/FrameworkView.h +++ b/widget/windows/winrt/FrameworkView.h @@ -82,7 +82,6 @@ public: // Public apis for MetroWidget int GetPreviousExecutionState(); - void ShutdownXPCOM(); float GetDPI() { return mDPI; } ICoreWindow* GetCoreWindow() { return mWindow.Get(); } void SetWidget(MetroWidget* aWidget); @@ -100,6 +99,7 @@ public: // MetroApp apis void SetupContracts(); + void Shutdown(); // MetroContracts settings panel enumerator entry void AddSetting(ISettingsPaneCommandsRequestedEventArgs* aArgs, uint32_t aId, @@ -113,8 +113,6 @@ protected: HRESULT OnWindowSizeChanged(ICoreWindow* aSender, IWindowSizeChangedEventArgs* aArgs); - HRESULT OnWindowClosed(ICoreWindow* aSender, - ICoreWindowEventArgs* aArgs); HRESULT OnWindowActivated(ICoreWindow* aSender, IWindowActivatedEventArgs* aArgs); HRESULT OnLogicalDpiChanged(IInspectable* aSender); diff --git a/widget/windows/winrt/MetroApp.cpp b/widget/windows/winrt/MetroApp.cpp index 26a3ffbc262..7cfd7601727 100644 --- a/widget/windows/winrt/MetroApp.cpp +++ b/widget/windows/winrt/MetroApp.cpp @@ -97,7 +97,7 @@ MetroApp::Run() // Free all xpcom related resources before calling the xre shutdown call. // Must be called on the metro main thread. Currently called from appshell. void -MetroApp::ShutdownXPCOM() +MetroApp::Shutdown() { LogThread(); @@ -107,7 +107,7 @@ MetroApp::ShutdownXPCOM() } if (sFrameworkView) { - sFrameworkView->ShutdownXPCOM(); + sFrameworkView->Shutdown(); } MetroApp::sGeckoShuttingDown = true; diff --git a/widget/windows/winrt/MetroApp.h b/widget/windows/winrt/MetroApp.h index e33f9838fe4..f2f767de7b0 100644 --- a/widget/windows/winrt/MetroApp.h +++ b/widget/windows/winrt/MetroApp.h @@ -44,8 +44,8 @@ public: void Run(); void CoreExit(); + void Shutdown(); - void ShutdownXPCOM(); // Set when gecko enters xpcom shutdown. static bool sGeckoShuttingDown; diff --git a/widget/windows/winrt/MetroAppShell.cpp b/widget/windows/winrt/MetroAppShell.cpp index ce7568a91d9..0599c004887 100644 --- a/widget/windows/winrt/MetroAppShell.cpp +++ b/widget/windows/winrt/MetroAppShell.cpp @@ -262,7 +262,7 @@ MetroAppShell::Run(void) // This calls XRE_metroShutdown() in xre. Shuts down gecko, including // releasing the profile, and destroys MessagePump. - sMetroApp->ShutdownXPCOM(); + sMetroApp->Shutdown(); // Handle update restart or browser switch requests if (restartingInDesktop) { From a62f0624374002d66cb64b46728a9d76e0d6cf84 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Mon, 27 Jan 2014 07:16:38 -0800 Subject: [PATCH 52/76] Bug 963665 - Make nsIXPConnect noscript. r=bholley --- js/xpconnect/idl/nsIXPConnect.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/xpconnect/idl/nsIXPConnect.idl b/js/xpconnect/idl/nsIXPConnect.idl index 7ca3b501498..3cb7a875845 100644 --- a/js/xpconnect/idl/nsIXPConnect.idl +++ b/js/xpconnect/idl/nsIXPConnect.idl @@ -274,7 +274,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports { 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } } %} -[uuid(74109b69-de2f-4296-9e08-2a233eafa8f9)] +[noscript, uuid(3d5a6320-8764-11e3-baa7-0800200c9a66)] interface nsIXPConnect : nsISupports { %{ C++ From cbdd71e0f8df72f5c60ce52550e82e9de48cc419 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 27 Jan 2014 10:27:20 -0500 Subject: [PATCH 53/76] Bug 952977: Convert SnapTransforms to gfx::Matrix r=nical --- gfx/2d/Matrix.h | 30 ++++++++++ gfx/layers/ImageLayers.cpp | 10 ++-- gfx/layers/Layers.cpp | 59 ++++++++++---------- gfx/layers/Layers.h | 41 +++++++------- gfx/layers/ReadbackLayer.h | 10 ++-- gfx/layers/basic/BasicContainerLayer.cpp | 7 ++- gfx/layers/composite/ImageLayerComposite.cpp | 10 ++-- gfx/thebes/gfxUtils.cpp | 24 ++++++++ gfx/thebes/gfxUtils.h | 7 +++ 9 files changed, 134 insertions(+), 64 deletions(-) diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h index 686aab65740..4be4e891fd3 100644 --- a/gfx/2d/Matrix.h +++ b/gfx/2d/Matrix.h @@ -206,6 +206,10 @@ public: FuzzyEqual(_32, floorf(_32 + 0.5f)); } + Point GetTranslation() const { + return Point(_31, _32); + } + /** * Returns true if matrix is multiple of 90 degrees rotation with flipping, * scaling and translation. @@ -259,6 +263,21 @@ public: return true; } + bool Is2D(Matrix* aMatrix) const { + if (!Is2D()) { + return false; + } + if (aMatrix) { + aMatrix->_11 = _11; + aMatrix->_12 = _12; + aMatrix->_21 = _21; + aMatrix->_22 = _22; + aMatrix->_31 = _41; + aMatrix->_32 = _42; + } + return true; + } + Matrix As2D() const { MOZ_ASSERT(Is2D(), "Matrix is not a 2D affine transform"); @@ -266,6 +285,17 @@ public: return Matrix(_11, _12, _21, _22, _41, _42); } + static Matrix4x4 From2D(const Matrix &aMatrix) { + Matrix4x4 matrix; + matrix._11 = aMatrix._11; + matrix._12 = aMatrix._12; + matrix._21 = aMatrix._21; + matrix._22 = aMatrix._22; + matrix._41 = aMatrix._31; + matrix._42 = aMatrix._32; + return matrix; + } + bool Is2DIntegerTranslation() const { return Is2D() && As2D().IsIntegerTranslation(); diff --git a/gfx/layers/ImageLayers.cpp b/gfx/layers/ImageLayers.cpp index ebf5e8fbafc..475ea3f13e9 100644 --- a/gfx/layers/ImageLayers.cpp +++ b/gfx/layers/ImageLayers.cpp @@ -29,7 +29,8 @@ void ImageLayer::SetContainer(ImageContainer* aContainer) void ImageLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) { - gfx3DMatrix local = GetLocalTransform(); + gfx::Matrix4x4 local; + gfx::ToMatrix4x4(GetLocalTransform(), local); // Snap image edges to pixel boundaries gfxRect sourceRect(0, 0, 0, 0); @@ -47,10 +48,11 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurfa // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx3DMatrix snappedTransform = + gfx::Matrix4x4 transformToSurface; + gfx::ToMatrix4x4(aTransformToSurface, transformToSurface); + mEffectiveTransform = SnapTransform(local, sourceRect, nullptr) * - SnapTransformTranslation(aTransformToSurface, nullptr); - gfx::ToMatrix4x4(snappedTransform, mEffectiveTransform); + SnapTransformTranslation(transformToSurface, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 728f0fe67f5..5ddee5bb121 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -467,30 +467,31 @@ Layer::GetEffectiveVisibleRegion() return GetVisibleRegion(); } -gfx3DMatrix -Layer::SnapTransformTranslation(const gfx3DMatrix& aTransform, - gfxMatrix* aResidualTransform) +Matrix4x4 +Layer::SnapTransformTranslation(const Matrix4x4& aTransform, + Matrix* aResidualTransform) { if (aResidualTransform) { - *aResidualTransform = gfxMatrix(); + *aResidualTransform = Matrix(); } - gfxMatrix matrix2D; - gfx3DMatrix result; + Matrix matrix2D; + Matrix4x4 result; if (mManager->IsSnappingEffectiveTransforms() && aTransform.Is2D(&matrix2D) && !matrix2D.HasNonTranslation() && matrix2D.HasNonIntegerTranslation()) { - gfxPoint snappedTranslation(matrix2D.GetTranslation()); - snappedTranslation.Round(); - gfxMatrix snappedMatrix = gfxMatrix().Translate(snappedTranslation); - result = gfx3DMatrix::From2D(snappedMatrix); + IntPoint snappedTranslation = RoundedToInt(matrix2D.GetTranslation()); + Matrix snappedMatrix = Matrix().Translate(snappedTranslation.x, + snappedTranslation.y); + result = Matrix4x4::From2D(snappedMatrix); if (aResidualTransform) { // set aResidualTransform so that aResidual * snappedMatrix == matrix2D. // (I.e., appying snappedMatrix after aResidualTransform gives the // ideal transform.) *aResidualTransform = - gfxMatrix().Translate(matrix2D.GetTranslation() - snappedTranslation); + Matrix().Translate(matrix2D._31 - snappedTranslation.x, + matrix2D._32 - snappedTranslation.y); } } else { result = aTransform; @@ -498,37 +499,34 @@ Layer::SnapTransformTranslation(const gfx3DMatrix& aTransform, return result; } -gfx3DMatrix -Layer::SnapTransform(const gfx3DMatrix& aTransform, +Matrix4x4 +Layer::SnapTransform(const Matrix4x4& aTransform, const gfxRect& aSnapRect, - gfxMatrix* aResidualTransform) + Matrix* aResidualTransform) { if (aResidualTransform) { - *aResidualTransform = gfxMatrix(); + *aResidualTransform = Matrix(); } - gfxMatrix matrix2D; - gfx3DMatrix result; + Matrix matrix2D; + Matrix4x4 result; if (mManager->IsSnappingEffectiveTransforms() && aTransform.Is2D(&matrix2D) && gfx::Size(1.0, 1.0) <= ToSize(aSnapRect.Size()) && matrix2D.PreservesAxisAlignedRectangles()) { - gfxPoint transformedTopLeft = matrix2D.Transform(aSnapRect.TopLeft()); - transformedTopLeft.Round(); - gfxPoint transformedTopRight = matrix2D.Transform(aSnapRect.TopRight()); - transformedTopRight.Round(); - gfxPoint transformedBottomRight = matrix2D.Transform(aSnapRect.BottomRight()); - transformedBottomRight.Round(); + IntPoint transformedTopLeft = RoundedToInt(matrix2D * ToPoint(aSnapRect.TopLeft())); + IntPoint transformedTopRight = RoundedToInt(matrix2D * ToPoint(aSnapRect.TopRight())); + IntPoint transformedBottomRight = RoundedToInt(matrix2D * ToPoint(aSnapRect.BottomRight())); - gfxMatrix snappedMatrix = gfxUtils::TransformRectToRect(aSnapRect, + Matrix snappedMatrix = gfxUtils::TransformRectToRect(aSnapRect, transformedTopLeft, transformedTopRight, transformedBottomRight); - result = gfx3DMatrix::From2D(snappedMatrix); + result = Matrix4x4::From2D(snappedMatrix); if (aResidualTransform && !snappedMatrix.IsSingular()) { // set aResidualTransform so that aResidual * snappedMatrix == matrix2D. // (i.e., appying snappedMatrix after aResidualTransform gives the // ideal transform. - gfxMatrix snappedMatrixInverse = snappedMatrix; + Matrix snappedMatrixInverse = snappedMatrix; snappedMatrixInverse.Invert(); *aResidualTransform = matrix2D * snappedMatrixInverse; } @@ -889,11 +887,12 @@ ContainerLayer::SortChildrenBy3DZOrder(nsTArray& aArray) void ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) { - gfxMatrix residual; + Matrix residual; gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface; idealTransform.ProjectTo2D(); - gfx3DMatrix snappedTransform = SnapTransformTranslation(idealTransform, &residual); - ToMatrix4x4(snappedTransform, mEffectiveTransform); + Matrix4x4 ideal; + ToMatrix4x4(idealTransform, ideal); + mEffectiveTransform = SnapTransformTranslation(ideal, &residual); bool useIntermediateSurface; if (GetMaskLayer()) { @@ -936,7 +935,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformT mUseIntermediateSurface = useIntermediateSurface; if (useIntermediateSurface) { - ComputeEffectiveTransformsForChildren(gfx3DMatrix::From2D(residual)); + ComputeEffectiveTransformsForChildren(gfx3DMatrix::From2D(ThebesMatrix(residual))); } else { ComputeEffectiveTransformsForChildren(idealTransform); } diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index e487e6ae143..b44e0d09cba 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -1365,8 +1365,8 @@ protected: * @param aResidualTransform a transform to apply before the result transform * in order to get the results to completely match aTransform. */ - gfx3DMatrix SnapTransformTranslation(const gfx3DMatrix& aTransform, - gfxMatrix* aResidualTransform); + gfx::Matrix4x4 SnapTransformTranslation(const gfx::Matrix4x4& aTransform, + gfx::Matrix* aResidualTransform); /** * See comment for SnapTransformTranslation. * This function implements type 2 snapping. If aTransform is a translation @@ -1378,9 +1378,9 @@ protected: * @param aResidualTransform a transform to apply before the result transform * in order to get the results to completely match aTransform. */ - gfx3DMatrix SnapTransform(const gfx3DMatrix& aTransform, - const gfxRect& aSnapRect, - gfxMatrix* aResidualTransform); + gfx::Matrix4x4 SnapTransform(const gfx::Matrix4x4& aTransform, + const gfxRect& aSnapRect, + gfx::Matrix* aResidualTransform); /** * Returns true if this layer's effective transform is not just @@ -1480,17 +1480,17 @@ public: virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) { - gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface; - gfxMatrix residual; - gfx3DMatrix snappedTransform = SnapTransformTranslation(idealTransform, + gfx::Matrix4x4 idealTransform; + gfx::ToMatrix4x4(GetLocalTransform() * aTransformToSurface, idealTransform); + gfx::Matrix residual; + mEffectiveTransform = SnapTransformTranslation(idealTransform, mAllowResidualTranslation ? &residual : nullptr); - gfx::ToMatrix4x4(snappedTransform, mEffectiveTransform); // The residual can only be a translation because SnapTransformTranslation // only changes the transform if it's a translation - NS_ASSERTION(!residual.HasNonTranslation(), + NS_ASSERTION(residual.IsTranslation(), "Residual transform can only be a translation"); - if (!residual.GetTranslation().WithinEpsilonOf(mResidualTranslation, 1e-3f)) { - mResidualTranslation = residual.GetTranslation(); + if (!gfx::ThebesPoint(residual.GetTranslation()).WithinEpsilonOf(mResidualTranslation, 1e-3f)) { + mResidualTranslation = gfx::ThebesPoint(residual.GetTranslation()); NS_ASSERTION(-0.5 <= mResidualTranslation.x && mResidualTranslation.x < 0.5 && -0.5 <= mResidualTranslation.y && mResidualTranslation.y < 0.5, "Residual translation out of range"); @@ -1753,9 +1753,9 @@ public: virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) { - gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface; - gfx3DMatrix snappedTransform = SnapTransformTranslation(idealTransform, nullptr); - gfx::ToMatrix4x4(snappedTransform, mEffectiveTransform); + gfx::Matrix4x4 idealTransform; + gfx::ToMatrix4x4(GetLocalTransform() * aTransformToSurface, idealTransform); + mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } @@ -1898,11 +1898,14 @@ public: // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx3DMatrix snappedTransform = - SnapTransform(GetLocalTransform(), gfxRect(0, 0, mBounds.width, mBounds.height), + gfx::Matrix4x4 localTransform; + gfx::Matrix4x4 transformToSurface; + gfx::ToMatrix4x4(GetLocalTransform(), localTransform); + gfx::ToMatrix4x4(aTransformToSurface, transformToSurface); + mEffectiveTransform = + SnapTransform(localTransform, gfxRect(0, 0, mBounds.width, mBounds.height), nullptr)* - SnapTransformTranslation(aTransformToSurface, nullptr); - gfx::ToMatrix4x4(snappedTransform, mEffectiveTransform); + SnapTransformTranslation(transformToSurface, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } diff --git a/gfx/layers/ReadbackLayer.h b/gfx/layers/ReadbackLayer.h index 844f9cf3b32..0d69b9da8db 100644 --- a/gfx/layers/ReadbackLayer.h +++ b/gfx/layers/ReadbackLayer.h @@ -90,11 +90,13 @@ public: // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx3DMatrix snappedTransform = - SnapTransform(GetLocalTransform(), gfxRect(0, 0, mSize.width, mSize.height), + gfx::Matrix4x4 localTransform, transformToSurface; + gfx::ToMatrix4x4(aTransformToSurface, transformToSurface); + gfx::ToMatrix4x4(GetLocalTransform(), localTransform); + mEffectiveTransform = + SnapTransform(localTransform, gfxRect(0, 0, mSize.width, mSize.height), nullptr)* - SnapTransformTranslation(aTransformToSurface, nullptr); - gfx::ToMatrix4x4(snappedTransform, mEffectiveTransform); + SnapTransformTranslation(transformToSurface, nullptr); } /** diff --git a/gfx/layers/basic/BasicContainerLayer.cpp b/gfx/layers/basic/BasicContainerLayer.cpp index 4c70d9d53cc..f1f33dc0c86 100644 --- a/gfx/layers/basic/BasicContainerLayer.cpp +++ b/gfx/layers/basic/BasicContainerLayer.cpp @@ -39,7 +39,7 @@ BasicContainerLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToS // We push groups for container layers if we need to, which always // are aligned in device space, so it doesn't really matter how we snap // containers. - gfxMatrix residual; + Matrix residual; gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface; idealTransform.ProjectTo2D(); @@ -51,8 +51,9 @@ BasicContainerLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToS return; } - gfx3DMatrix snappedTransform = SnapTransformTranslation(idealTransform, &residual); - ToMatrix4x4(snappedTransform, mEffectiveTransform); + Matrix4x4 ideal; + ToMatrix4x4(idealTransform, ideal); + mEffectiveTransform = SnapTransformTranslation(ideal, &residual); // We always pass the ideal matrix down to our children, so there is no // need to apply any compensation using the residual from SnapTransformTranslation. ComputeEffectiveTransformsForChildren(idealTransform); diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp index 8040eb35fb2..27b84dbd8cc 100644 --- a/gfx/layers/composite/ImageLayerComposite.cpp +++ b/gfx/layers/composite/ImageLayerComposite.cpp @@ -106,7 +106,8 @@ ImageLayerComposite::RenderLayer(const nsIntRect& aClipRect) void ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) { - gfx3DMatrix local = GetLocalTransform(); + gfx::Matrix4x4 local; + gfx::ToMatrix4x4(GetLocalTransform(), local); // Snap image edges to pixel boundaries gfxRect sourceRect(0, 0, 0, 0); @@ -129,10 +130,11 @@ ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToS // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx3DMatrix snappedTransform = + gfx::Matrix4x4 transformToSurface; + gfx::ToMatrix4x4(aTransformToSurface, transformToSurface); + mEffectiveTransform = SnapTransform(local, sourceRect, nullptr) * - SnapTransformTranslation(aTransformToSurface, nullptr); - gfx::ToMatrix4x4(snappedTransform, mEffectiveTransform); + SnapTransformTranslation(transformToSurface, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 3a5dbd56b81..d533d17df78 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -676,6 +676,30 @@ gfxUtils::TransformRectToRect(const gfxRect& aFrom, const gfxPoint& aToTopLeft, return m; } +Matrix +gfxUtils::TransformRectToRect(const gfxRect& aFrom, const IntPoint& aToTopLeft, + const IntPoint& aToTopRight, const IntPoint& aToBottomRight) +{ + Matrix m; + if (aToTopRight.y == aToTopLeft.y && aToTopRight.x == aToBottomRight.x) { + // Not a rotation, so xy and yx are zero + m._12 = m._21 = 0.0; + m._11 = (aToBottomRight.x - aToTopLeft.x)/aFrom.width; + m._22 = (aToBottomRight.y - aToTopLeft.y)/aFrom.height; + m._31 = aToTopLeft.x - m._11*aFrom.x; + m._32 = aToTopLeft.y - m._22*aFrom.y; + } else { + NS_ASSERTION(aToTopRight.y == aToBottomRight.y && aToTopRight.x == aToTopLeft.x, + "Destination rectangle not axis-aligned"); + m._11 = m._22 = 0.0; + m._21 = (aToBottomRight.x - aToTopLeft.x)/aFrom.height; + m._12 = (aToBottomRight.y - aToTopLeft.y)/aFrom.width; + m._31 = aToTopLeft.x - m._21*aFrom.y; + m._32 = aToTopLeft.y - m._12*aFrom.x; + } + return m; +} + bool gfxUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut) { diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index 47427e46781..0bb4f8815d6 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -22,6 +22,8 @@ class PlanarYCbCrData; class gfxUtils { public: + typedef mozilla::gfx::IntPoint IntPoint; + typedef mozilla::gfx::Matrix Matrix; /* * Premultiply or Unpremultiply aSourceSurface, writing the result * to aDestSurface or back into aSourceSurface if aDestSurface is null. @@ -109,6 +111,11 @@ public: const gfxPoint& aToTopRight, const gfxPoint& aToBottomRight); + static Matrix TransformRectToRect(const gfxRect& aFrom, + const IntPoint& aToTopLeft, + const IntPoint& aToTopRight, + const IntPoint& aToBottomRight); + /** * If aIn can be represented exactly using an nsIntRect (i.e. * integer-aligned edges and coordinates in the int32_t range) then we From 4e68a5f47e5d1a72fa9230fe777f570f3aa8cf44 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 27 Jan 2014 10:28:04 -0500 Subject: [PATCH 54/76] Bug 952977: Convert ComputeEffectiveTransforms to gfx::Matrix4x4 r=nical --- gfx/layers/ImageLayers.cpp | 6 ++--- gfx/layers/ImageLayers.h | 4 +-- gfx/layers/Layers.cpp | 18 +++++++------ gfx/layers/Layers.h | 26 +++++++++---------- gfx/layers/ReadbackLayer.h | 8 +++--- gfx/layers/basic/BasicContainerLayer.cpp | 12 +++++---- gfx/layers/basic/BasicContainerLayer.h | 2 +- gfx/layers/basic/BasicLayerManager.cpp | 2 +- gfx/layers/basic/BasicThebesLayer.h | 5 ++-- gfx/layers/client/ClientContainerLayer.h | 4 +-- gfx/layers/client/ClientLayerManager.cpp | 3 +-- .../composite/ContainerLayerComposite.h | 5 ++-- gfx/layers/composite/ImageLayerComposite.cpp | 11 +++----- gfx/layers/composite/ImageLayerComposite.h | 3 +-- .../composite/LayerManagerComposite.cpp | 2 +- gfx/layers/d3d10/ContainerLayerD3D10.h | 2 +- gfx/layers/d3d10/LayerManagerD3D10.cpp | 2 +- gfx/layers/d3d9/ContainerLayerD3D9.h | 2 +- gfx/layers/d3d9/LayerManagerD3D9.cpp | 2 +- .../gtest/TestAsyncPanZoomController.cpp | 2 +- gfx/tests/gtest/TestLayers.cpp | 5 ++-- 21 files changed, 60 insertions(+), 66 deletions(-) diff --git a/gfx/layers/ImageLayers.cpp b/gfx/layers/ImageLayers.cpp index 475ea3f13e9..620712ea57c 100644 --- a/gfx/layers/ImageLayers.cpp +++ b/gfx/layers/ImageLayers.cpp @@ -27,7 +27,7 @@ void ImageLayer::SetContainer(ImageContainer* aContainer) mContainer = aContainer; } -void ImageLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) +void ImageLayer::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { gfx::Matrix4x4 local; gfx::ToMatrix4x4(GetLocalTransform(), local); @@ -48,11 +48,9 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurfa // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx::Matrix4x4 transformToSurface; - gfx::ToMatrix4x4(aTransformToSurface, transformToSurface); mEffectiveTransform = SnapTransform(local, sourceRect, nullptr) * - SnapTransformTranslation(transformToSurface, nullptr); + SnapTransformTranslation(aTransformToSurface, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } diff --git a/gfx/layers/ImageLayers.h b/gfx/layers/ImageLayers.h index d2111c0e515..8f26c6e6b7e 100644 --- a/gfx/layers/ImageLayers.h +++ b/gfx/layers/ImageLayers.h @@ -14,8 +14,6 @@ #include "nsAutoPtr.h" // for nsRefPtr #include "nscore.h" // for nsACString -class gfx3DMatrix; - namespace mozilla { namespace layers { @@ -67,7 +65,7 @@ public: MOZ_LAYER_DECL_NAME("ImageLayer", TYPE_IMAGE) - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface); + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface); /** * if true, the image will only be backed by a single tile texture diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 5ddee5bb121..b0df2a2c5ee 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -688,10 +688,10 @@ Layer::GetEffectiveMixBlendMode() } void -Layer::ComputeEffectiveTransformForMaskLayer(const gfx3DMatrix& aTransformToSurface) +Layer::ComputeEffectiveTransformForMaskLayer(const Matrix4x4& aTransformToSurface) { if (mMaskLayer) { - ToMatrix4x4(aTransformToSurface, mMaskLayer->mEffectiveTransform); + mMaskLayer->mEffectiveTransform = aTransformToSurface; #ifdef DEBUG gfxMatrix maskTranslation; @@ -885,10 +885,12 @@ ContainerLayer::SortChildrenBy3DZOrder(nsTArray& aArray) } void -ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) +ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface) { Matrix residual; - gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface; + gfx3DMatrix idealTransform; + To3DMatrix(aTransformToSurface, idealTransform); + idealTransform = GetLocalTransform() * idealTransform; idealTransform.ProjectTo2D(); Matrix4x4 ideal; ToMatrix4x4(idealTransform, ideal); @@ -935,20 +937,20 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformT mUseIntermediateSurface = useIntermediateSurface; if (useIntermediateSurface) { - ComputeEffectiveTransformsForChildren(gfx3DMatrix::From2D(ThebesMatrix(residual))); + ComputeEffectiveTransformsForChildren(Matrix4x4::From2D(residual)); } else { - ComputeEffectiveTransformsForChildren(idealTransform); + ComputeEffectiveTransformsForChildren(ideal); } if (idealTransform.CanDraw2D()) { ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } else { - ComputeEffectiveTransformForMaskLayer(gfx3DMatrix()); + ComputeEffectiveTransformForMaskLayer(Matrix4x4()); } } void -ContainerLayer::ComputeEffectiveTransformsForChildren(const gfx3DMatrix& aTransformToSurface) +ContainerLayer::ComputeEffectiveTransformsForChildren(const Matrix4x4& aTransformToSurface) { for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) { l->ComputeEffectiveTransforms(aTransformToSurface); diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index b44e0d09cba..e2e877c8872 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -1232,12 +1232,12 @@ public: * We promise that when this is called on a layer, all ancestor layers * have already had ComputeEffectiveTransforms called. */ - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) = 0; + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) = 0; /** * computes the effective transform for a mask layer, if this layer has one */ - void ComputeEffectiveTransformForMaskLayer(const gfx3DMatrix& aTransformToSurface); + void ComputeEffectiveTransformForMaskLayer(const gfx::Matrix4x4& aTransformToSurface); /** * Calculate the scissor rect required when rendering this layer. @@ -1478,10 +1478,11 @@ public: MOZ_LAYER_DECL_NAME("ThebesLayer", TYPE_THEBES) - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { gfx::Matrix4x4 idealTransform; - gfx::ToMatrix4x4(GetLocalTransform() * aTransformToSurface, idealTransform); + gfx::ToMatrix4x4(GetLocalTransform(), idealTransform); + idealTransform = idealTransform * aTransformToSurface; gfx::Matrix residual; mEffectiveTransform = SnapTransformTranslation(idealTransform, mAllowResidualTranslation ? &residual : nullptr); @@ -1642,7 +1643,7 @@ public: * container is backend-specific. ComputeEffectiveTransforms must also set * mUseIntermediateSurface. */ - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) = 0; + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) = 0; /** * Call this only after ComputeEffectiveTransforms has been invoked @@ -1687,12 +1688,12 @@ protected: * A default implementation of ComputeEffectiveTransforms for use by OpenGL * and D3D. */ - void DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface); + void DefaultComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface); /** * Loops over the children calling ComputeEffectiveTransforms on them. */ - void ComputeEffectiveTransformsForChildren(const gfx3DMatrix& aTransformToSurface); + void ComputeEffectiveTransformsForChildren(const gfx::Matrix4x4& aTransformToSurface); virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix); @@ -1751,10 +1752,11 @@ public: MOZ_LAYER_DECL_NAME("ColorLayer", TYPE_COLOR) - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { gfx::Matrix4x4 idealTransform; - gfx::ToMatrix4x4(GetLocalTransform() * aTransformToSurface, idealTransform); + gfx::ToMatrix4x4(GetLocalTransform(), idealTransform); + idealTransform = idealTransform * aTransformToSurface; mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } @@ -1892,20 +1894,18 @@ public: MOZ_LAYER_DECL_NAME("CanvasLayer", TYPE_CANVAS) - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { // Snap our local transform first, and snap the inherited transform as well. // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). gfx::Matrix4x4 localTransform; - gfx::Matrix4x4 transformToSurface; gfx::ToMatrix4x4(GetLocalTransform(), localTransform); - gfx::ToMatrix4x4(aTransformToSurface, transformToSurface); mEffectiveTransform = SnapTransform(localTransform, gfxRect(0, 0, mBounds.width, mBounds.height), nullptr)* - SnapTransformTranslation(transformToSurface, nullptr); + SnapTransformTranslation(aTransformToSurface, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } diff --git a/gfx/layers/ReadbackLayer.h b/gfx/layers/ReadbackLayer.h index 0d69b9da8db..a231c3bd667 100644 --- a/gfx/layers/ReadbackLayer.h +++ b/gfx/layers/ReadbackLayer.h @@ -8,7 +8,6 @@ #include // for uint64_t #include "Layers.h" // for Layer, etc -#include "gfx3DMatrix.h" // for gfx3DMatrix #include "gfxColor.h" // for gfxRGBA #include "gfxRect.h" // for gfxRect #include "mozilla/mozalloc.h" // for operator delete @@ -84,19 +83,18 @@ class ReadbackLayer : public Layer { public: MOZ_LAYER_DECL_NAME("ReadbackLayer", TYPE_READBACK) - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { // Snap our local transform first, and snap the inherited transform as well. // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx::Matrix4x4 localTransform, transformToSurface; - gfx::ToMatrix4x4(aTransformToSurface, transformToSurface); + gfx::Matrix4x4 localTransform; gfx::ToMatrix4x4(GetLocalTransform(), localTransform); mEffectiveTransform = SnapTransform(localTransform, gfxRect(0, 0, mSize.width, mSize.height), nullptr)* - SnapTransformTranslation(transformToSurface, nullptr); + SnapTransformTranslation(aTransformToSurface, nullptr); } /** diff --git a/gfx/layers/basic/BasicContainerLayer.cpp b/gfx/layers/basic/BasicContainerLayer.cpp index f1f33dc0c86..49a279c0c0c 100644 --- a/gfx/layers/basic/BasicContainerLayer.cpp +++ b/gfx/layers/basic/BasicContainerLayer.cpp @@ -34,19 +34,21 @@ BasicContainerLayer::~BasicContainerLayer() } void -BasicContainerLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) +BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface) { // We push groups for container layers if we need to, which always // are aligned in device space, so it doesn't really matter how we snap // containers. Matrix residual; - gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface; + gfx3DMatrix idealTransform; + To3DMatrix(aTransformToSurface, idealTransform); + idealTransform = GetLocalTransform() * idealTransform; idealTransform.ProjectTo2D(); if (!idealTransform.CanDraw2D()) { ToMatrix4x4(idealTransform, mEffectiveTransform); - ComputeEffectiveTransformsForChildren(gfx3DMatrix()); - ComputeEffectiveTransformForMaskLayer(gfx3DMatrix()); + ComputeEffectiveTransformsForChildren(Matrix4x4()); + ComputeEffectiveTransformForMaskLayer(Matrix4x4()); mUseIntermediateSurface = true; return; } @@ -56,7 +58,7 @@ BasicContainerLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToS mEffectiveTransform = SnapTransformTranslation(ideal, &residual); // We always pass the ideal matrix down to our children, so there is no // need to apply any compensation using the residual from SnapTransformTranslation. - ComputeEffectiveTransformsForChildren(idealTransform); + ComputeEffectiveTransformsForChildren(ideal); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); diff --git a/gfx/layers/basic/BasicContainerLayer.h b/gfx/layers/basic/BasicContainerLayer.h index 87be6bb238e..c08ece9695d 100644 --- a/gfx/layers/basic/BasicContainerLayer.h +++ b/gfx/layers/basic/BasicContainerLayer.h @@ -55,7 +55,7 @@ public: ContainerLayer::RepositionChild(aChild, aAfter); } - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface); + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface); /** * Returns true when: diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 7b4d30db691..0f6f811fc62 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -599,7 +599,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback, // which depends on correct effective transforms mSnapEffectiveTransforms = mTarget ? !(mTarget->GetFlags() & gfxContext::FLAG_DISABLE_SNAPPING) : true; - mRoot->ComputeEffectiveTransforms(mTarget ? gfx3DMatrix::From2D(mTarget->CurrentMatrix()) : gfx3DMatrix()); + mRoot->ComputeEffectiveTransforms(mTarget ? Matrix4x4::From2D(ToMatrix(mTarget->CurrentMatrix())) : Matrix4x4()); ToData(mRoot)->Validate(aCallback, aCallbackData); if (mRoot->GetMaskLayer()) { diff --git a/gfx/layers/basic/BasicThebesLayer.h b/gfx/layers/basic/BasicThebesLayer.h index 470fc68bf6f..040f05ae7c0 100644 --- a/gfx/layers/basic/BasicThebesLayer.h +++ b/gfx/layers/basic/BasicThebesLayer.h @@ -75,12 +75,13 @@ public: mValidRegion.SetEmpty(); } - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { if (!BasicManager()->IsRetained()) { // Don't do any snapping of our transform, since we're just going to // draw straight through without intermediate buffers. - gfx::ToMatrix4x4(GetLocalTransform() * aTransformToSurface, mEffectiveTransform); + gfx::ToMatrix4x4(GetLocalTransform(), mEffectiveTransform); + mEffectiveTransform = mEffectiveTransform * aTransformToSurface; if (gfxPoint(0,0) != mResidualTranslation) { mResidualTranslation = gfxPoint(0,0); mValidRegion.SetEmpty(); diff --git a/gfx/layers/client/ClientContainerLayer.h b/gfx/layers/client/ClientContainerLayer.h index e3266c272b1..10c1ba02d37 100644 --- a/gfx/layers/client/ClientContainerLayer.h +++ b/gfx/layers/client/ClientContainerLayer.h @@ -121,7 +121,7 @@ public: virtual Layer* AsLayer() { return this; } virtual ShadowableLayer* AsShadowableLayer() { return this; } - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { DefaultComputeEffectiveTransforms(aTransformToSurface); } @@ -161,7 +161,7 @@ public: virtual void RenderLayer() { } - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { DefaultComputeEffectiveTransforms(aTransformToSurface); } diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 169f92257cf..5a157b91f31 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -6,7 +6,6 @@ #include "ClientLayerManager.h" #include "CompositorChild.h" // for CompositorChild #include "GeckoProfiler.h" // for PROFILER_LABEL -#include "gfx3DMatrix.h" // for gfx3DMatrix #include "gfxASurface.h" // for gfxASurface, etc #include "ipc/AutoOpenSurface.h" // for AutoOpenSurface #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc @@ -183,7 +182,7 @@ ClientLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback, mThebesLayerCallback = aCallback; mThebesLayerCallbackData = aCallbackData; - GetRoot()->ComputeEffectiveTransforms(gfx3DMatrix()); + GetRoot()->ComputeEffectiveTransforms(Matrix4x4()); root->RenderLayer(); diff --git a/gfx/layers/composite/ContainerLayerComposite.h b/gfx/layers/composite/ContainerLayerComposite.h index a30183200be..cd1503f64e9 100644 --- a/gfx/layers/composite/ContainerLayerComposite.h +++ b/gfx/layers/composite/ContainerLayerComposite.h @@ -10,7 +10,6 @@ #include "mozilla/Attributes.h" // for MOZ_OVERRIDE #include "mozilla/layers/LayerManagerComposite.h" -class gfx3DMatrix; struct nsIntPoint; struct nsIntRect; @@ -40,7 +39,7 @@ public: virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) MOZ_OVERRIDE + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE { DefaultComputeEffectiveTransforms(aTransformToSurface); } @@ -75,7 +74,7 @@ public: virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) MOZ_OVERRIDE + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE { DefaultComputeEffectiveTransforms(aTransformToSurface); } diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp index 27b84dbd8cc..3909ed4d60a 100644 --- a/gfx/layers/composite/ImageLayerComposite.cpp +++ b/gfx/layers/composite/ImageLayerComposite.cpp @@ -7,7 +7,6 @@ #include "CompositableHost.h" // for CompositableHost #include "Layers.h" // for WriteSnapshotToDumpFile, etc #include "gfx2DGlue.h" // for ToFilter, ToMatrix4x4 -#include "gfx3DMatrix.h" // for gfx3DMatrix #include "gfxRect.h" // for gfxRect #include "gfxUtils.h" // for gfxUtils, etc #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc @@ -103,11 +102,11 @@ ImageLayerComposite::RenderLayer(const nsIntRect& aClipRect) clipRect); } -void -ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) +void +ImageLayerComposite::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { gfx::Matrix4x4 local; - gfx::ToMatrix4x4(GetLocalTransform(), local); + ToMatrix4x4(GetLocalTransform(), local); // Snap image edges to pixel boundaries gfxRect sourceRect(0, 0, 0, 0); @@ -130,11 +129,9 @@ ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToS // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx::Matrix4x4 transformToSurface; - gfx::ToMatrix4x4(aTransformToSurface, transformToSurface); mEffectiveTransform = SnapTransform(local, sourceRect, nullptr) * - SnapTransformTranslation(transformToSurface, nullptr); + SnapTransformTranslation(aTransformToSurface, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } diff --git a/gfx/layers/composite/ImageLayerComposite.h b/gfx/layers/composite/ImageLayerComposite.h index a19186dfd83..5c79a62c649 100644 --- a/gfx/layers/composite/ImageLayerComposite.h +++ b/gfx/layers/composite/ImageLayerComposite.h @@ -15,7 +15,6 @@ #include "nsISupportsImpl.h" // for TextureImage::AddRef, etc #include "nscore.h" // for nsACString -class gfx3DMatrix; struct nsIntPoint; struct nsIntRect; @@ -46,7 +45,7 @@ public: virtual void RenderLayer(const nsIntRect& aClipRect); - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) MOZ_OVERRIDE; + virtual void ComputeEffectiveTransforms(const mozilla::gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE; virtual void CleanupResources() MOZ_OVERRIDE; diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 0e3fc778694..172e035606f 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -236,7 +236,7 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback, // The results of our drawing always go directly into a pixel buffer, // so we don't need to pass any global transform here. - mRoot->ComputeEffectiveTransforms(gfx3DMatrix()); + mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4()); Render(); } diff --git a/gfx/layers/d3d10/ContainerLayerD3D10.h b/gfx/layers/d3d10/ContainerLayerD3D10.h index 2a136afb0ce..572d01cd35e 100644 --- a/gfx/layers/d3d10/ContainerLayerD3D10.h +++ b/gfx/layers/d3d10/ContainerLayerD3D10.h @@ -30,7 +30,7 @@ public: virtual void LayerManagerDestroyed(); - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { DefaultComputeEffectiveTransforms(aTransformToSurface); } diff --git a/gfx/layers/d3d10/LayerManagerD3D10.cpp b/gfx/layers/d3d10/LayerManagerD3D10.cpp index 28eac092e30..be430699289 100644 --- a/gfx/layers/d3d10/LayerManagerD3D10.cpp +++ b/gfx/layers/d3d10/LayerManagerD3D10.cpp @@ -383,7 +383,7 @@ LayerManagerD3D10::EndTransaction(DrawThebesLayerCallback aCallback, // The results of our drawing always go directly into a pixel buffer, // so we don't need to pass any global transform here. - mRoot->ComputeEffectiveTransforms(gfx3DMatrix()); + mRoot->ComputeEffectiveTransforms(Matrix4x4()); #ifdef MOZ_LAYERS_HAVE_LOG MOZ_LAYERS_LOG((" ----- (beginning paint)")); diff --git a/gfx/layers/d3d9/ContainerLayerD3D9.h b/gfx/layers/d3d9/ContainerLayerD3D9.h index b7d94829b38..bd8519f6c95 100644 --- a/gfx/layers/d3d9/ContainerLayerD3D9.h +++ b/gfx/layers/d3d9/ContainerLayerD3D9.h @@ -32,7 +32,7 @@ public: virtual void LayerManagerDestroyed(); - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { DefaultComputeEffectiveTransforms(aTransformToSurface); } diff --git a/gfx/layers/d3d9/LayerManagerD3D9.cpp b/gfx/layers/d3d9/LayerManagerD3D9.cpp index a5dbb154bd2..6c9f6ae6a5b 100644 --- a/gfx/layers/d3d9/LayerManagerD3D9.cpp +++ b/gfx/layers/d3d9/LayerManagerD3D9.cpp @@ -148,7 +148,7 @@ LayerManagerD3D9::EndTransaction(DrawThebesLayerCallback aCallback, // The results of our drawing always go directly into a pixel buffer, // so we don't need to pass any global transform here. - mRoot->ComputeEffectiveTransforms(gfx3DMatrix()); + mRoot->ComputeEffectiveTransforms(gfx::Matrix4x4()); SetCompositingDisabled(aFlags & END_NO_COMPOSITE); Render(); diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index c9f12e69507..96a1c03638a 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -61,7 +61,7 @@ class TestAPZCContainerLayer : public ContainerLayer { {} void RemoveChild(Layer* aChild) {} void InsertAfter(Layer* aChild, Layer* aAfter) {} - void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) {} + void ComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface) {} void RepositionChild(Layer* aChild, Layer* aAfter) {} }; diff --git a/gfx/tests/gtest/TestLayers.cpp b/gfx/tests/gtest/TestLayers.cpp index 85b0bf9a003..f6a5f595f12 100644 --- a/gfx/tests/gtest/TestLayers.cpp +++ b/gfx/tests/gtest/TestLayers.cpp @@ -8,6 +8,7 @@ #include "gmock/gmock.h" using namespace mozilla; +using namespace mozilla::gfx; using namespace mozilla::layers; class TestLayerManager: public LayerManager { @@ -47,7 +48,7 @@ public: return TYPE_CONTAINER; } - virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface) { + virtual void ComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface) { DefaultComputeEffectiveTransforms(aTransformToSurface); } @@ -234,7 +235,7 @@ already_AddRefed CreateLayerTree( } } if (rootLayer) { - rootLayer->ComputeEffectiveTransforms(gfx3DMatrix()); + rootLayer->ComputeEffectiveTransforms(Matrix4x4()); } return rootLayer.forget(); } From 2cef9a18e8d504097da5b2d3fad8528ae098dce6 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 27 Jan 2014 10:28:18 -0500 Subject: [PATCH 55/76] Bug 952977: Convert GetLocalTransform to gfx::Matrix4x4 r=nical --- gfx/2d/Matrix.h | 28 +++++++++++++++++++ gfx/layers/ImageLayers.cpp | 3 +- gfx/layers/Layers.cpp | 17 ++++++----- gfx/layers/Layers.h | 14 +++------- gfx/layers/ReadbackLayer.h | 4 +-- gfx/layers/basic/BasicContainerLayer.cpp | 14 ++++------ gfx/layers/basic/BasicThebesLayer.h | 5 ++-- .../composite/AsyncCompositionManager.cpp | 9 ++++-- gfx/layers/composite/ImageLayerComposite.cpp | 3 +- 9 files changed, 56 insertions(+), 41 deletions(-) diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h index 4be4e891fd3..1e39ac4bc38 100644 --- a/gfx/2d/Matrix.h +++ b/gfx/2d/Matrix.h @@ -285,6 +285,34 @@ public: return Matrix(_11, _12, _21, _22, _41, _42); } + bool CanDraw2D(Matrix* aMatrix = nullptr) const { + if (_14 != 0.0f || + _24 != 0.0f || + _44 != 1.0f) { + return false; + } + if (aMatrix) { + aMatrix->_11 = _11; + aMatrix->_12 = _12; + aMatrix->_21 = _21; + aMatrix->_22 = _22; + aMatrix->_31 = _41; + aMatrix->_32 = _42; + } + return true; + } + + Matrix4x4& ProjectTo2D() { + _31 = 0.0f; + _32 = 0.0f; + _13 = 0.0f; + _23 = 0.0f; + _33 = 1.0f; + _43 = 0.0f; + _34 = 0.0f; + return *this; + } + static Matrix4x4 From2D(const Matrix &aMatrix) { Matrix4x4 matrix; matrix._11 = aMatrix._11; diff --git a/gfx/layers/ImageLayers.cpp b/gfx/layers/ImageLayers.cpp index 620712ea57c..dc07966bd3c 100644 --- a/gfx/layers/ImageLayers.cpp +++ b/gfx/layers/ImageLayers.cpp @@ -29,8 +29,7 @@ void ImageLayer::SetContainer(ImageContainer* aContainer) void ImageLayer::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { - gfx::Matrix4x4 local; - gfx::ToMatrix4x4(GetLocalTransform(), local); + gfx::Matrix4x4 local = GetLocalTransform(); // Snap image edges to pixel boundaries gfxRect sourceRect(0, 0, 0, 0); diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index b0df2a2c5ee..793eee23b60 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -628,7 +628,7 @@ Layer::GetTransform() const return transform; } -const gfx3DMatrix +const Matrix4x4 Layer::GetLocalTransform() { gfx3DMatrix transform; @@ -640,7 +640,10 @@ Layer::GetLocalTransform() transform.Scale(c->GetPreXScale(), c->GetPreYScale(), 1.0f); } transform.ScalePost(mPostXScale, mPostYScale, 1.0f); - return transform; + + Matrix4x4 result; + ToMatrix4x4(transform, result); + return result; } void @@ -888,13 +891,9 @@ void ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface) { Matrix residual; - gfx3DMatrix idealTransform; - To3DMatrix(aTransformToSurface, idealTransform); - idealTransform = GetLocalTransform() * idealTransform; + Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface; idealTransform.ProjectTo2D(); - Matrix4x4 ideal; - ToMatrix4x4(idealTransform, ideal); - mEffectiveTransform = SnapTransformTranslation(ideal, &residual); + mEffectiveTransform = SnapTransformTranslation(idealTransform, &residual); bool useIntermediateSurface; if (GetMaskLayer()) { @@ -939,7 +938,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS if (useIntermediateSurface) { ComputeEffectiveTransformsForChildren(Matrix4x4::From2D(residual)); } else { - ComputeEffectiveTransformsForChildren(ideal); + ComputeEffectiveTransformsForChildren(idealTransform); } if (idealTransform.CanDraw2D()) { diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index e2e877c8872..34fb5c0f602 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -1074,7 +1074,7 @@ public: * Returns the local transform for this layer: either mTransform or, * for shadow layers, GetShadowTransform() */ - const gfx3DMatrix GetLocalTransform(); + const gfx::Matrix4x4 GetLocalTransform(); /** * Returns the local opacity for this layer: either mOpacity or, @@ -1480,9 +1480,7 @@ public: virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { - gfx::Matrix4x4 idealTransform; - gfx::ToMatrix4x4(GetLocalTransform(), idealTransform); - idealTransform = idealTransform * aTransformToSurface; + gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface; gfx::Matrix residual; mEffectiveTransform = SnapTransformTranslation(idealTransform, mAllowResidualTranslation ? &residual : nullptr); @@ -1754,9 +1752,7 @@ public: virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { - gfx::Matrix4x4 idealTransform; - gfx::ToMatrix4x4(GetLocalTransform(), idealTransform); - idealTransform = idealTransform * aTransformToSurface; + gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface; mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); } @@ -1900,10 +1896,8 @@ public: // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx::Matrix4x4 localTransform; - gfx::ToMatrix4x4(GetLocalTransform(), localTransform); mEffectiveTransform = - SnapTransform(localTransform, gfxRect(0, 0, mBounds.width, mBounds.height), + SnapTransform(GetLocalTransform(), gfxRect(0, 0, mBounds.width, mBounds.height), nullptr)* SnapTransformTranslation(aTransformToSurface, nullptr); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); diff --git a/gfx/layers/ReadbackLayer.h b/gfx/layers/ReadbackLayer.h index a231c3bd667..5fe7ee0b382 100644 --- a/gfx/layers/ReadbackLayer.h +++ b/gfx/layers/ReadbackLayer.h @@ -89,10 +89,8 @@ public: // This makes our snapping equivalent to what would happen if our content // was drawn into a ThebesLayer (gfxContext would snap using the local // transform, then we'd snap again when compositing the ThebesLayer). - gfx::Matrix4x4 localTransform; - gfx::ToMatrix4x4(GetLocalTransform(), localTransform); mEffectiveTransform = - SnapTransform(localTransform, gfxRect(0, 0, mSize.width, mSize.height), + SnapTransform(GetLocalTransform(), gfxRect(0, 0, mSize.width, mSize.height), nullptr)* SnapTransformTranslation(aTransformToSurface, nullptr); } diff --git a/gfx/layers/basic/BasicContainerLayer.cpp b/gfx/layers/basic/BasicContainerLayer.cpp index 49a279c0c0c..69c9f3ba36a 100644 --- a/gfx/layers/basic/BasicContainerLayer.cpp +++ b/gfx/layers/basic/BasicContainerLayer.cpp @@ -40,28 +40,24 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur // are aligned in device space, so it doesn't really matter how we snap // containers. Matrix residual; - gfx3DMatrix idealTransform; - To3DMatrix(aTransformToSurface, idealTransform); - idealTransform = GetLocalTransform() * idealTransform; + Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface; idealTransform.ProjectTo2D(); if (!idealTransform.CanDraw2D()) { - ToMatrix4x4(idealTransform, mEffectiveTransform); + mEffectiveTransform = idealTransform; ComputeEffectiveTransformsForChildren(Matrix4x4()); ComputeEffectiveTransformForMaskLayer(Matrix4x4()); mUseIntermediateSurface = true; return; } - Matrix4x4 ideal; - ToMatrix4x4(idealTransform, ideal); - mEffectiveTransform = SnapTransformTranslation(ideal, &residual); + mEffectiveTransform = SnapTransformTranslation(idealTransform, &residual); // We always pass the ideal matrix down to our children, so there is no // need to apply any compensation using the residual from SnapTransformTranslation. - ComputeEffectiveTransformsForChildren(ideal); + ComputeEffectiveTransformsForChildren(idealTransform); ComputeEffectiveTransformForMaskLayer(aTransformToSurface); - + Layer* child = GetFirstChild(); bool hasSingleBlendingChild = false; if (!HasMultipleChildren() && child) { diff --git a/gfx/layers/basic/BasicThebesLayer.h b/gfx/layers/basic/BasicThebesLayer.h index 040f05ae7c0..9f293bb8d21 100644 --- a/gfx/layers/basic/BasicThebesLayer.h +++ b/gfx/layers/basic/BasicThebesLayer.h @@ -74,14 +74,13 @@ public: } mValidRegion.SetEmpty(); } - + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { if (!BasicManager()->IsRetained()) { // Don't do any snapping of our transform, since we're just going to // draw straight through without intermediate buffers. - gfx::ToMatrix4x4(GetLocalTransform(), mEffectiveTransform); - mEffectiveTransform = mEffectiveTransform * aTransformToSurface; + mEffectiveTransform = GetLocalTransform() * aTransformToSurface; if (gfxPoint(0,0) != mResidualTranslation) { mResidualTranslation = gfxPoint(0,0); mValidRegion.SetEmpty(); diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 9e40121f705..398eb64aa91 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -43,6 +43,7 @@ struct nsCSSValueSharedList; using namespace mozilla::dom; +using namespace mozilla::gfx; namespace mozilla { namespace layers { @@ -125,8 +126,10 @@ static bool GetBaseTransform2D(Layer* aLayer, gfxMatrix* aTransform) { // Start with the animated transform if there is one + gfx3DMatrix localTransform; + To3DMatrix(aLayer->GetLocalTransform(), localTransform); return (aLayer->AsLayerComposite()->GetShadowTransformSetByAnimation() ? - aLayer->GetLocalTransform() : aLayer->GetTransform()).Is2D(aTransform); + localTransform : aLayer->GetTransform()).Is2D(aTransform); } static void @@ -251,7 +254,7 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, } gfxMatrix oldRootTransform; - gfxMatrix newRootTransform; + Matrix newRootTransform; if (!aPreviousTransformForRoot.Is2D(&oldRootTransform) || !aTransformedSubtreeRoot->GetLocalTransform().Is2D(&newRootTransform)) { return; @@ -260,7 +263,7 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, // Calculate the cumulative transforms between the subtree root with the // old transform and the current transform. gfxMatrix oldCumulativeTransform = ancestorTransform * oldRootTransform; - gfxMatrix newCumulativeTransform = ancestorTransform * newRootTransform; + gfxMatrix newCumulativeTransform = ancestorTransform * ThebesMatrix(newRootTransform); if (newCumulativeTransform.IsSingular()) { return; } diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp index 3909ed4d60a..528ff5aba4b 100644 --- a/gfx/layers/composite/ImageLayerComposite.cpp +++ b/gfx/layers/composite/ImageLayerComposite.cpp @@ -105,8 +105,7 @@ ImageLayerComposite::RenderLayer(const nsIntRect& aClipRect) void ImageLayerComposite::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) { - gfx::Matrix4x4 local; - ToMatrix4x4(GetLocalTransform(), local); + gfx::Matrix4x4 local = GetLocalTransform(); // Snap image edges to pixel boundaries gfxRect sourceRect(0, 0, 0, 0); From 1e61d187aa4011185a29766aa466318628d2f911 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 27 Jan 2014 10:28:33 -0500 Subject: [PATCH 56/76] Bug 952977: Convert SetBaseTransform to gfx::Matrix4x4 r=nical --- gfx/2d/Matrix.h | 10 +++++++ gfx/ipc/GfxMessageUtils.h | 26 +++++++++++++++++++ gfx/layers/Layers.cpp | 2 +- gfx/layers/Layers.h | 14 ++++++---- .../composite/AsyncCompositionManager.cpp | 7 +++-- gfx/layers/ipc/LayersMessages.ipdlh | 3 ++- gfx/layers/ipc/ShadowLayers.cpp | 4 ++- .../gtest/TestAsyncPanZoomController.cpp | 4 +-- gfx/tests/gtest/TestLayers.cpp | 4 ++- layout/base/FrameLayerBuilder.cpp | 20 ++++++++------ layout/base/nsDisplayList.cpp | 15 ++++++----- layout/generic/nsFrame.cpp | 4 ++- layout/generic/nsHTMLCanvasFrame.cpp | 7 ++--- layout/generic/nsImageFrame.cpp | 7 ++--- layout/generic/nsObjectFrame.cpp | 7 ++--- layout/generic/nsVideoFrame.cpp | 7 ++--- layout/ipc/RenderFrameParent.cpp | 4 +-- layout/xul/nsImageBoxFrame.cpp | 7 ++--- 18 files changed, 107 insertions(+), 45 deletions(-) diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h index 1e39ac4bc38..2646bc45c54 100644 --- a/gfx/2d/Matrix.h +++ b/gfx/2d/Matrix.h @@ -346,6 +346,16 @@ public: return *this; } + Matrix4x4 &Translate(Float aX, Float aY, Float aZ) + { + _41 += aX * _11 + aY * _21 + aZ * _31; + _42 += aX * _12 + aY * _22 + aZ * _32; + _43 += aX * _13 + aY * _23 + aZ * _33; + _44 += aX * _14 + aY * _24 + aZ * _34; + + return *this; + } + bool operator==(const Matrix4x4& o) const { // XXX would be nice to memcmp here, but that breaks IEEE 754 semantics diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index fafb452dc34..cad41d60fec 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -80,6 +80,32 @@ struct ParamTraits } }; +template<> +struct ParamTraits +{ + typedef mozilla::gfx::Matrix4x4 paramType; + + static void Write(Message* msg, const paramType& param) + { +#define Wr(_f) WriteParam(msg, param. _f) + Wr(_11); Wr(_12); Wr(_13); Wr(_14); + Wr(_21); Wr(_22); Wr(_23); Wr(_24); + Wr(_31); Wr(_32); Wr(_33); Wr(_34); + Wr(_41); Wr(_42); Wr(_43); Wr(_44); +#undef Wr + } + + static bool Read(const Message* msg, void** iter, paramType* result) + { +#define Rd(_f) ReadParam(msg, iter, &result-> _f) + return (Rd(_11) && Rd(_12) && Rd(_13) && Rd(_14) && + Rd(_21) && Rd(_22) && Rd(_23) && Rd(_24) && + Rd(_31) && Rd(_32) && Rd(_33) && Rd(_34) && + Rd(_41) && Rd(_42) && Rd(_43) && Rd(_44)); +#undef Rd + } +}; + template<> struct ParamTraits { diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 793eee23b60..76cc9b17d25 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -306,7 +306,7 @@ CreateCSSValueList(const InfallibleTArray& aFunctions) case TransformFunction::TTransformMatrix: { arr = nsStyleAnimation::AppendTransformFunction(eCSSKeyword_matrix3d, resultTail); - const gfx3DMatrix& matrix = aFunctions[i].get_TransformMatrix().value(); + const gfx::Matrix4x4& matrix = aFunctions[i].get_TransformMatrix().value(); arr->Item(1).SetFloatValue(matrix._11, eCSSUnit_Number); arr->Item(2).SetFloatValue(matrix._12, eCSSUnit_Number); arr->Item(3).SetFloatValue(matrix._13, eCSSUnit_Number); diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 34fb5c0f602..02497abe456 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -885,16 +885,18 @@ public: * Tell this layer what its transform should be. The transformation * is applied when compositing the layer into its parent container. */ - void SetBaseTransform(const gfx3DMatrix& aMatrix) + void SetBaseTransform(const gfx::Matrix4x4& aMatrix) { NS_ASSERTION(!aMatrix.IsSingular(), "Shouldn't be trying to draw with a singular matrix!"); mPendingTransform = nullptr; - if (mTransform == aMatrix) { + gfx3DMatrix transform; + gfx::To3DMatrix(aMatrix, transform); + if (mTransform == transform) { return; } MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) BaseTransform", this)); - mTransform = aMatrix; + mTransform = transform; Mutated(); } @@ -906,9 +908,11 @@ public: * method enqueues a new transform value to be set immediately after * the next transaction is opened. */ - void SetBaseTransformForNextTransaction(const gfx3DMatrix& aMatrix) + void SetBaseTransformForNextTransaction(const gfx::Matrix4x4& aMatrix) { - mPendingTransform = new gfx3DMatrix(aMatrix); + gfx3DMatrix matrix; + gfx::To3DMatrix(aMatrix, matrix); + mPendingTransform = new gfx3DMatrix(matrix); } void SetPostScale(float aXScale, float aYScale) diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 398eb64aa91..573b4107388 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -392,7 +392,9 @@ SampleValue(float aPortion, Animation& aAnimation, nsStyleAnimation::Value& aSta transform.Translate(scaledOrigin); InfallibleTArray functions; - functions.AppendElement(TransformMatrix(transform)); + Matrix4x4 realTransform; + ToMatrix4x4(transform, realTransform); + functions.AppendElement(TransformMatrix(realTransform)); *aValue = functions; } @@ -447,7 +449,8 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint) } case eCSSProperty_transform: { - gfx3DMatrix matrix = interpolatedValue.get_ArrayOfTransformFunction()[0].get_TransformMatrix().value(); + gfx3DMatrix matrix; + gfx::To3DMatrix(interpolatedValue.get_ArrayOfTransformFunction()[0].get_TransformMatrix().value(), matrix); if (ContainerLayer* c = aLayer->AsContainerLayer()) { matrix.ScalePost(c->GetInheritedXScale(), c->GetInheritedYScale(), diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index 405361aabc7..9690fa66884 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -20,6 +20,7 @@ include "ImageLayers.h"; using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h"; using struct gfxRGBA from "gfxColor.h"; using struct gfxPoint3D from "gfxPoint3D.h"; +using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h"; using class gfx3DMatrix from "gfx3DMatrix.h"; using nscoord from "nsCoord.h"; using struct nsIntPoint from "nsPoint.h"; @@ -110,7 +111,7 @@ struct Scale { struct Skew { float x; float y; }; struct SkewX { float x; }; struct SkewY { float y; }; -struct TransformMatrix { gfx3DMatrix value; }; +struct TransformMatrix { Matrix4x4 value; }; struct Translation { float x; float y; diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 22bb5a5cd7f..8570929c6ad 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -489,7 +489,9 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies, bool common.eventRegions() = mutant->GetEventRegions(); common.postXScale() = mutant->GetPostXScale(); common.postYScale() = mutant->GetPostYScale(); - common.transform() = mutant->GetBaseTransform(); + gfx::Matrix4x4 transform; + gfx::ToMatrix4x4(mutant->GetBaseTransform(), transform); + common.transform() = transform; common.contentFlags() = mutant->GetContentFlags(); common.opacity() = mutant->GetOpacity(); common.useClipRect() = !!mutant->GetClipRect(); diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index 96a1c03638a..438bd75d4fc 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -815,8 +815,8 @@ TEST(APZCTreeManager, HitTesting2) { gfx3DMatrix transformToGecko; // Set a CSS transform on one of the layers. - gfx3DMatrix transform; - transform.ScalePost(2, 1, 1); + Matrix4x4 transform; + transform = transform * Matrix4x4().Scale(2, 1, 1); layers[2]->SetBaseTransform(transform); // Make some other layers scrollable. diff --git a/gfx/tests/gtest/TestLayers.cpp b/gfx/tests/gtest/TestLayers.cpp index f6a5f595f12..81851624ec1 100644 --- a/gfx/tests/gtest/TestLayers.cpp +++ b/gfx/tests/gtest/TestLayers.cpp @@ -218,7 +218,9 @@ already_AddRefed CreateLayerTree( } else { nsRefPtr layer = CreateLayer(aLayerTreeDescription[i], manager.get()); layer->SetVisibleRegion(aVisibleRegions[layerNumber]); - layer->SetBaseTransform(aTransforms[layerNumber]); + Matrix4x4 transform; + ToMatrix4x4(aTransforms[layerNumber], transform); + layer->SetBaseTransform(transform); aLayersOut.AppendElement(layer); layerNumber++; if (rootLayer && !parentContainerLayer) { diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 21752e9a980..e300782b1c2 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -1497,15 +1497,15 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot RoundToMatchResidual(scaledOffset.y, data->mAnimatedGeometryRootPosition.y)); data->mTranslation = pixOffset; pixOffset += mParameters.mOffset; - gfxMatrix matrix; - matrix.Translate(gfxPoint(pixOffset.x, pixOffset.y)); - layer->SetBaseTransform(gfx3DMatrix::From2D(matrix)); + Matrix matrix; + matrix.Translate(pixOffset.x, pixOffset.y); + layer->SetBaseTransform(Matrix4x4::From2D(matrix)); // FIXME: Temporary workaround for bug 681192 and bug 724786. #ifndef MOZ_ANDROID_OMTC // Calculate exact position of the top-left of the active scrolled root. // This might not be 0,0 due to the snapping in ScaleToNearestPixels. - gfxPoint animatedGeometryRootTopLeft = scaledOffset - matrix.GetTranslation() + mParameters.mOffset; + gfxPoint animatedGeometryRootTopLeft = scaledOffset - ThebesPoint(matrix.GetTranslation()) + mParameters.mOffset; // If it has changed, then we need to invalidate the entire layer since the // pixels in the layer buffer have the content at a (subpixel) offset // from what we need. @@ -1780,7 +1780,9 @@ ContainerState::PopThebesLayerData() colorLayer->SetColor(data->mSolidColor); // Copy transform - colorLayer->SetBaseTransform(data->mLayer->GetBaseTransform()); + Matrix4x4 base; + ToMatrix4x4(data->mLayer->GetBaseTransform(), base); + colorLayer->SetBaseTransform(base); colorLayer->SetPostScale(data->mLayer->GetPostXScale(), data->mLayer->GetPostYScale()); nsIntRect visibleRect = data->mVisibleRegion.GetBounds(); @@ -2985,7 +2987,9 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder, } // Store the inverse of our resolution-scale on the layer - aLayer->SetBaseTransform(transform); + Matrix4x4 baseTransform; + ToMatrix4x4(transform, baseTransform); + aLayer->SetBaseTransform(baseTransform); aLayer->SetPreScale(1.0f/float(scale.width), 1.0f/float(scale.height)); aLayer->SetInheritedScale(aIncomingScale.mXScale, @@ -3830,8 +3834,8 @@ ContainerState::SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip, maskLayer->SetContainer(container); maskTransform.Invert(); - gfx3DMatrix matrix = gfx3DMatrix::From2D(ThebesMatrix(maskTransform)); - matrix.Translate(gfxPoint3D(mParameters.mOffset.x, mParameters.mOffset.y, 0)); + Matrix4x4 matrix = Matrix4x4::From2D(maskTransform); + matrix.Translate(mParameters.mOffset.x, mParameters.mOffset.y, 0); maskLayer->SetBaseTransform(matrix); // save the details of the clip in user data diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index f40931f3fff..9c02f8bb0db 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -224,7 +224,7 @@ static void AddTransformFunctions(nsCSSValueList* aList, } case eCSSKeyword_matrix: { - gfx3DMatrix matrix; + gfx::Matrix4x4 matrix; matrix._11 = array->Item(1).GetFloatValue(); matrix._12 = array->Item(2).GetFloatValue(); matrix._13 = 0; @@ -246,7 +246,7 @@ static void AddTransformFunctions(nsCSSValueList* aList, } case eCSSKeyword_matrix3d: { - gfx3DMatrix matrix; + gfx::Matrix4x4 matrix; matrix._11 = array->Item(1).GetFloatValue(); matrix._12 = array->Item(2).GetFloatValue(); matrix._13 = array->Item(3).GetFloatValue(); @@ -275,7 +275,9 @@ static void AddTransformFunctions(nsCSSValueList* aList, canStoreInRuleTree, aBounds, aAppUnitsPerPixel); - aFunctions.AppendElement(TransformMatrix(matrix)); + gfx::Matrix4x4 transform; + gfx::ToMatrix4x4(matrix, transform); + aFunctions.AppendElement(TransformMatrix(transform)); break; } case eCSSKeyword_perspective: @@ -1967,11 +1969,12 @@ nsDisplayBackgroundImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& a mozilla::gfx::IntSize imageSize = mImageContainer->GetCurrentSize(); NS_ASSERTION(imageSize.width != 0 && imageSize.height != 0, "Invalid image size!"); - gfxMatrix transform; - transform.Translate(mDestRect.TopLeft() + aOffset); + gfxPoint p = mDestRect.TopLeft() + aOffset; + gfx::Matrix transform; + transform.Translate(p.x, p.y); transform.Scale(mDestRect.width/imageSize.width, mDestRect.height/imageSize.height); - aLayer->SetBaseTransform(gfx3DMatrix::From2D(transform)); + aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); aLayer->SetVisibleRegion(nsIntRect(0, 0, imageSize.width, imageSize.height)); } diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index e7a40b17273..eeda421b010 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4851,7 +4851,9 @@ nsIFrame::TryUpdateTransformOnly() !gfx::FuzzyEqual(transform.yx, previousTransform.yx, kError)) { return false; } - layer->SetBaseTransformForNextTransaction(transform3d); + gfx::Matrix4x4 matrix; + gfx::ToMatrix4x4(transform3d, matrix); + layer->SetBaseTransformForNextTransaction(matrix); return true; } diff --git a/layout/generic/nsHTMLCanvasFrame.cpp b/layout/generic/nsHTMLCanvasFrame.cpp index e3533b4ade8..3731479df9b 100644 --- a/layout/generic/nsHTMLCanvasFrame.cpp +++ b/layout/generic/nsHTMLCanvasFrame.cpp @@ -266,10 +266,11 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder, presContext->AppUnitsToGfxUnits(area.height)); // Transform the canvas into the right place - gfxMatrix transform; - transform.Translate(r.TopLeft() + aContainerParameters.mOffset); + gfx::Matrix transform; + gfxPoint p = r.TopLeft() + aContainerParameters.mOffset; + transform.Translate(p.x, p.y); transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height); - layer->SetBaseTransform(gfx3DMatrix::From2D(transform)); + layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this)); layer->SetVisibleRegion(nsIntRect(0, 0, canvasSize.width, canvasSize.height)); diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index b3adc35a53e..28dfe2d9bf1 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1360,11 +1360,12 @@ nsDisplayImage::ConfigureLayer(ImageLayer *aLayer, const nsIntPoint& aOffset) const gfxRect destRect = GetDestRect(); - gfxMatrix transform; - transform.Translate(destRect.TopLeft() + aOffset); + gfx::Matrix transform; + gfxPoint p = destRect.TopLeft() + aOffset; + transform.Translate(p.x, p.y); transform.Scale(destRect.Width()/imageWidth, destRect.Height()/imageHeight); - aLayer->SetBaseTransform(gfx3DMatrix::From2D(transform)); + aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight)); } diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 508f02062c8..2d663f07c2e 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1637,10 +1637,11 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder, } // Set a transform on the layer to draw the plugin in the right place - gfxMatrix transform; - transform.Translate(r.TopLeft() + aContainerParameters.mOffset); + Matrix transform; + gfxPoint p = r.TopLeft() + aContainerParameters.mOffset; + transform.Translate(p.x, p.y); - layer->SetBaseTransform(gfx3DMatrix::From2D(transform)); + layer->SetBaseTransform(Matrix4x4::From2D(transform)); layer->SetVisibleRegion(ThebesIntRect(IntRect(IntPoint(0, 0), size))); return layer.forget(); } diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index d0558b6d842..1a7565e7de1 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -215,10 +215,11 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder, layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this)); layer->SetContentFlags(Layer::CONTENT_OPAQUE); // Set a transform on the layer to draw the video in the right place - gfxMatrix transform; - transform.Translate(r.TopLeft() + aContainerParameters.mOffset); + gfx::Matrix transform; + gfxPoint p = r.TopLeft() + aContainerParameters.mOffset; + transform.Translate(p.x, p.y); transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height); - layer->SetBaseTransform(gfx3DMatrix::From2D(transform)); + layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); layer->SetVisibleRegion(nsIntRect(0, 0, frameSize.width, frameSize.height)); nsRefPtr result = layer.forget(); return result.forget(); diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 3a0a93164cf..d88c3a4cf41 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -850,8 +850,8 @@ RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder, // container, but our display item is LAYER_ACTIVE_FORCE which // forces all layers above to be active. MOZ_ASSERT(aContainerParameters.mOffset == nsIntPoint()); - gfx3DMatrix m = - gfx3DMatrix::Translation(offset.x, offset.y, 0.0); + gfx::Matrix4x4 m; + m.Translate(offset.x, offset.y, 0.0); // Remote content can't be repainted by us, so we multiply down // the resolution that our container expects onto our container. m.Scale(aContainerParameters.mXScale, aContainerParameters.mYScale, 1.0); diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index 9bd4854ffaa..2c0df3349ac 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -400,11 +400,12 @@ nsDisplayXULImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& aOffset) NS_ASSERTION(imageWidth != 0 && imageHeight != 0, "Invalid image size!"); - gfxMatrix transform; - transform.Translate(destRect.TopLeft() + aOffset); + gfxPoint p = destRect.TopLeft() + aOffset; + gfx::Matrix transform; + transform.Translate(p.x, p.y); transform.Scale(destRect.Width()/imageWidth, destRect.Height()/imageHeight); - aLayer->SetBaseTransform(gfx3DMatrix::From2D(transform)); + aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform)); aLayer->SetVisibleRegion(nsIntRect(0, 0, imageWidth, imageHeight)); } From 44eeb608e10f24d9183c261f8fbb9257ebb2cb23 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 27 Jan 2014 10:28:47 -0500 Subject: [PATCH 57/76] Bug 952977: Convert GetTransform to gfx::Matrix4x4 r=nical --- dom/base/nsDOMWindowUtils.cpp | 4 +- gfx/layers/LayerSorter.cpp | 8 ++- gfx/layers/LayerTreeInvalidation.cpp | 22 +++++-- gfx/layers/Layers.cpp | 14 ++--- gfx/layers/Layers.h | 5 +- gfx/layers/ReadbackProcessor.cpp | 10 +-- gfx/layers/composite/APZCTreeManager.cpp | 9 ++- .../composite/AsyncCompositionManager.cpp | 61 +++++++++++-------- gfx/tests/gtest/TestLayers.cpp | 2 +- layout/base/FrameLayerBuilder.cpp | 11 ++-- layout/ipc/RenderFrameParent.cpp | 17 ++++-- 11 files changed, 99 insertions(+), 64 deletions(-) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 0726f4e650c..291fc4d7b7c 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2682,12 +2682,12 @@ nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile, static bool CheckLeafLayers(Layer* aLayer, const nsIntPoint& aOffset, nsIntRegion* aCoveredRegion) { - gfxMatrix transform; + gfx::Matrix transform; if (!aLayer->GetTransform().Is2D(&transform) || transform.HasNonIntegerTranslation()) return false; transform.NudgeToIntegers(); - nsIntPoint offset = aOffset + nsIntPoint(transform.x0, transform.y0); + nsIntPoint offset = aOffset + nsIntPoint(transform._31, transform._32); Layer* child = aLayer->GetFirstChild(); if (child) { diff --git a/gfx/layers/LayerSorter.cpp b/gfx/layers/LayerSorter.cpp index 8d242d64e89..454aba31690 100644 --- a/gfx/layers/LayerSorter.cpp +++ b/gfx/layers/LayerSorter.cpp @@ -23,6 +23,8 @@ #include "limits.h" #include "mozilla/Assertions.h" +using namespace mozilla::gfx; + namespace mozilla { namespace layers { @@ -78,8 +80,10 @@ static LayerSortOrder CompareDepth(Layer* aOne, Layer* aTwo) { gfxRect ourRect = aOne->GetEffectiveVisibleRegion().GetBounds(); gfxRect otherRect = aTwo->GetEffectiveVisibleRegion().GetBounds(); - gfx3DMatrix ourTransform = aOne->GetTransform(); - gfx3DMatrix otherTransform = aTwo->GetTransform(); + gfx3DMatrix ourTransform; + To3DMatrix(aOne->GetTransform(), ourTransform); + gfx3DMatrix otherTransform; + To3DMatrix(aTwo->GetTransform(), otherTransform); // Transform both rectangles and project into 2d space. gfxQuad ourTransformedRect = ourTransform.TransformRect(ourRect); diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index c9c8571656a..59e694c09cd 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -111,7 +111,6 @@ struct LayerPropertiesBase : public LayerProperties , mMaskLayer(nullptr) , mVisibleRegion(aLayer->GetVisibleRegion()) , mInvalidRegion(aLayer->GetInvalidRegion()) - , mTransform(aLayer->GetTransform()) , mOpacity(aLayer->GetOpacity()) , mUseClipRect(!!aLayer->GetClipRect()) { @@ -122,6 +121,7 @@ struct LayerPropertiesBase : public LayerProperties if (mUseClipRect) { mClipRect = *aLayer->GetClipRect(); } + gfx::To3DMatrix(aLayer->GetTransform(), mTransform); } LayerPropertiesBase() : mLayer(nullptr) @@ -141,7 +141,9 @@ struct LayerPropertiesBase : public LayerProperties nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback) { - bool transformChanged = !mTransform.FuzzyEqual(mLayer->GetTransform()); + gfx3DMatrix transform; + gfx::To3DMatrix(mLayer->GetTransform(), transform); + bool transformChanged = !mTransform.FuzzyEqual(transform); Layer* otherMask = mLayer->GetMaskLayer(); const nsIntRect* otherClip = mLayer->GetClipRect(); nsIntRegion result; @@ -189,7 +191,9 @@ struct LayerPropertiesBase : public LayerProperties nsIntRect NewTransformedBounds() { - return TransformRect(mLayer->GetVisibleRegion().GetBounds(), mLayer->GetTransform()); + gfx3DMatrix transform; + gfx::To3DMatrix(mLayer->GetTransform(), transform); + return TransformRect(mLayer->GetVisibleRegion().GetBounds(), transform); } nsIntRect OldTransformedBounds() @@ -271,7 +275,9 @@ struct ContainerLayerProperties : public LayerPropertiesBase invalidateChildsCurrentArea = true; } if (invalidateChildsCurrentArea) { - AddTransformedRegion(result, child->GetVisibleRegion(), child->GetTransform()); + gfx3DMatrix transform; + gfx::To3DMatrix(child->GetTransform(), transform); + AddTransformedRegion(result, child->GetVisibleRegion(), transform); if (aCallback) { NotifySubdocumentInvalidationRecursive(child, aCallback); } else { @@ -290,7 +296,9 @@ struct ContainerLayerProperties : public LayerPropertiesBase aCallback(container, result); } - return TransformRegion(result, mLayer->GetTransform()); + gfx3DMatrix transform; + gfx::To3DMatrix(mLayer->GetTransform(), transform); + return TransformRegion(result, transform); } // The old list of children: @@ -406,7 +414,9 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu } else { ClearInvalidations(aRoot); } - nsIntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(), aRoot->GetTransform()); + gfx3DMatrix transform; + gfx::To3DMatrix(aRoot->GetTransform(), transform); + nsIntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(), transform); result = result.Union(OldTransformedBounds()); return result; } else { diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 76cc9b17d25..85657115e84 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -617,14 +617,15 @@ Layer::CalculateScissorRect(const nsIntRect& aCurrentScissorRect, return currentClip.Intersect(scissor); } -const gfx3DMatrix +const Matrix4x4 Layer::GetTransform() const { - gfx3DMatrix transform = mTransform; + Matrix4x4 transform; + ToMatrix4x4(mTransform, transform); if (const ContainerLayer* c = AsContainerLayer()) { transform.Scale(c->GetPreXScale(), c->GetPreYScale(), 1.0f); } - transform.ScalePost(mPostXScale, mPostYScale, 1.0f); + transform = transform * Matrix4x4().Scale(mPostXScale, mPostYScale, 1.0f); return transform; } @@ -697,13 +698,10 @@ Layer::ComputeEffectiveTransformForMaskLayer(const Matrix4x4& aTransformToSurfac mMaskLayer->mEffectiveTransform = aTransformToSurface; #ifdef DEBUG - gfxMatrix maskTranslation; - bool maskIs2D = mMaskLayer->GetTransform().CanDraw2D(&maskTranslation); + bool maskIs2D = mMaskLayer->GetTransform().CanDraw2D(); NS_ASSERTION(maskIs2D, "How did we end up with a 3D transform here?!"); #endif - Matrix4x4 maskTransform; - ToMatrix4x4(mMaskLayer->GetTransform(), maskTransform); - mMaskLayer->mEffectiveTransform = maskTransform * mMaskLayer->mEffectiveTransform; + mMaskLayer->mEffectiveTransform = mMaskLayer->GetTransform() * mMaskLayer->mEffectiveTransform; } } diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 02497abe456..709dfbb226e 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -867,8 +867,7 @@ public: { #ifdef DEBUG if (aMaskLayer) { - gfxMatrix maskTransform; - bool maskIs2D = aMaskLayer->GetTransform().CanDraw2D(&maskTransform); + bool maskIs2D = aMaskLayer->GetTransform().CanDraw2D(); NS_ASSERTION(maskIs2D, "Mask layer has invalid transform."); } #endif @@ -1051,7 +1050,7 @@ public: const Layer* GetPrevSibling() const { return mPrevSibling; } virtual Layer* GetFirstChild() const { return nullptr; } virtual Layer* GetLastChild() const { return nullptr; } - const gfx3DMatrix GetTransform() const; + const gfx::Matrix4x4 GetTransform() const; const gfx3DMatrix& GetBaseTransform() const { return mTransform; } float GetPostXScale() const { return mPostXScale; } float GetPostYScale() const { return mPostYScale; } diff --git a/gfx/layers/ReadbackProcessor.cpp b/gfx/layers/ReadbackProcessor.cpp index e0a3b5e5bbd..cd4b02a54ec 100644 --- a/gfx/layers/ReadbackProcessor.cpp +++ b/gfx/layers/ReadbackProcessor.cpp @@ -46,19 +46,19 @@ ReadbackProcessor::BuildUpdates(ContainerLayer* aContainer) static Layer* FindBackgroundLayer(ReadbackLayer* aLayer, nsIntPoint* aOffset) { - gfxMatrix transform; + gfx::Matrix transform; if (!aLayer->GetTransform().Is2D(&transform) || transform.HasNonIntegerTranslation()) return nullptr; - nsIntPoint transformOffset(int32_t(transform.x0), int32_t(transform.y0)); + nsIntPoint transformOffset(int32_t(transform._31), int32_t(transform._32)); for (Layer* l = aLayer->GetPrevSibling(); l; l = l->GetPrevSibling()) { - gfxMatrix backgroundTransform; + gfx::Matrix backgroundTransform; if (!l->GetTransform().Is2D(&backgroundTransform) || - backgroundTransform.HasNonIntegerTranslation()) + gfx::ThebesMatrix(backgroundTransform).HasNonIntegerTranslation()) return nullptr; - nsIntPoint backgroundOffset(int32_t(backgroundTransform.x0), int32_t(backgroundTransform.y0)); + nsIntPoint backgroundOffset(int32_t(backgroundTransform._31), int32_t(backgroundTransform._32)); nsIntRect rectInBackground(transformOffset - backgroundOffset, aLayer->GetSize()); const nsIntRegion& visibleRegion = l->GetEffectiveVisibleRegion(); if (!visibleRegion.Intersects(rectInBackground)) diff --git a/gfx/layers/composite/APZCTreeManager.cpp b/gfx/layers/composite/APZCTreeManager.cpp index a432eebf840..dfeebbfdb3a 100644 --- a/gfx/layers/composite/APZCTreeManager.cpp +++ b/gfx/layers/composite/APZCTreeManager.cpp @@ -214,7 +214,10 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor, * container->GetFrameMetrics().LayersPixelsPerCSSPixel() * LayerToScreenScale(1.0)); } - apzc->SetLayerHitTestData(visible, aTransform, aLayer->GetTransform()); + gfx3DMatrix transform; + gfx::To3DMatrix(aLayer->GetTransform(), transform); + + apzc->SetLayerHitTestData(visible, aTransform, transform); APZC_LOG("Setting rect(%f %f %f %f) as visible region for APZC %p\n", visible.x, visible.y, visible.width, visible.height, apzc); @@ -260,7 +263,9 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor, aTransform = gfx3DMatrix(); } else { // Multiply child layer transforms on the left so they get applied first - aTransform = aLayer->GetTransform() * aTransform; + gfx3DMatrix matrix; + gfx::To3DMatrix(aLayer->GetTransform(), matrix); + aTransform = matrix * aTransform; } uint64_t childLayersId = (aLayer->AsRefLayer() ? aLayer->AsRefLayer()->GetReferentId() : aLayersId); diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 573b4107388..57774342f2b 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -123,43 +123,44 @@ AsyncCompositionManager::ComputeRotation() } static bool -GetBaseTransform2D(Layer* aLayer, gfxMatrix* aTransform) +GetBaseTransform2D(Layer* aLayer, Matrix* aTransform) { // Start with the animated transform if there is one - gfx3DMatrix localTransform; - To3DMatrix(aLayer->GetLocalTransform(), localTransform); return (aLayer->AsLayerComposite()->GetShadowTransformSetByAnimation() ? - localTransform : aLayer->GetTransform()).Is2D(aTransform); + aLayer->GetLocalTransform() : aLayer->GetTransform()).Is2D(aTransform); } static void TranslateShadowLayer2D(Layer* aLayer, const gfxPoint& aTranslation) { - gfxMatrix layerTransform; + Matrix layerTransform; if (!GetBaseTransform2D(aLayer, &layerTransform)) { return; } // Apply the 2D translation to the layer transform. - layerTransform.x0 += aTranslation.x; - layerTransform.y0 += aTranslation.y; + layerTransform._31 += aTranslation.x; + layerTransform._32 += aTranslation.y; // The transform already takes the resolution scale into account. Since we // will apply the resolution scale again when computing the effective // transform, we must apply the inverse resolution scale here. - gfx3DMatrix layerTransform3D = gfx3DMatrix::From2D(layerTransform); + Matrix4x4 layerTransform3D = Matrix4x4::From2D(layerTransform); if (ContainerLayer* c = aLayer->AsContainerLayer()) { layerTransform3D.Scale(1.0f/c->GetPreXScale(), 1.0f/c->GetPreYScale(), 1); } - layerTransform3D.ScalePost(1.0f/aLayer->GetPostXScale(), - 1.0f/aLayer->GetPostYScale(), - 1); + layerTransform3D = layerTransform3D * + Matrix4x4().Scale(1.0f/aLayer->GetPostXScale(), + 1.0f/aLayer->GetPostYScale(), + 1); + gfx3DMatrix matrix; + To3DMatrix(layerTransform3D, matrix); LayerComposite* layerComposite = aLayer->AsLayerComposite(); - layerComposite->SetShadowTransform(layerTransform3D); + layerComposite->SetShadowTransform(matrix); layerComposite->SetShadowTransformSetByAnimation(false); const nsIntRect* clipRect = aLayer->GetClipRect(); @@ -177,11 +178,11 @@ AccumulateLayerTransforms2D(Layer* aLayer, { // Accumulate the transforms between this layer and the subtree root layer. for (Layer* l = aLayer; l && l != aAncestor; l = l->GetParent()) { - gfxMatrix l2D; + Matrix l2D; if (!GetBaseTransform2D(l, &l2D)) { return false; } - aMatrix.Multiply(l2D); + aMatrix.Multiply(ThebesMatrix(l2D)); } return true; @@ -272,7 +273,7 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, // Now work out the translation necessary to make sure the layer doesn't // move given the new sub-tree root transform. - gfxMatrix layerTransform; + Matrix layerTransform; if (!GetBaseTransform2D(aLayer, &layerTransform)) { return; } @@ -289,10 +290,10 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, // Add the local layer transform to the two points to make the equation // below this section more convenient. - gfxPoint anchor(anchorInOldSubtreeLayerSpace.x, anchorInOldSubtreeLayerSpace.y); - gfxPoint offsetAnchor(offsetAnchorInOldSubtreeLayerSpace.x, offsetAnchorInOldSubtreeLayerSpace.y); - gfxPoint locallyTransformedAnchor = layerTransform.Transform(anchor); - gfxPoint locallyTransformedOffsetAnchor = layerTransform.Transform(offsetAnchor); + Point anchor(anchorInOldSubtreeLayerSpace.x, anchorInOldSubtreeLayerSpace.y); + Point offsetAnchor(offsetAnchorInOldSubtreeLayerSpace.x, offsetAnchorInOldSubtreeLayerSpace.y); + Point locallyTransformedAnchor = layerTransform * anchor; + Point locallyTransformedOffsetAnchor = layerTransform * offsetAnchor; // Transforming the locallyTransformedAnchor by oldCumulativeTransform // returns the layer's anchor point relative to the parent of @@ -303,8 +304,8 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, // out the offset necessary to make sure the layer stays stationary. gfxPoint oldAnchorPositionInNewSpace = newCumulativeTransformInverse.Transform( - oldCumulativeTransform.Transform(locallyTransformedOffsetAnchor)); - gfxPoint translation = oldAnchorPositionInNewSpace - locallyTransformedAnchor; + oldCumulativeTransform.Transform(ThebesPoint(locallyTransformedOffsetAnchor))); + gfxPoint translation = oldAnchorPositionInNewSpace - ThebesPoint(locallyTransformedAnchor); if (aLayer->GetIsStickyPosition()) { // For sticky positioned layers, the difference between the two rectangles @@ -335,7 +336,9 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, if (aLayer->AsContainerLayer() && aLayer->AsContainerLayer()->GetFrameMetrics().IsScrollable() && aLayer != aTransformedSubtreeRoot) { - AlignFixedAndStickyLayers(aLayer, aLayer, aLayer->GetTransform(), LayerMargin(0, 0, 0, 0)); + gfx3DMatrix matrix; + To3DMatrix(aLayer->GetTransform(), matrix); + AlignFixedAndStickyLayers(aLayer, aLayer, matrix, LayerMargin(0, 0, 0, 0)); return; } @@ -492,7 +495,8 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram if (AsyncPanZoomController* controller = container->GetAsyncPanZoomController()) { LayerComposite* layerComposite = aLayer->AsLayerComposite(); - gfx3DMatrix oldTransform = aLayer->GetTransform(); + gfx3DMatrix oldTransform; + To3DMatrix(aLayer->GetTransform(), oldTransform); ViewTransform treeTransform; ScreenPoint scrollOffset; @@ -517,7 +521,9 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram // Apply the render offset mLayerManager->GetCompositor()->SetScreenRenderOffset(offset); - gfx3DMatrix transform(gfx3DMatrix(treeTransform) * aLayer->GetTransform()); + gfx3DMatrix transform; + To3DMatrix(aLayer->GetTransform(), transform); + transform = gfx3DMatrix(treeTransform) * transform; // GetTransform already takes the pre- and post-scale into account. Since we // will apply the pre- and post-scale again when computing the effective // transform, we must apply the inverses here. @@ -610,7 +616,9 @@ AsyncCompositionManager::ApplyAsyncTransformToScrollbar(ContainerLayer* aLayer) scrollbarTransform.TranslatePost(gfxPoint3D(-transientTransform._41 * scale, 0, 0)); } - gfx3DMatrix transform = scrollbarTransform * aLayer->GetTransform(); + gfx3DMatrix transform; + To3DMatrix(aLayer->GetTransform(), transform); + transform = scrollbarTransform * transform; // GetTransform already takes the pre- and post-scale into account. Since we // will apply the pre- and post-scale again when computing the effective // transform, we must apply the inverses here. @@ -635,7 +643,8 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer) const FrameMetrics& metrics = container->GetFrameMetrics(); // We must apply the resolution scale before a pan/zoom transform, so we call // GetTransform here. - const gfx3DMatrix& currentTransform = aLayer->GetTransform(); + gfx3DMatrix currentTransform; + To3DMatrix(aLayer->GetTransform(), currentTransform); gfx3DMatrix oldTransform = currentTransform; gfx3DMatrix treeTransform; diff --git a/gfx/tests/gtest/TestLayers.cpp b/gfx/tests/gtest/TestLayers.cpp index 81851624ec1..8589ab55d47 100644 --- a/gfx/tests/gtest/TestLayers.cpp +++ b/gfx/tests/gtest/TestLayers.cpp @@ -125,7 +125,7 @@ TEST(Layers, Defaults) { TEST(Layers, Transform) { TestContainerLayer layer(nullptr); - gfx3DMatrix identity; + Matrix4x4 identity; ASSERT_EQ(true, identity.IsIdentity()); ASSERT_EQ(identity, layer.GetTransform()); diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index e300782b1c2..87d3ea6af8f 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -1552,7 +1552,8 @@ static void SetVisibleRegionForLayer(Layer* aLayer, const nsIntRegion& aLayerVisibleRegion, const nsIntRect& aRestrictToRect) { - gfx3DMatrix transform = aLayer->GetTransform(); + gfx3DMatrix transform; + To3DMatrix(aLayer->GetTransform(), transform); // if 'transform' is not invertible, then nothing will be displayed // for the layer, so it doesn't really matter what we do here @@ -1714,11 +1715,13 @@ ContainerState::SetFixedPositionLayerData(Layer* aLayer, static gfx3DMatrix GetTransformToRoot(Layer* aLayer) { - gfx3DMatrix transform = aLayer->GetTransform(); + Matrix4x4 transform = aLayer->GetTransform(); for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) { transform = transform * l->GetTransform(); } - return transform; + gfx3DMatrix result; + To3DMatrix(transform, result); + return result; } static void @@ -1809,7 +1812,7 @@ ContainerState::PopThebesLayerData() layer->SetClipRect(nullptr); } - gfxMatrix transform; + Matrix transform; if (!layer->GetTransform().Is2D(&transform)) { NS_ERROR("Only 2D transformations currently supported"); } diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index d88c3a4cf41..a0ecc4cfef1 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -227,7 +227,9 @@ BuildListForLayer(Layer* aLayer, gfx3DMatrix applyTransform = ComputeShadowTreeTransform( aSubdocFrame, aRootFrameLoader, metrics, view->GetViewConfig(), 1 / GetXScale(aTransform), 1 / GetYScale(aTransform)); - transform = applyTransform * aLayer->GetTransform() * aTransform; + gfx3DMatrix layerTransform; + To3DMatrix(aLayer->GetTransform(), layerTransform); + transform = applyTransform * layerTransform * aTransform; // As mentioned above, bounds calculation also depends on the scale // of this layer. @@ -246,7 +248,9 @@ BuildListForLayer(Layer* aLayer, new (aBuilder) nsDisplayRemoteShadow(aBuilder, aSubdocFrame, bounds, scrollId)); } else { - transform = aLayer->GetTransform() * aTransform; + gfx3DMatrix layerTransform; + To3DMatrix(aLayer->GetTransform(), layerTransform); + transform = layerTransform * aTransform; } for (Layer* child = aLayer->GetFirstChild(); child; @@ -271,7 +275,8 @@ TransformShadowTree(nsDisplayListBuilder* aBuilder, nsFrameLoader* aFrameLoader, const FrameMetrics* metrics = GetFrameMetrics(aLayer); - gfx3DMatrix shadowTransform = aLayer->GetTransform(); + gfx3DMatrix shadowTransform; + To3DMatrix(aLayer->GetTransform(), shadowTransform); ViewTransform layerTransform = aTransform; if (metrics && metrics->IsScrollable()) { @@ -279,7 +284,8 @@ TransformShadowTree(nsDisplayListBuilder* aBuilder, nsFrameLoader* aFrameLoader, const nsContentView* view = aFrameLoader->GetCurrentRemoteFrame()->GetContentView(scrollId); NS_ABORT_IF_FALSE(view, "Array of views should be consistent with layer tree"); - const gfx3DMatrix& currentTransform = aLayer->GetTransform(); + gfx3DMatrix currentTransform; + To3DMatrix(aLayer->GetTransform(), currentTransform); const ViewConfig& config = view->GetViewConfig(); // With temporary scale we should compensate translation @@ -375,7 +381,8 @@ BuildViewMap(ViewMap& oldContentViews, ViewMap& newContentViews, return; const FrameMetrics metrics = container->GetFrameMetrics(); const ViewID scrollId = metrics.mScrollId; - const gfx3DMatrix transform = aLayer->GetTransform(); + gfx3DMatrix transform; + To3DMatrix(aLayer->GetTransform(), transform); aXScale *= GetXScale(transform); aYScale *= GetYScale(transform); From bed5a418dbe5237eb53b6133fa3bc6e7506a1a5f Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 27 Jan 2014 10:29:06 -0500 Subject: [PATCH 58/76] Bug 952977: Convert Layer's mTransform to gfx::Matrix4x4 r=nical --- gfx/layers/Layers.cpp | 13 +++++-------- gfx/layers/Layers.h | 17 ++++++----------- gfx/layers/ipc/CompositorParent.cpp | 4 +++- gfx/layers/ipc/ShadowLayers.cpp | 4 +--- layout/base/FrameLayerBuilder.cpp | 8 +++----- layout/generic/nsFrame.cpp | 11 ++++++----- 6 files changed, 24 insertions(+), 33 deletions(-) diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 85657115e84..6f2a68810b2 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -550,11 +550,9 @@ AncestorLayerMayChangeTransform(Layer* aLayer) bool Layer::MayResample() { - gfxMatrix transform2d; - gfx3DMatrix effectiveTransform; - To3DMatrix(GetEffectiveTransform(), effectiveTransform); - return !effectiveTransform.Is2D(&transform2d) || - transform2d.HasNonIntegerTranslation() || + Matrix transform2d; + return !GetEffectiveTransform().Is2D(&transform2d) || + ThebesMatrix(transform2d).HasNonIntegerTranslation() || AncestorLayerMayChangeTransform(this); } @@ -620,8 +618,7 @@ Layer::CalculateScissorRect(const nsIntRect& aCurrentScissorRect, const Matrix4x4 Layer::GetTransform() const { - Matrix4x4 transform; - ToMatrix4x4(mTransform, transform); + Matrix4x4 transform = mTransform; if (const ContainerLayer* c = AsContainerLayer()) { transform.Scale(c->GetPreXScale(), c->GetPreYScale(), 1.0f); } @@ -636,7 +633,7 @@ Layer::GetLocalTransform() if (LayerComposite* shadow = AsLayerComposite()) transform = shadow->GetShadowTransform(); else - transform = mTransform; + To3DMatrix(mTransform, transform); if (ContainerLayer* c = AsContainerLayer()) { transform.Scale(c->GetPreXScale(), c->GetPreYScale(), 1.0f); } diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 709dfbb226e..f24c0f6e45d 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -11,7 +11,6 @@ #include // for int32_t, int64_t #include "FrameMetrics.h" // for FrameMetrics #include "Units.h" // for LayerMargin, LayerPoint -#include "gfx3DMatrix.h" // for gfx3DMatrix #include "gfxContext.h" // for GraphicsOperator #include "gfxTypes.h" #include "gfxColor.h" // for gfxRGBA @@ -889,13 +888,11 @@ public: NS_ASSERTION(!aMatrix.IsSingular(), "Shouldn't be trying to draw with a singular matrix!"); mPendingTransform = nullptr; - gfx3DMatrix transform; - gfx::To3DMatrix(aMatrix, transform); - if (mTransform == transform) { + if (mTransform == aMatrix) { return; } MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) BaseTransform", this)); - mTransform = transform; + mTransform = aMatrix; Mutated(); } @@ -909,9 +906,7 @@ public: */ void SetBaseTransformForNextTransaction(const gfx::Matrix4x4& aMatrix) { - gfx3DMatrix matrix; - gfx::To3DMatrix(aMatrix, matrix); - mPendingTransform = new gfx3DMatrix(matrix); + mPendingTransform = new gfx::Matrix4x4(aMatrix); } void SetPostScale(float aXScale, float aYScale) @@ -1051,7 +1046,7 @@ public: virtual Layer* GetFirstChild() const { return nullptr; } virtual Layer* GetLastChild() const { return nullptr; } const gfx::Matrix4x4 GetTransform() const; - const gfx3DMatrix& GetBaseTransform() const { return mTransform; } + const gfx::Matrix4x4& GetBaseTransform() const { return mTransform; } float GetPostXScale() const { return mPostXScale; } float GetPostYScale() const { return mPostYScale; } bool GetIsFixedPosition() { return mIsFixedPosition; } @@ -1402,11 +1397,11 @@ protected: gfx::UserData mUserData; nsIntRegion mVisibleRegion; EventRegions mEventRegions; - gfx3DMatrix mTransform; + gfx::Matrix4x4 mTransform; // A mutation of |mTransform| that we've queued to be applied at the // end of the next transaction (if nothing else overrides it in the // meantime). - nsAutoPtr mPendingTransform; + nsAutoPtr mPendingTransform; float mPostXScale; float mPostYScale; gfx::Matrix4x4 mEffectiveTransform; diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index a9a438f8fa4..af22ee42ec8 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -663,7 +663,9 @@ SetShadowProperties(Layer* aLayer) // FIXME: Bug 717688 -- Do these updates in LayerTransactionParent::RecvUpdate. LayerComposite* layerComposite = aLayer->AsLayerComposite(); // Set the layerComposite's base transform to the layer's base transform. - layerComposite->SetShadowTransform(aLayer->GetBaseTransform()); + gfx3DMatrix matrix; + To3DMatrix(aLayer->GetBaseTransform(), matrix); + layerComposite->SetShadowTransform(matrix); layerComposite->SetShadowTransformSetByAnimation(false); layerComposite->SetShadowVisibleRegion(aLayer->GetVisibleRegion()); layerComposite->SetShadowClipRect(aLayer->GetClipRect()); diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 8570929c6ad..22bb5a5cd7f 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -489,9 +489,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies, bool common.eventRegions() = mutant->GetEventRegions(); common.postXScale() = mutant->GetPostXScale(); common.postYScale() = mutant->GetPostYScale(); - gfx::Matrix4x4 transform; - gfx::ToMatrix4x4(mutant->GetBaseTransform(), transform); - common.transform() = transform; + common.transform() = mutant->GetBaseTransform(); common.contentFlags() = mutant->GetContentFlags(); common.opacity() = mutant->GetOpacity(); common.useClipRect() = !!mutant->GetClipRect(); diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 87d3ea6af8f..46dc9050cba 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -1783,9 +1783,7 @@ ContainerState::PopThebesLayerData() colorLayer->SetColor(data->mSolidColor); // Copy transform - Matrix4x4 base; - ToMatrix4x4(data->mLayer->GetBaseTransform(), base); - colorLayer->SetBaseTransform(base); + colorLayer->SetBaseTransform(data->mLayer->GetBaseTransform()); colorLayer->SetPostScale(data->mLayer->GetPostXScale(), data->mLayer->GetPostYScale()); nsIntRect visibleRect = data->mVisibleRegion.GetBounds(); @@ -2965,9 +2963,9 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder, // Don't clamp the scale factor when the new desired scale factor matches the old one // or it was previously unscaled. bool clamp = true; - gfxMatrix oldFrameTransform2d; + Matrix oldFrameTransform2d; if (aLayer->GetBaseTransform().Is2D(&oldFrameTransform2d)) { - gfxSize oldScale = RoundToFloatPrecision(oldFrameTransform2d.ScaleFactors(true)); + gfxSize oldScale = RoundToFloatPrecision(ThebesMatrix(oldFrameTransform2d).ScaleFactors(true)); if (oldScale == scale || oldScale == gfxSize(1.0, 1.0)) { clamp = false; } diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index eeda421b010..d92a7c7f2ba 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4834,7 +4834,8 @@ nsIFrame::TryUpdateTransformOnly() // the transform and will need to schedule an invalidating paint. return false; } - gfxMatrix transform, previousTransform; + gfxMatrix transform; + gfx::Matrix previousTransform; // FIXME/bug 796690 and 796705: in general, changes to 3D // transforms, or transform changes to properties other than // translation, may lead us to choose a different rendering @@ -4845,10 +4846,10 @@ nsIFrame::TryUpdateTransformOnly() static const gfx::Float kError = 0.0001f; if (!transform3d.Is2D(&transform) || !layer->GetBaseTransform().Is2D(&previousTransform) || - !gfx::FuzzyEqual(transform.xx, previousTransform.xx, kError) || - !gfx::FuzzyEqual(transform.yy, previousTransform.yy, kError) || - !gfx::FuzzyEqual(transform.xy, previousTransform.xy, kError) || - !gfx::FuzzyEqual(transform.yx, previousTransform.yx, kError)) { + !gfx::FuzzyEqual(transform.xx, previousTransform._11, kError) || + !gfx::FuzzyEqual(transform.yy, previousTransform._22, kError) || + !gfx::FuzzyEqual(transform.xy, previousTransform._21, kError) || + !gfx::FuzzyEqual(transform.yx, previousTransform._12, kError)) { return false; } gfx::Matrix4x4 matrix; From 287bef702094e7a18b4c1ce601b121f26defe70b Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 27 Jan 2014 10:29:27 -0500 Subject: [PATCH 59/76] Bug 952977: Convert shadow transforms to gfx::Matrix4x4 r=nical --- gfx/layers/Layers.cpp | 10 ++-- .../composite/AsyncCompositionManager.cpp | 50 +++++++++---------- gfx/layers/composite/LayerManagerComposite.h | 7 ++- gfx/layers/ipc/CompositorParent.cpp | 4 +- gfx/layers/ipc/LayerTransactionParent.cpp | 2 +- layout/ipc/RenderFrameParent.cpp | 8 +-- 6 files changed, 38 insertions(+), 43 deletions(-) diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 6f2a68810b2..6c4575f2aa8 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -629,19 +629,17 @@ Layer::GetTransform() const const Matrix4x4 Layer::GetLocalTransform() { - gfx3DMatrix transform; + Matrix4x4 transform; if (LayerComposite* shadow = AsLayerComposite()) transform = shadow->GetShadowTransform(); else - To3DMatrix(mTransform, transform); + transform = mTransform; if (ContainerLayer* c = AsContainerLayer()) { transform.Scale(c->GetPreXScale(), c->GetPreYScale(), 1.0f); } - transform.ScalePost(mPostXScale, mPostYScale, 1.0f); + transform = transform * Matrix4x4().Scale(mPostXScale, mPostYScale, 1.0f); - Matrix4x4 result; - ToMatrix4x4(transform, result); - return result; + return transform; } void diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 57774342f2b..074be17c39d 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -157,10 +157,8 @@ TranslateShadowLayer2D(Layer* aLayer, 1.0f/aLayer->GetPostYScale(), 1); - gfx3DMatrix matrix; - To3DMatrix(layerTransform3D, matrix); LayerComposite* layerComposite = aLayer->AsLayerComposite(); - layerComposite->SetShadowTransform(matrix); + layerComposite->SetShadowTransform(layerTransform3D); layerComposite->SetShadowTransformSetByAnimation(false); const nsIntRect* clipRect = aLayer->GetClipRect(); @@ -452,12 +450,11 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint) } case eCSSProperty_transform: { - gfx3DMatrix matrix; - gfx::To3DMatrix(interpolatedValue.get_ArrayOfTransformFunction()[0].get_TransformMatrix().value(), matrix); + Matrix4x4 matrix = interpolatedValue.get_ArrayOfTransformFunction()[0].get_TransformMatrix().value(); if (ContainerLayer* c = aLayer->AsContainerLayer()) { - matrix.ScalePost(c->GetInheritedXScale(), - c->GetInheritedYScale(), - 1); + matrix = matrix * Matrix4x4().Scale(c->GetInheritedXScale(), + c->GetInheritedYScale(), + 1); } layerComposite->SetShadowTransform(matrix); layerComposite->SetShadowTransformSetByAnimation(true); @@ -521,18 +518,19 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram // Apply the render offset mLayerManager->GetCompositor()->SetScreenRenderOffset(offset); - gfx3DMatrix transform; - To3DMatrix(aLayer->GetTransform(), transform); - transform = gfx3DMatrix(treeTransform) * transform; + Matrix4x4 transform; + ToMatrix4x4(gfx3DMatrix(treeTransform), transform); + transform = transform * aLayer->GetTransform(); + // GetTransform already takes the pre- and post-scale into account. Since we // will apply the pre- and post-scale again when computing the effective // transform, we must apply the inverses here. transform.Scale(1.0f/container->GetPreXScale(), 1.0f/container->GetPreYScale(), 1); - transform.ScalePost(1.0f/aLayer->GetPostXScale(), - 1.0f/aLayer->GetPostYScale(), - 1); + transform = transform * Matrix4x4().Scale(1.0f/aLayer->GetPostXScale(), + 1.0f/aLayer->GetPostYScale(), + 1); layerComposite->SetShadowTransform(transform); NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(), "overwriting animated transform!"); @@ -604,30 +602,28 @@ AsyncCompositionManager::ApplyAsyncTransformToScrollbar(ContainerLayer* aLayer) gfx3DMatrix nontransientTransform = apzc->GetNontransientAsyncTransform(); gfx3DMatrix transientTransform = asyncTransform * nontransientTransform.Inverse(); - gfx3DMatrix scrollbarTransform; + Matrix4x4 scrollbarTransform; if (aLayer->GetScrollbarDirection() == Layer::VERTICAL) { float scale = metrics.CalculateCompositedRectInCssPixels().height / metrics.mScrollableRect.height; - scrollbarTransform.ScalePost(1.f, 1.f / transientTransform.GetYScale(), 1.f); - scrollbarTransform.TranslatePost(gfxPoint3D(0, -transientTransform._42 * scale, 0)); + scrollbarTransform = scrollbarTransform * Matrix4x4().Scale(1.f, 1.f / transientTransform.GetYScale(), 1.f); + scrollbarTransform = scrollbarTransform * Matrix4x4().Translate(0, -transientTransform._42 * scale, 0); } if (aLayer->GetScrollbarDirection() == Layer::HORIZONTAL) { float scale = metrics.CalculateCompositedRectInCssPixels().width / metrics.mScrollableRect.width; - scrollbarTransform.ScalePost(1.f / transientTransform.GetXScale(), 1.f, 1.f); - scrollbarTransform.TranslatePost(gfxPoint3D(-transientTransform._41 * scale, 0, 0)); + scrollbarTransform = scrollbarTransform * Matrix4x4().Scale(1.f / transientTransform.GetXScale(), 1.f, 1.f); + scrollbarTransform = scrollbarTransform * Matrix4x4().Translate(-transientTransform._41 * scale, 0, 0); } - gfx3DMatrix transform; - To3DMatrix(aLayer->GetTransform(), transform); - transform = scrollbarTransform * transform; + Matrix4x4 transform = scrollbarTransform * aLayer->GetTransform(); // GetTransform already takes the pre- and post-scale into account. Since we // will apply the pre- and post-scale again when computing the effective // transform, we must apply the inverses here. transform.Scale(1.0f/aLayer->GetPreXScale(), 1.0f/aLayer->GetPreYScale(), 1); - transform.ScalePost(1.0f/aLayer->GetPostXScale(), - 1.0f/aLayer->GetPostYScale(), - 1); + transform = transform * Matrix4x4().Scale(1.0f/aLayer->GetPostXScale(), + 1.0f/aLayer->GetPostYScale(), + 1); aLayer->AsLayerComposite()->SetShadowTransform(transform); return; @@ -721,7 +717,9 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer) computedTransform.ScalePost(1.0f/container->GetPostXScale(), 1.0f/container->GetPostYScale(), 1); - layerComposite->SetShadowTransform(computedTransform); + Matrix4x4 matrix; + ToMatrix4x4(computedTransform, matrix); + layerComposite->SetShadowTransform(matrix); NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(), "overwriting animated transform!"); diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index 3871b8d1eea..2670866fedd 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -9,7 +9,6 @@ #include // for int32_t, uint32_t #include "GLDefs.h" // for GLenum #include "Layers.h" -#include "gfx3DMatrix.h" // for gfx3DMatrix #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for MOZ_OVERRIDE #include "mozilla/RefPtr.h" // for RefPtr, TemporaryRef @@ -344,7 +343,7 @@ public: } } - void SetShadowTransform(const gfx3DMatrix& aMatrix) + void SetShadowTransform(const gfx::Matrix4x4& aMatrix) { mShadowTransform = aMatrix; } @@ -367,13 +366,13 @@ public: float GetShadowOpacity() { return mShadowOpacity; } const nsIntRect* GetShadowClipRect() { return mUseShadowClipRect ? &mShadowClipRect : nullptr; } const nsIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; } - const gfx3DMatrix& GetShadowTransform() { return mShadowTransform; } + const gfx::Matrix4x4& GetShadowTransform() { return mShadowTransform; } bool GetShadowTransformSetByAnimation() { return mShadowTransformSetByAnimation; } bool HasLayerBeenComposited() { return mLayerComposited; } bool GetClearFB() { return mClearFB; } protected: - gfx3DMatrix mShadowTransform; + gfx::Matrix4x4 mShadowTransform; nsIntRegion mShadowVisibleRegion; nsIntRect mShadowClipRect; LayerManagerComposite* mCompositeManager; diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index af22ee42ec8..a9a438f8fa4 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -663,9 +663,7 @@ SetShadowProperties(Layer* aLayer) // FIXME: Bug 717688 -- Do these updates in LayerTransactionParent::RecvUpdate. LayerComposite* layerComposite = aLayer->AsLayerComposite(); // Set the layerComposite's base transform to the layer's base transform. - gfx3DMatrix matrix; - To3DMatrix(aLayer->GetBaseTransform(), matrix); - layerComposite->SetShadowTransform(matrix); + layerComposite->SetShadowTransform(aLayer->GetBaseTransform()); layerComposite->SetShadowTransformSetByAnimation(false); layerComposite->SetShadowVisibleRegion(aLayer->GetVisibleRegion()); layerComposite->SetShadowClipRect(aLayer->GetClipRect()); diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index 603754bc9c9..b29c4304e2f 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -489,7 +489,7 @@ LayerTransactionParent::RecvGetTransform(PLayerParent* aParent, // from the shadow transform by undoing the translations in // AsyncCompositionManager::SampleValue. Layer* layer = cast(aParent)->AsLayer(); - *aTransform = layer->AsLayerComposite()->GetShadowTransform(); + gfx::To3DMatrix(layer->AsLayerComposite()->GetShadowTransform(), *aTransform); if (ContainerLayer* c = layer->AsContainerLayer()) { aTransform->ScalePost(1.0f/c->GetInheritedXScale(), 1.0f/c->GetInheritedYScale(), diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index a0ecc4cfef1..953c34e25c5 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -337,7 +337,9 @@ TransformShadowTree(nsDisplayListBuilder* aBuilder, nsFrameLoader* aFrameLoader, 1.0f/aLayer->GetPostYScale(), 1); - shadow->SetShadowTransform(shadowTransform); + gfx::Matrix4x4 realShadowTransform; + ToMatrix4x4(shadowTransform, realShadowTransform); + shadow->SetShadowTransform(realShadowTransform); for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) { TransformShadowTree(aBuilder, aFrameLoader, aFrame, child, layerTransform, @@ -456,7 +458,7 @@ BuildBackgroundPatternFor(ContainerLayer* aContainer, nsIFrame* aFrame) { LayerComposite* shadowRoot = aShadowRoot->AsLayerComposite(); - gfxMatrix t; + gfx::Matrix t; if (!shadowRoot->GetShadowTransform().Is2D(&t)) { return; } @@ -466,7 +468,7 @@ BuildBackgroundPatternFor(ContainerLayer* aContainer, nsIntRect contentBounds = shadowRoot->GetShadowVisibleRegion().GetBounds(); gfxRect contentVis(contentBounds.x, contentBounds.y, contentBounds.width, contentBounds.height); - gfxRect localContentVis(t.Transform(contentVis)); + gfxRect localContentVis(gfx::ThebesMatrix(t).Transform(contentVis)); // Round *in* here because this area is punched out of the background localContentVis.RoundIn(); nsIntRect localIntContentVis(localContentVis.X(), localContentVis.Y(), From cbd28985b45fbd132d3afe1b54fc472ff521a6bc Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 23 Jan 2014 15:06:20 -0500 Subject: [PATCH 60/76] Bug 938786 - notify the secure browser UI, if any, first in NotifySubmitObservers; r=bz --- content/html/content/src/HTMLFormElement.cpp | 31 ++++++++++++++++--- .../boot/src/nsSecureBrowserUIImpl.cpp | 18 +---------- .../manager/boot/src/nsSecureBrowserUIImpl.h | 4 --- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/content/html/content/src/HTMLFormElement.cpp b/content/html/content/src/HTMLFormElement.cpp index a6e85e75c70..dbdb6766412 100644 --- a/content/html/content/src/HTMLFormElement.cpp +++ b/content/html/content/src/HTMLFormElement.cpp @@ -17,6 +17,7 @@ #include "nsPresContext.h" #include "nsIDocument.h" #include "nsIFormControlFrame.h" +#include "nsISecureBrowserUI.h" #include "nsError.h" #include "nsContentUtils.h" #include "nsInterfaceHashtable.h" @@ -863,6 +864,31 @@ HTMLFormElement::NotifySubmitObservers(nsIURI* aActionURL, NS_FIRST_FORMSUBMIT_CATEGORY); } + // XXXbz what do the submit observers actually want? The window + // of the document this is shown in? Or something else? + // sXBL/XBL2 issue + nsCOMPtr window = OwnerDoc()->GetWindow(); + + // Notify the secure browser UI, if any, that the form is being submitted. + nsCOMPtr docshell = OwnerDoc()->GetDocShell(); + if (docshell && !aEarlyNotify) { + nsCOMPtr secureUI; + docshell->GetSecurityUI(getter_AddRefs(secureUI)); + nsCOMPtr formSubmitObserver = + do_QueryInterface(secureUI); + if (formSubmitObserver) { + nsresult rv = formSubmitObserver->Notify(this, + window, + aActionURL, + aCancelSubmit); + NS_ENSURE_SUCCESS(rv, rv); + + if (*aCancelSubmit) { + return NS_OK; + } + } + } + // Notify observers that the form is being submitted. nsCOMPtr service = mozilla::services::GetObserverService(); @@ -880,11 +906,6 @@ HTMLFormElement::NotifySubmitObservers(nsIURI* aActionURL, nsCOMPtr inst; *aCancelSubmit = false; - // XXXbz what do the submit observers actually want? The window - // of the document this is shown in? Or something else? - // sXBL/XBL2 issue - nsCOMPtr window = OwnerDoc()->GetWindow(); - bool loop = true; while (NS_SUCCEEDED(theEnum->HasMoreElements(&loop)) && loop) { theEnum->GetNext(getter_AddRefs(inst)); diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index e5f34a7d6e6..bd669a8f28b 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -16,7 +16,6 @@ #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIServiceManager.h" -#include "nsIObserverService.h" #include "nsCURILoader.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" @@ -150,11 +149,10 @@ nsSecureBrowserUIImpl::~nsSecureBrowserUIImpl() } } -NS_IMPL_ISUPPORTS6(nsSecureBrowserUIImpl, +NS_IMPL_ISUPPORTS5(nsSecureBrowserUIImpl, nsISecureBrowserUI, nsIWebProgressListener, nsIFormSubmitObserver, - nsIObserver, nsISupportsWeakReference, nsISSLStatusProvider) @@ -189,12 +187,6 @@ nsSecureBrowserUIImpl::Init(nsIDOMWindow *aWindow) mWindow = do_GetWeakReference(pwin, &rv); NS_ENSURE_SUCCESS(rv, rv); - // hook up to the form post notifications: - nsCOMPtr svc(do_GetService("@mozilla.org/observer-service;1", &rv)); - if (NS_SUCCEEDED(rv)) { - rv = svc->AddObserver(this, NS_FORMSUBMIT_SUBJECT, true); - } - nsCOMPtr piwindow(do_QueryInterface(aWindow)); if (!piwindow) return NS_ERROR_FAILURE; @@ -323,14 +315,6 @@ nsSecureBrowserUIImpl::SetDocShell(nsIDocShell *aDocShell) return rv; } -NS_IMETHODIMP -nsSecureBrowserUIImpl::Observe(nsISupports*, const char*, - const char16_t*) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - static nsresult IsChildOfDomWindow(nsIDOMWindow *parent, nsIDOMWindow *child, bool* value) { diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.h b/security/manager/boot/src/nsSecureBrowserUIImpl.h index 4d62498e1a4..99257ffb926 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.h +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.h @@ -12,7 +12,6 @@ #include "mozilla/ReentrantMonitor.h" #include "nsCOMPtr.h" #include "nsString.h" -#include "nsIObserver.h" #include "nsIDOMElement.h" #include "nsIDOMWindow.h" #include "nsIDOMHTMLFormElement.h" @@ -42,7 +41,6 @@ class nsIInterfaceRequestor; class nsSecureBrowserUIImpl : public nsISecureBrowserUI, public nsIWebProgressListener, public nsIFormSubmitObserver, - public nsIObserver, public nsSupportsWeakReference, public nsISSLStatusProvider { @@ -55,8 +53,6 @@ public: NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSISECUREBROWSERUI - // nsIObserver - NS_DECL_NSIOBSERVER NS_DECL_NSISSLSTATUSPROVIDER NS_IMETHOD Notify(nsIDOMHTMLFormElement* formNode, nsIDOMWindow* window, From cd7a42e4a608c3d65830b20395f0c4b7e0eedd9b Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Fri, 24 Jan 2014 11:34:30 -0800 Subject: [PATCH 61/76] Bug 963327 - Improve profile-dependent handling of OS.Constants.Path; r=Yoric Many properties in OS.Constants.Path are dependent on the profile being available. This patch improves their handling. Previously, we had some repeated and boilerplate code for making OS.Constants.Paths. a lazy getter. This patch eliminates the boilerplate by iterating over the properties that need to be lazy getters. AppData and UAppData are now lazy getters. test_profiledir.js has been rolled into test_path_constants.js. test_path_constants.js now emits a warning when a comparison doesn't test anything. This should help identify ineffective tests going forward. --HG-- extra : rebase_source : 971e2bd5f313de2b25090a67d20e101c859f4f4c --- .../osfile/modules/osfile_async_front.jsm | 61 ++++++++++--------- .../tests/xpcshell/test_path_constants.js | 35 ++++++++++- .../osfile/tests/xpcshell/test_profiledir.js | 43 ------------- .../osfile/tests/xpcshell/xpcshell.ini | 1 - 4 files changed, 64 insertions(+), 76 deletions(-) delete mode 100644 toolkit/components/osfile/tests/xpcshell/test_profiledir.js diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm index e6dddb21d07..53407193748 100644 --- a/toolkit/components/osfile/modules/osfile_async_front.jsm +++ b/toolkit/components/osfile/modules/osfile_async_front.jsm @@ -58,39 +58,42 @@ Cu.import("resource://gre/modules/Services.jsm", this); Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this); Cu.import("resource://gre/modules/AsyncShutdown.jsm", this); -// If profileDir is not available, osfile.jsm has been imported before the -// profile is setup. In this case, make this a lazy getter. -if (!("profileDir" in SharedAll.Constants.Path)) { - Object.defineProperty(SharedAll.Constants.Path, "profileDir", { - get: function() { - let path = undefined; - try { - path = Services.dirsvc.get("ProfD", Ci.nsIFile).path; - delete SharedAll.Constants.Path.profileDir; - SharedAll.Constants.Path.profileDir = path; - } catch (ex) { - // Ignore errors: profileDir is still not available - } - return path; +// It's possible for osfile.jsm to get imported before the profile is +// set up. In this case, some path constants aren't yet available. +// Here, we make them lazy loaders. + +function lazyPathGetter(constProp, dirKey) { + return function () { + let path; + try { + path = Services.dirsvc.get(dirKey, Ci.nsIFile).path; + delete SharedAll.Constants.Path[constProp]; + SharedAll.Constants.Path[constProp] = path; + } catch (ex) { + // Ignore errors if the value still isn't available. Hopefully + // the next access will return it. } - }); + + return path; + } } -LOG("Checking localProfileDir"); +for (let [constProp, dirKey] of [ + ["localProfileDir", "ProfLD"], + ["profileDir", "ProfD"], + ["userApplicationDataDir", "UAppData"], + ["winAppDataDir", "AppData"], + ["winStartMenuProgsDir", "Progs"], + ]) { -if (!("localProfileDir" in SharedAll.Constants.Path)) { - Object.defineProperty(SharedAll.Constants.Path, "localProfileDir", { - get: function() { - let path = undefined; - try { - path = Services.dirsvc.get("ProfLD", Ci.nsIFile).path; - delete SharedAll.Constants.Path.localProfileDir; - SharedAll.Constants.Path.localProfileDir = path; - } catch (ex) { - // Ignore errors: localProfileDir is still not available - } - return path; - } + if (constProp in SharedAll.Constants.Path) { + continue; + } + + LOG("Installing lazy getter for OS.Constants.Path." + constProp + + " because it isn't defined and profile may not be loaded."); + Object.defineProperty(SharedAll.Constants.Path, constProp, { + get: lazyPathGetter(constProp, dirKey), }); } diff --git a/toolkit/components/osfile/tests/xpcshell/test_path_constants.js b/toolkit/components/osfile/tests/xpcshell/test_path_constants.js index 02a84b9085c..dc0aec2d936 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_path_constants.js +++ b/toolkit/components/osfile/tests/xpcshell/test_path_constants.js @@ -4,9 +4,13 @@ "use strict"; -Components.utils.import("resource://gre/modules/osfile.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); -Components.utils.import("resource://gre/modules/ctypes.jsm"); +const Cu = Components.utils; + +Cu.import("resource://gre/modules/osfile.jsm", this); +Cu.import("resource://gre/modules/Services.jsm", this); +Cu.import("resource://gre/modules/ctypes.jsm", this); +Cu.import("resource://testing-common/AppData.jsm", this); + function run_test() { run_next_test(); @@ -22,10 +26,35 @@ function compare_paths(ospath, key) { do_check_true(!!ospath); do_check_eq(ospath, file.path); } else { + do_print("WARNING: " + key + " is not defined. Test may not be testing anything!"); do_check_false(!!ospath); } } +// Some path constants aren't set up until the profile is available. This +// test verifies that behavior. +add_task(function* test_before_after_profile() { + do_check_null(OS.Constants.Path.profileDir); + do_check_null(OS.Constants.Path.localProfileDir); + do_check_null(OS.Constants.Path.userApplicationDataDir); + do_check_null(OS.Constants.Path.winAppDataDir); + do_check_null(OS.Constants.Path.winStartMenuProgsDir); + + do_get_profile(); + do_check_true(!!OS.Constants.Path.profileDir); + do_check_true(!!OS.Constants.Path.localProfileDir); + + // UAppData is still null because the xpcshell profile doesn't set it up. + // This test is mostly here to fail in case behavior of do_get_profile() ever + // changes. We want to know if our assumptions no longer hold! + do_check_null(OS.Constants.Path.userApplicationDataDir); + + yield makeFakeAppDir(); + do_check_true(!!OS.Constants.Path.userApplicationDataDir); + + // FUTURE: verify AppData too (bug 964291). +}); + // Test simple paths add_task(function() { do_check_true(!!OS.Constants.Path.tmpDir); diff --git a/toolkit/components/osfile/tests/xpcshell/test_profiledir.js b/toolkit/components/osfile/tests/xpcshell/test_profiledir.js deleted file mode 100644 index 00c0d4a9329..00000000000 --- a/toolkit/components/osfile/tests/xpcshell/test_profiledir.js +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 strict"; - -Components.utils.import("resource://gre/modules/osfile.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); - -function run_test() { - run_next_test(); -} - -add_test(function test_initialize_profileDir() { - // Profile has not been set up yet, check that "profileDir" isn't either. - do_check_false(!!OS.Constants.Path.profileDir); - do_check_false(!!OS.Constants.Path.localProfileDir); - - // Set up profile. - do_get_profile(); - - // Now that profile has been set up, check that "profileDir" is set. - do_check_true(!!OS.Constants.Path.profileDir); - do_check_eq(OS.Constants.Path.profileDir, - Services.dirsvc.get("ProfD", Components.interfaces.nsIFile).path); - - do_check_true(!!OS.Constants.Path.localProfileDir); - do_check_eq(OS.Constants.Path.localProfileDir, - Services.dirsvc.get("ProfLD", Components.interfaces.nsIFile).path); - - let promise = OS.File.makeDir(OS.Path.join(OS.Constants.Path.profileDir, "foobar")); - promise.then( - function onSuccess() { - do_print("Directory creation succeeded"); - run_next_test(); - }, - - function onFailure(reason) { - do_fail(reason); - run_next_test(); - } - ); -}); diff --git a/toolkit/components/osfile/tests/xpcshell/xpcshell.ini b/toolkit/components/osfile/tests/xpcshell/xpcshell.ini index 4d5bcd286a5..1dcf67789d0 100644 --- a/toolkit/components/osfile/tests/xpcshell/xpcshell.ini +++ b/toolkit/components/osfile/tests/xpcshell/xpcshell.ini @@ -12,7 +12,6 @@ tail = [test_osfile_async_setDates.js] [test_removeEmptyDir.js] [test_makeDir.js] -[test_profiledir.js] [test_file_URL_conversion.js] [test_logging.js] [test_creationDate.js] From 64d30f1fa314276018b4e222dc1d608983ce1171 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 27 Jan 2014 17:19:01 +0000 Subject: [PATCH 62/76] Backed out changeset ad7fc270445d (bug 963327) for xpcshell failures on a CLOSED TREE --- .../osfile/modules/osfile_async_front.jsm | 61 +++++++++---------- .../tests/xpcshell/test_path_constants.js | 35 +---------- .../osfile/tests/xpcshell/test_profiledir.js | 43 +++++++++++++ .../osfile/tests/xpcshell/xpcshell.ini | 1 + 4 files changed, 76 insertions(+), 64 deletions(-) create mode 100644 toolkit/components/osfile/tests/xpcshell/test_profiledir.js diff --git a/toolkit/components/osfile/modules/osfile_async_front.jsm b/toolkit/components/osfile/modules/osfile_async_front.jsm index 53407193748..e6dddb21d07 100644 --- a/toolkit/components/osfile/modules/osfile_async_front.jsm +++ b/toolkit/components/osfile/modules/osfile_async_front.jsm @@ -58,42 +58,39 @@ Cu.import("resource://gre/modules/Services.jsm", this); Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this); Cu.import("resource://gre/modules/AsyncShutdown.jsm", this); -// It's possible for osfile.jsm to get imported before the profile is -// set up. In this case, some path constants aren't yet available. -// Here, we make them lazy loaders. - -function lazyPathGetter(constProp, dirKey) { - return function () { - let path; - try { - path = Services.dirsvc.get(dirKey, Ci.nsIFile).path; - delete SharedAll.Constants.Path[constProp]; - SharedAll.Constants.Path[constProp] = path; - } catch (ex) { - // Ignore errors if the value still isn't available. Hopefully - // the next access will return it. +// If profileDir is not available, osfile.jsm has been imported before the +// profile is setup. In this case, make this a lazy getter. +if (!("profileDir" in SharedAll.Constants.Path)) { + Object.defineProperty(SharedAll.Constants.Path, "profileDir", { + get: function() { + let path = undefined; + try { + path = Services.dirsvc.get("ProfD", Ci.nsIFile).path; + delete SharedAll.Constants.Path.profileDir; + SharedAll.Constants.Path.profileDir = path; + } catch (ex) { + // Ignore errors: profileDir is still not available + } + return path; } - - return path; - } + }); } -for (let [constProp, dirKey] of [ - ["localProfileDir", "ProfLD"], - ["profileDir", "ProfD"], - ["userApplicationDataDir", "UAppData"], - ["winAppDataDir", "AppData"], - ["winStartMenuProgsDir", "Progs"], - ]) { +LOG("Checking localProfileDir"); - if (constProp in SharedAll.Constants.Path) { - continue; - } - - LOG("Installing lazy getter for OS.Constants.Path." + constProp + - " because it isn't defined and profile may not be loaded."); - Object.defineProperty(SharedAll.Constants.Path, constProp, { - get: lazyPathGetter(constProp, dirKey), +if (!("localProfileDir" in SharedAll.Constants.Path)) { + Object.defineProperty(SharedAll.Constants.Path, "localProfileDir", { + get: function() { + let path = undefined; + try { + path = Services.dirsvc.get("ProfLD", Ci.nsIFile).path; + delete SharedAll.Constants.Path.localProfileDir; + SharedAll.Constants.Path.localProfileDir = path; + } catch (ex) { + // Ignore errors: localProfileDir is still not available + } + return path; + } }); } diff --git a/toolkit/components/osfile/tests/xpcshell/test_path_constants.js b/toolkit/components/osfile/tests/xpcshell/test_path_constants.js index dc0aec2d936..02a84b9085c 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_path_constants.js +++ b/toolkit/components/osfile/tests/xpcshell/test_path_constants.js @@ -4,13 +4,9 @@ "use strict"; -const Cu = Components.utils; - -Cu.import("resource://gre/modules/osfile.jsm", this); -Cu.import("resource://gre/modules/Services.jsm", this); -Cu.import("resource://gre/modules/ctypes.jsm", this); -Cu.import("resource://testing-common/AppData.jsm", this); - +Components.utils.import("resource://gre/modules/osfile.jsm"); +Components.utils.import("resource://gre/modules/Services.jsm"); +Components.utils.import("resource://gre/modules/ctypes.jsm"); function run_test() { run_next_test(); @@ -26,35 +22,10 @@ function compare_paths(ospath, key) { do_check_true(!!ospath); do_check_eq(ospath, file.path); } else { - do_print("WARNING: " + key + " is not defined. Test may not be testing anything!"); do_check_false(!!ospath); } } -// Some path constants aren't set up until the profile is available. This -// test verifies that behavior. -add_task(function* test_before_after_profile() { - do_check_null(OS.Constants.Path.profileDir); - do_check_null(OS.Constants.Path.localProfileDir); - do_check_null(OS.Constants.Path.userApplicationDataDir); - do_check_null(OS.Constants.Path.winAppDataDir); - do_check_null(OS.Constants.Path.winStartMenuProgsDir); - - do_get_profile(); - do_check_true(!!OS.Constants.Path.profileDir); - do_check_true(!!OS.Constants.Path.localProfileDir); - - // UAppData is still null because the xpcshell profile doesn't set it up. - // This test is mostly here to fail in case behavior of do_get_profile() ever - // changes. We want to know if our assumptions no longer hold! - do_check_null(OS.Constants.Path.userApplicationDataDir); - - yield makeFakeAppDir(); - do_check_true(!!OS.Constants.Path.userApplicationDataDir); - - // FUTURE: verify AppData too (bug 964291). -}); - // Test simple paths add_task(function() { do_check_true(!!OS.Constants.Path.tmpDir); diff --git a/toolkit/components/osfile/tests/xpcshell/test_profiledir.js b/toolkit/components/osfile/tests/xpcshell/test_profiledir.js new file mode 100644 index 00000000000..00c0d4a9329 --- /dev/null +++ b/toolkit/components/osfile/tests/xpcshell/test_profiledir.js @@ -0,0 +1,43 @@ +/* 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 strict"; + +Components.utils.import("resource://gre/modules/osfile.jsm"); +Components.utils.import("resource://gre/modules/Services.jsm"); + +function run_test() { + run_next_test(); +} + +add_test(function test_initialize_profileDir() { + // Profile has not been set up yet, check that "profileDir" isn't either. + do_check_false(!!OS.Constants.Path.profileDir); + do_check_false(!!OS.Constants.Path.localProfileDir); + + // Set up profile. + do_get_profile(); + + // Now that profile has been set up, check that "profileDir" is set. + do_check_true(!!OS.Constants.Path.profileDir); + do_check_eq(OS.Constants.Path.profileDir, + Services.dirsvc.get("ProfD", Components.interfaces.nsIFile).path); + + do_check_true(!!OS.Constants.Path.localProfileDir); + do_check_eq(OS.Constants.Path.localProfileDir, + Services.dirsvc.get("ProfLD", Components.interfaces.nsIFile).path); + + let promise = OS.File.makeDir(OS.Path.join(OS.Constants.Path.profileDir, "foobar")); + promise.then( + function onSuccess() { + do_print("Directory creation succeeded"); + run_next_test(); + }, + + function onFailure(reason) { + do_fail(reason); + run_next_test(); + } + ); +}); diff --git a/toolkit/components/osfile/tests/xpcshell/xpcshell.ini b/toolkit/components/osfile/tests/xpcshell/xpcshell.ini index 1dcf67789d0..4d5bcd286a5 100644 --- a/toolkit/components/osfile/tests/xpcshell/xpcshell.ini +++ b/toolkit/components/osfile/tests/xpcshell/xpcshell.ini @@ -12,6 +12,7 @@ tail = [test_osfile_async_setDates.js] [test_removeEmptyDir.js] [test_makeDir.js] +[test_profiledir.js] [test_file_URL_conversion.js] [test_logging.js] [test_creationDate.js] From 0d9b0b99b84bacab5e44004e575e3b71aff45336 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 27 Jan 2014 17:26:39 +0000 Subject: [PATCH 63/76] Bug 961021 - Disable dom/datastore/tests/test_changes.html on debug B2G for intermittent failures; CLOSED TREE --- testing/mochitest/b2g-debug.json | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/mochitest/b2g-debug.json b/testing/mochitest/b2g-debug.json index 3c6da74f9d3..a85e8f2c2de 100644 --- a/testing/mochitest/b2g-debug.json +++ b/testing/mochitest/b2g-debug.json @@ -11,6 +11,7 @@ "excludetests": { "content/xul":"tests that use xul", "layout/xul" : "", + "dom/datastore/tests/test_changes.html":"intermittent failures, bug 961021", "dom/tests/mochitest/general/test_focusrings.xul":"", "layout/base/tests/test_bug465448.xul":"", From eb2bddfe37c3d7a4f703d763519e676af319881e Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Fri, 24 Jan 2014 12:57:23 -0500 Subject: [PATCH 64/76] Bug 963651 - Strip C++ unit tests even when STRIP_FLAGS are unset; r=mshal CLOSED TREE --- testing/testsuite-targets.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/testsuite-targets.mk b/testing/testsuite-targets.mk index ebf3a8e34a2..83f3a4a3768 100644 --- a/testing/testsuite-targets.mk +++ b/testing/testsuite-targets.mk @@ -497,7 +497,7 @@ endif stage-cppunittests: $(NSINSTALL) -D $(PKG_STAGE)/cppunittests ifdef STRIP_CPP_TESTS - $(foreach bin,$(CPP_UNIT_TEST_BINS),$(OBJCOPY) $(STRIP_FLAGS) $(bin) $(bin:$(DIST)/%=$(PKG_STAGE)/%);) + $(foreach bin,$(CPP_UNIT_TEST_BINS),$(OBJCOPY) $(or $(STRIP_FLAGS),--strip-unneeded) $(bin) $(bin:$(DIST)/%=$(PKG_STAGE)/%);) else cp -RL $(DIST)/cppunittests $(PKG_STAGE) endif From c773010da1ce3d3a6f3a7d8e7572793a0fc8e573 Mon Sep 17 00:00:00 2001 From: Shelly Lin Date: Mon, 27 Jan 2014 10:33:00 +0800 Subject: [PATCH 65/76] Bug 957439 - Do not assert at Pause or Resume on unsupported input stream. r=roc, r=jsmith --- content/media/MediaRecorder.cpp | 28 +++--- content/media/test/mochitest.ini | 1 + .../test_mediarecorder_unsupported_src.html | 90 +++++++++++++++++++ 3 files changed, 109 insertions(+), 10 deletions(-) create mode 100644 content/media/test/test_mediarecorder_unsupported_src.html diff --git a/content/media/MediaRecorder.cpp b/content/media/MediaRecorder.cpp index bb24f9a83b7..9bfc4ab34f9 100644 --- a/content/media/MediaRecorder.cpp +++ b/content/media/MediaRecorder.cpp @@ -230,18 +230,20 @@ public: nsContentUtils::UnregisterShutdownObserver(this); } - void Pause() + nsresult Pause() { - MOZ_ASSERT(NS_IsMainThread() && mTrackUnionStream); - + NS_ENSURE_TRUE(NS_IsMainThread() && mTrackUnionStream, NS_ERROR_FAILURE); mTrackUnionStream->ChangeExplicitBlockerCount(-1); + + return NS_OK; } - void Resume() + nsresult Resume() { - MOZ_ASSERT(NS_IsMainThread() && mTrackUnionStream); - + NS_ENSURE_TRUE(NS_IsMainThread() && mTrackUnionStream, NS_ERROR_FAILURE); mTrackUnionStream->ChangeExplicitBlockerCount(1); + + return NS_OK; } already_AddRefed GetEncodedData() @@ -499,11 +501,13 @@ MediaRecorder::Pause(ErrorResult& aResult) return; } - mState = RecordingState::Paused; - MOZ_ASSERT(mSession != nullptr); if (mSession) { - mSession->Pause(); + nsresult rv = mSession->Pause(); + if (NS_FAILED(rv)) { + NotifyError(rv); + return; + } mState = RecordingState::Paused; } } @@ -518,7 +522,11 @@ MediaRecorder::Resume(ErrorResult& aResult) MOZ_ASSERT(mSession != nullptr); if (mSession) { - mSession->Resume(); + nsresult rv = mSession->Resume(); + if (NS_FAILED(rv)) { + NotifyError(rv); + return; + } mState = RecordingState::Recording; } } diff --git a/content/media/test/mochitest.ini b/content/media/test/mochitest.ini index 42162a0371c..0da92ad1dbb 100644 --- a/content/media/test/mochitest.ini +++ b/content/media/test/mochitest.ini @@ -256,6 +256,7 @@ support-files = [test_mediarecorder_reload_crash.html] [test_mediarecorder_record_immediate_stop.html] [test_mediarecorder_record_session.html] +[test_mediarecorder_unsupported_src.html] [test_playback.html] [test_seekLies.html] [test_media_sniffer.html] diff --git a/content/media/test/test_mediarecorder_unsupported_src.html b/content/media/test/test_mediarecorder_unsupported_src.html new file mode 100644 index 00000000000..1e4aef30f57 --- /dev/null +++ b/content/media/test/test_mediarecorder_unsupported_src.html @@ -0,0 +1,90 @@ + + + Bug 957439 - Media Recording - Assertion fail at Pause if unsupported input stream. + + + + + +Mozilla Bug 957439 +
+
+
+

From 9dd589383532742e867ab100acb029b7bcd98477 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Mon, 27 Jan 2014 05:20:16 -0800
Subject: [PATCH 66/76] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/f6e33b4f0225
Author: George 
Desc: Merge pull request #15316 from cctuan/955992

Bug 955992 - Running install-gaia.js on node.js

========

https://hg.mozilla.org/integration/gaia-central/rev/65151017b4e5
Author: cctuan 
Desc: Bug 955992 - Running install-gaia.js on node.js

========

https://hg.mozilla.org/integration/gaia-central/rev/1ef8f5fd26cb
Author: Zac 
Desc: Merge pull request #15717 from bebef1987/camera

Bug 958524 - Fix test_camera_flash_mode to use a manifest tag

========

https://hg.mozilla.org/integration/gaia-central/rev/f0e8a8e6fdb8
Author: Bebe 
Desc: Bug 958524 - Fix test_camera_flash_mode to use a manifest tag
---
 b2g/config/gaia.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index f1713ae567e..772b37f606d 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "5102fe0a87af90712543e4b41356739774919d54", 
+    "revision": "f6e33b4f0225457805f4453a924019e9205736f1", 
     "repo_path": "/integration/gaia-central"
 }

From 221d965ed346a113efe5dc30143087d41cb8f491 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Mon, 27 Jan 2014 05:26:22 -0800
Subject: [PATCH 67/76] Bumping manifests a=b2g-bump

---
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/hamachi/sources.xml      | 2 +-
 b2g/config/helix/sources.xml        | 2 +-
 b2g/config/inari/sources.xml        | 2 +-
 b2g/config/leo/sources.xml          | 2 +-
 b2g/config/mako/sources.xml         | 2 +-
 b2g/config/wasabi/sources.xml       | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 70e9d8bac93..c4ac1ea0e79 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 0b72739a080..a988e4d9cb1 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -11,7 +11,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 70e9d8bac93..c4ac1ea0e79 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml
index c55e9a6598d..8972c8e67e5 100644
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml
index 8b035b1a63f..d8ab552cd69 100644
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -10,7 +10,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml
index e1c14f076af..2bb40b9fb21 100644
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml
index c9ccc56ec1c..2628c8abc9a 100644
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml
index f4518014f64..0d4f60344dc 100644
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -11,7 +11,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml
index e7b1024f999..03b07f48680 100644
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   

From a455bee3aabe6d280c753be1a25032fd63eebbd0 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Mon, 27 Jan 2014 05:35:20 -0800
Subject: [PATCH 68/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

========

https://hg.mozilla.org/integration/gaia-central/rev/8af2f10fe521
Author: Germ谩n Toro del Valle 
Desc: Merge pull request #15680 from gtorodelvalle/contacts-bug-960525-undefined-last-name

Bug 960525 - [Contacts] undefined as contact's last name after merging

========

https://hg.mozilla.org/integration/gaia-central/rev/af7449ed81cc
Author: Germ谩n Toro del Valle 
Desc: Bug 960525 - [Contacts] undefined as contact's last name after merging
---
 b2g/config/gaia.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 772b37f606d..22e42354bb7 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "f6e33b4f0225457805f4453a924019e9205736f1", 
+    "revision": "8af2f10fe5218d60e5b1c6ab383e776bd0f80981", 
     "repo_path": "/integration/gaia-central"
 }

From 98a6f10c2621b6527a11e72ba7d595b55a8082bc Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Mon, 27 Jan 2014 05:38:46 -0800
Subject: [PATCH 69/76] Bumping manifests a=b2g-bump

---
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/hamachi/sources.xml      | 2 +-
 b2g/config/helix/sources.xml        | 2 +-
 b2g/config/inari/sources.xml        | 2 +-
 b2g/config/leo/sources.xml          | 2 +-
 b2g/config/mako/sources.xml         | 2 +-
 b2g/config/wasabi/sources.xml       | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index c4ac1ea0e79..3435920893a 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index a988e4d9cb1..9b6fb61c5ec 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -11,7 +11,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index c4ac1ea0e79..3435920893a 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml
index 8972c8e67e5..f7b8766c5f8 100644
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml
index d8ab552cd69..6e07c0cc2cb 100644
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -10,7 +10,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml
index 2bb40b9fb21..bf727ee73a5 100644
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml
index 2628c8abc9a..56d1900cb3a 100644
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml
index 0d4f60344dc..9b6feac2259 100644
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -11,7 +11,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml
index 03b07f48680..d17d99e55cc 100644
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   

From fb2c97101df6f404e4d5f3fed80fa344a3e3cc38 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Mon, 27 Jan 2014 05:45:20 -0800
Subject: [PATCH 70/76] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/505727bb0593
Author: Zac 
Desc: Merge pull request #15724 from bebef1987/cam_geo

Bug 959170 - Fix geolocation prompt in test_unlock_to_camera_with_passco...

========

https://hg.mozilla.org/integration/gaia-central/rev/60bdba565da6
Author: Bebe 
Desc: Bug 959170 - Fix geolocation prompt in test_unlock_to_camera_with_passcode
---
 b2g/config/gaia.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 22e42354bb7..fbc57c254cc 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "8af2f10fe5218d60e5b1c6ab383e776bd0f80981", 
+    "revision": "505727bb0593f056969833dff7398776308901a2", 
     "repo_path": "/integration/gaia-central"
 }

From c0bd6944ffe020e88517d9bc5e870530ec2d1905 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Mon, 27 Jan 2014 05:47:52 -0800
Subject: [PATCH 71/76] Bumping manifests a=b2g-bump

---
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/hamachi/sources.xml      | 2 +-
 b2g/config/helix/sources.xml        | 2 +-
 b2g/config/inari/sources.xml        | 2 +-
 b2g/config/leo/sources.xml          | 2 +-
 b2g/config/mako/sources.xml         | 2 +-
 b2g/config/wasabi/sources.xml       | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 3435920893a..76b5fb1c08a 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 9b6fb61c5ec..86a6827110d 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -11,7 +11,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 3435920893a..76b5fb1c08a 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml
index f7b8766c5f8..187225a2db8 100644
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml
index 6e07c0cc2cb..6fe9ee4e221 100644
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -10,7 +10,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml
index bf727ee73a5..801a305dfae 100644
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml
index 56d1900cb3a..20c3f7cb297 100644
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml
index 9b6feac2259..71b80224cae 100644
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -11,7 +11,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml
index d17d99e55cc..76b0b9089ed 100644
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   

From f8a9196aaacd2fdca3b4df8fa11e9cc67c5aab41 Mon Sep 17 00:00:00 2001
From: Yoshi Huang 
Date: Mon, 27 Jan 2014 14:24:57 +0800
Subject: [PATCH 72/76] Bug 961271 - Part 1: write BCD chars. r=vicamo

---
 dom/system/gonk/ril_worker.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js
index 34ea223c47e..b47cf688d91 100644
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -9665,6 +9665,13 @@ let ICCPDUHelper = {
   writeNumberWithLength: function(number) {
     if (number) {
       let numStart = number[0] == "+" ? 1 : 0;
+      number = number.substring(0, numStart) +
+               number.substring(numStart)
+                     .replace(/[^0-9*#,]/g, "")
+                     .replace(/\*/g, "a")
+                     .replace(/\#/g, "b")
+                     .replace(/\,/g, "c");
+
       let numDigits = number.length - numStart;
       if (numDigits > ADN_MAX_NUMBER_DIGITS) {
         number = number.substring(0, ADN_MAX_NUMBER_DIGITS + numStart);

From c4610d83ffcc00c0cff79423ce183a4f8fab23fe Mon Sep 17 00:00:00 2001
From: Yoshi Huang 
Date: Mon, 27 Jan 2014 18:27:18 +0800
Subject: [PATCH 73/76] Bug 961271 - Part 2: xpcshell test case. r=vicamo

---
 dom/system/gonk/tests/test_ril_worker_icc.js | 40 ++++++++++++--------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/dom/system/gonk/tests/test_ril_worker_icc.js b/dom/system/gonk/tests/test_ril_worker_icc.js
index d767f2615fd..d2a80224818 100644
--- a/dom/system/gonk/tests/test_ril_worker_icc.js
+++ b/dom/system/gonk/tests/test_ril_worker_icc.js
@@ -496,27 +496,35 @@ add_test(function test_write_number_with_length() {
   let helper = worker.GsmPDUHelper;
   let iccHelper = worker.ICCPDUHelper;
 
-  // without +
-  let number_1 = "123456789";
-  iccHelper.writeNumberWithLength(number_1);
-  let numLen = helper.readHexOctet();
-  do_check_eq(number_1, iccHelper.readDiallingNumber(numLen));
-  for (let i = 0; i < (ADN_MAX_BCD_NUMBER_BYTES - numLen); i++) {
-    do_check_eq(0xff, helper.readHexOctet());
+  function test(number, expectedNumber) {
+    expectedNumber = expectedNumber || number;
+    iccHelper.writeNumberWithLength(number);
+    let numLen = helper.readHexOctet();
+    do_check_eq(expectedNumber, iccHelper.readDiallingNumber(numLen));
+    for (let i = 0; i < (ADN_MAX_BCD_NUMBER_BYTES - numLen); i++) {
+      do_check_eq(0xff, helper.readHexOctet());
+    }
   }
 
+  // without +
+  test("123456789");
+
   // with +
-  let number_2 = "+987654321";
-  iccHelper.writeNumberWithLength(number_2);
-  numLen = helper.readHexOctet();
-  do_check_eq(number_2, iccHelper.readDiallingNumber(numLen));
-  for (let i = 0; i < (ADN_MAX_BCD_NUMBER_BYTES - numLen); i++) {
-    do_check_eq(0xff, helper.readHexOctet());
-  }
+  test("+987654321");
+
+  // extended BCD coding
+  test("1*2#3,4*5#6,");
+
+  // with + and extended BCD coding
+  test("+1*2#3,4*5#6,");
+
+  // non-supported characters should not be written.
+  test("(1)23-456+789", "123456789");
+
+  test("++(01)2*3-4#5,6+7(8)9*0#1,", "+012*34#5,6789*0#1,");
 
   // null
-  let number_3;
-  iccHelper.writeNumberWithLength(number_3);
+  iccHelper.writeNumberWithLength(null);
   for (let i = 0; i < (ADN_MAX_BCD_NUMBER_BYTES + 1); i++) {
     do_check_eq(0xff, helper.readHexOctet());
   }

From d8eae0c7bf1587aba2bbff1554f572f2d4c08973 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Mon, 27 Jan 2014 10:25:46 -0800
Subject: [PATCH 74/76] Bumping gaia.json for 10 gaia revision(s) a=gaia-bump
 Truncated some number of revisions since the previous bump.

========

https://hg.mozilla.org/integration/gaia-central/rev/1150c11d1e6f
Author: Kevin Grandon 
Desc: Merge pull request #15706 from KevinGrandon/bug_964095_debugger_mode

Bug 964095 - DEVICE_DEBUG should set adb and devtools r=yurenju

========

https://hg.mozilla.org/integration/gaia-central/rev/dddf421ca64c
Author: Kevin Grandon 
Desc: Bug 964095 - DEVICE_DEBUG should set adb and devtools r=yurenju

========

https://hg.mozilla.org/integration/gaia-central/rev/1650e67a114d
Author: Fernando Campo 
Desc: Merge pull request #15429 from pmclanahan/fix-basket-ftu-xhr-949170

Bug 949170: Fix FTU basket XHR. (r=fcampo)

========

https://hg.mozilla.org/integration/gaia-central/rev/224c8c4fc580
Author: Paul McLanahan 
Desc: Bug 949170: Fix FTU basket XHR.

========

https://hg.mozilla.org/integration/gaia-central/rev/d80e39d3104e
Author: Jose M. Cantera 
Desc: Merge pull request #13212 from gitmai/bug-925566-contact-phone-without-type

Bug 925566 -A preloaded contact without a type specified for a phone num...

========

https://hg.mozilla.org/integration/gaia-central/rev/d2368a635f77
Author: mai 
Desc: Bug 925566 -A preloaded contact without a type specified for a phone number defaults to mobile, even though mobile isn't the defined type

========

https://hg.mozilla.org/integration/gaia-central/rev/9d5045b18241
Author: Zac Campbell 
Desc: Bug 958524 - Fix test_camera_flash_mode to run on manifest not in-test logic r=me a=testonly

========

https://hg.mozilla.org/integration/gaia-central/rev/f60e6705a3b1
Author: Zac Campbell 
Desc: Bug 963777 - Disable test_cards_view_kill_apps_with_two_apps.py on os=mac r=me a=testonly

========

https://hg.mozilla.org/integration/gaia-central/rev/249882264b91
Author: Jose M. Cantera 
Desc: Merge pull request #15686 from jmcanterafonseca/fix_oom_facebook

Bug 950295 - Facebook Import OOMs and kills itself when importing 500+ c...

========

https://hg.mozilla.org/integration/gaia-central/rev/5db88bbad40e
Author: Jose M. Cantera 
Desc: Bug 950295 - Facebook Import OOMs and kills itself when importing 500+ contacts
---
 b2g/config/gaia.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index fbc57c254cc..fc8953ca75f 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "505727bb0593f056969833dff7398776308901a2", 
+    "revision": "1150c11d1e6f0f78df3552dfca8c53d5ed5c173d", 
     "repo_path": "/integration/gaia-central"
 }

From 9980d11a499d15ac78ea5d52a1936eace5a1ee42 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Mon, 27 Jan 2014 10:25:55 -0800
Subject: [PATCH 75/76] Bumping manifests a=b2g-bump

---
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/hamachi/sources.xml      | 2 +-
 b2g/config/helix/sources.xml        | 2 +-
 b2g/config/inari/sources.xml        | 2 +-
 b2g/config/leo/sources.xml          | 2 +-
 b2g/config/mako/sources.xml         | 2 +-
 b2g/config/wasabi/sources.xml       | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 76b5fb1c08a..aaf18b8286e 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 86a6827110d..7778c1af8d7 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -11,7 +11,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 76b5fb1c08a..aaf18b8286e 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml
index 187225a2db8..5d756f07790 100644
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml
index 6fe9ee4e221..df290f63ef0 100644
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -10,7 +10,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml
index 801a305dfae..2fbb69487a5 100644
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -12,7 +12,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml
index 20c3f7cb297..a77ac4b5a6e 100644
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml
index 71b80224cae..5e17a46b273 100644
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -11,7 +11,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml
index 76b0b9089ed..27af98a8b3d 100644
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -11,7 +11,7 @@
     
   
   
-  
+  
   
   
   

From ef85e994457782ae4203b109e25b78430c5114de Mon Sep 17 00:00:00 2001
From: Andrew Halberstadt 
Date: Mon, 27 Jan 2014 15:05:25 -0500
Subject: [PATCH 76/76] Bug 916350 - Add missing hunk to get b2g desktop
 reftests working. r=bustage

---
 layout/tools/reftest/runreftest.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/layout/tools/reftest/runreftest.py b/layout/tools/reftest/runreftest.py
index 3a982086a03..e4290032f42 100644
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -110,8 +110,8 @@ class RefTest(object):
 
   oldcwd = os.getcwd()
 
-  def __init__(self, automation):
-    self.automation = automation
+  def __init__(self, automation=None):
+    self.automation = automation or Automation()
 
   def getFullPath(self, path):
     "Get an absolute path relative to self.oldcwd."