Merge inbound to m-c. a=merge

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-09-02 14:23:25 -04:00
commit d114beb6ed
348 changed files with 3617 additions and 1437 deletions

View File

@ -23,7 +23,7 @@ typedef RootAccessible RootAccessibleWrap;
class GtkWindowAccessible MOZ_FINAL : public DummyAccessible
{
public:
GtkWindowAccessible(AtkObject* aAccessible);
explicit GtkWindowAccessible(AtkObject* aAccessible);
virtual ~GtkWindowAccessible();
};

View File

@ -23,7 +23,7 @@ namespace a11y {
class MaiHyperlink
{
public:
MaiHyperlink(Accessible* aHyperLink);
explicit MaiHyperlink(Accessible* aHyperLink);
~MaiHyperlink();
public:

View File

@ -234,7 +234,7 @@ uint8_t AttrCharacteristicsFor(nsIAtom* aAtom);
class AttrIterator
{
public:
AttrIterator(nsIContent* aContent) :
explicit AttrIterator(nsIContent* aContent) :
mContent(aContent), mAttrIdx(0)
{
mAttrCount = mContent->GetAttrCount();

View File

@ -81,7 +81,7 @@ public:
protected:
// Make sure it's used by Accessible class only.
EmbeddedObjCollector(Accessible* aRoot) :
explicit EmbeddedObjCollector(Accessible* aRoot) :
AccCollector(aRoot, filters::GetEmbeddedObject) { }
virtual void AppendObject(Accessible* aAccessible);

View File

@ -52,7 +52,7 @@ private:
struct IteratorState
{
IteratorState(Accessible* aParent, IteratorState* mParentState = nullptr);
explicit IteratorState(Accessible* aParent, IteratorState* mParentState = nullptr);
Accessible* mParent;
int32_t mIndex;
@ -254,7 +254,7 @@ private:
class SingleAccIterator : public AccIterable
{
public:
SingleAccIterator(Accessible* aTarget): mAcc(aTarget) { }
explicit SingleAccIterator(Accessible* aTarget): mAcc(aTarget) { }
virtual ~SingleAccIterator() { }
virtual Accessible* Next();
@ -274,7 +274,7 @@ private:
class ItemIterator : public AccIterable
{
public:
ItemIterator(Accessible* aItemContainer) :
explicit ItemIterator(Accessible* aItemContainer) :
mContainer(aItemContainer), mAnchor(nullptr) { }
virtual ~ItemIterator() { }

View File

@ -19,7 +19,7 @@ class DocAccessible;
class EventQueue
{
protected:
EventQueue(DocAccessible* aDocument) : mDocument(aDocument) { }
explicit EventQueue(DocAccessible* aDocument) : mDocument(aDocument) { }
/**
* Put an accessible event into the queue to process it later.

View File

@ -275,8 +275,8 @@ private:
typedef T* KeyType;
typedef const T* KeyTypePointer;
nsCOMPtrHashKey(const T* aKey) : mKey(const_cast<T*>(aKey)) {}
nsCOMPtrHashKey(const nsPtrHashKey<T> &aToCopy) : mKey(aToCopy.mKey) {}
explicit nsCOMPtrHashKey(const T* aKey) : mKey(const_cast<T*>(aKey)) {}
explicit nsCOMPtrHashKey(const nsPtrHashKey<T> &aToCopy) : mKey(aToCopy.mKey) {}
~nsCOMPtrHashKey() { }
KeyType GetKey() const { return mKey; }

View File

@ -23,10 +23,10 @@ class Relation
public:
Relation() : mFirstIter(nullptr), mLastIter(nullptr) { }
Relation(AccIterable* aIter) :
explicit Relation(AccIterable* aIter) :
mFirstIter(aIter), mLastIter(aIter) { }
Relation(Accessible* aAcc) :
explicit Relation(Accessible* aAcc) :
mFirstIter(nullptr), mLastIter(nullptr)
{ AppendTarget(aAcc); }

View File

@ -34,7 +34,7 @@ public:
/**
* Constructor. Used to expose default text attributes.
*/
TextAttrsMgr(HyperTextAccessible* aHyperTextAcc) :
explicit TextAttrsMgr(HyperTextAccessible* aHyperTextAcc) :
mOffsetAcc(nullptr), mHyperTextAcc(aHyperTextAcc),
mOffsetAccIdx(-1), mIncludeDefAttrs(true) { }
@ -126,7 +126,7 @@ protected:
class TTextAttr : public TextAttr
{
public:
TTextAttr(bool aGetRootValue) : mGetRootValue(aGetRootValue) {}
explicit TTextAttr(bool aGetRootValue) : mGetRootValue(aGetRootValue) {}
// TextAttr
virtual void Expose(nsIPersistentProperties* aAttributes,
@ -393,7 +393,7 @@ protected:
{
public:
TextDecorValue() { }
TextDecorValue(nsIFrame* aFrame);
explicit TextDecorValue(nsIFrame* aFrame);
nscolor Color() const { return mColor; }
uint8_t Style() const { return mStyle; }

View File

@ -19,8 +19,8 @@ using namespace mozilla::a11y;
class RuleCache
{
public:
RuleCache(nsIAccessibleTraversalRule* aRule) : mRule(aRule),
mAcceptRoles(nullptr) { }
explicit RuleCache(nsIAccessibleTraversalRule* aRule) : mRule(aRule),
mAcceptRoles(nullptr) { }
~RuleCache () {
if (mAcceptRoles)
nsMemory::Free(mAcceptRoles);

View File

@ -25,7 +25,7 @@ class nsAccessiblePivot MOZ_FINAL : public nsIAccessiblePivot
public:
typedef mozilla::a11y::Accessible Accessible;
nsAccessiblePivot(Accessible* aRoot);
explicit nsAccessiblePivot(Accessible* aRoot);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAccessiblePivot, nsIAccessiblePivot)

View File

@ -21,7 +21,7 @@ class TableAccessible;
class xpcAccessibleTable
{
public:
xpcAccessibleTable(mozilla::a11y::TableAccessible* aTable) : mTable(aTable) { }
explicit xpcAccessibleTable(mozilla::a11y::TableAccessible* aTable) : mTable(aTable) { }
nsresult GetCaption(nsIAccessible** aCaption);
nsresult GetSummary(nsAString& aSummary);

View File

@ -25,7 +25,7 @@ class TableCellAccessible;
class xpcAccessibleTableCell
{
public:
xpcAccessibleTableCell(mozilla::a11y::TableCellAccessible* aTableCell) :
explicit xpcAccessibleTableCell(mozilla::a11y::TableCellAccessible* aTableCell) :
mTableCell(aTableCell) { }
nsresult GetTable(nsIAccessibleTable** aTable);

View File

@ -61,7 +61,7 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLETEXTRANGE_IMPL_IID)
private:
xpcAccessibleTextRange(TextRange&& aRange) :
explicit xpcAccessibleTextRange(TextRange&& aRange) :
mRange(Forward<TextRange>(aRange)) {}
xpcAccessibleTextRange() {}

View File

@ -215,6 +215,13 @@ RunProcesses(int argc, const char *argv[])
return XRE_ProcLoaderServiceRun(getppid(), childSock, argc, argv);
}
// Reap zombie child process.
struct sigaction sa;
sa.sa_handler = SIG_IGN;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGCHLD, &sa, nullptr);
// The b2g process
int childPid = pid;
XRE_ProcLoaderClientInit(childPid, parentSock);

View File

@ -754,13 +754,11 @@ pref("hal.processPriorityManager.gonk.notifyLowMemUnderKB", 14336);
// blocked on a poll(), and this pref has no effect.)
pref("gonk.systemMemoryPressureRecoveryPollMS", 5000);
#ifndef DEBUG
// Enable pre-launching content processes for improved startup time
// (hiding latency).
pref("dom.ipc.processPrelaunch.enabled", true);
// Wait this long before pre-launching a new subprocess.
pref("dom.ipc.processPrelaunch.delayMs", 5000);
#endif
pref("dom.ipc.reuse_parent_app", false);

View File

@ -55,13 +55,17 @@ function checkDebuggerPort() {
// DebuggerServer.openListener detects that it isn't a file path (string),
// and starts listening on the tcp port given here as command line argument.
if (!window.arguments) {
// Get the command line arguments that were passed to the b2g client
let args;
try {
let service = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"].getService(Ci.nsISupports);
args = service.wrappedJSObject.cmdLine;
} catch(e) {}
if (!args) {
return;
}
// Get the command line arguments that were passed to the b2g client
let args = window.arguments[0].QueryInterface(Ci.nsICommandLine);
let dbgport;
try {
dbgport = args.handleFlagWithParam('start-debugger-server', false);

View File

@ -5,12 +5,17 @@
let runAppObj;
window.addEventListener('load', function() {
if (!window.arguments) {
// Get the command line arguments that were passed to the b2g client
let args;
try {
let service = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"].getService(Ci.nsISupports);
args = service.wrappedJSObject.cmdLine;
} catch(e) {}
if (!args) {
return;
}
// Get the command line arguments that were passed to the b2g client
let args = window.arguments[0].QueryInterface(Ci.nsICommandLine);
let appname;
// - Check if the argument is present before doing any work.

View File

@ -62,8 +62,8 @@ window.addEventListener('ContentStart', function() {
// Get the command line arguments that were passed to the b2g client
let args;
try {
// On Firefox Mulet, we don't always have a command line argument
args = window.arguments[0].QueryInterface(Ci.nsICommandLine);
let service = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"].getService(Ci.nsISupports);
args = service.wrappedJSObject.cmdLine;
} catch(e) {}
let screenarg = null;

View File

@ -96,6 +96,10 @@ category profile-after-change SimulatorScreen @mozilla.org/simulator-screen;1
component {e30b0e13-2d12-4cb0-bc4c-4e617a1bf76e} OopCommandLine.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=b2goop {e30b0e13-2d12-4cb0-bc4c-4e617a1bf76e}
category command-line-handler m-b2goop @mozilla.org/commandlinehandler/general-startup;1?type=b2goop
component {385993fe-8710-4621-9fb1-00a09d8bec37} CommandLine.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds {385993fe-8710-4621-9fb1-00a09d8bec37}
category command-line-handler m-b2gcmds @mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds
#endif
# MobileIdentityUIGlue.js
@ -105,4 +109,4 @@ contract @mozilla.org/services/mobileid-ui-glue;1 {83dbe26a-81f3-4a75-9541-3d0b7
# B2GAppMigrator.js
component {7211ece0-b458-4635-9afc-f8d7f376ee95} B2GAppMigrator.js
contract @mozilla.org/b2g-app-migrator;1 {7211ece0-b458-4635-9afc-f8d7f376ee95}
category profile-after-change B2GAppMigrator @mozilla.org/b2g-app-migrator;1
category profile-after-change B2GAppMigrator @mozilla.org/b2g-app-migrator;1

View File

@ -0,0 +1,25 @@
/* 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/. */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
// Small helper to expose nsICommandLine object to chrome code
function CommandlineHandler() {
this.wrappedJSObject = this;
}
CommandlineHandler.prototype = {
handle: function(cmdLine) {
this.cmdLine = cmdLine;
},
helpInfo: "",
classID: Components.ID("{385993fe-8710-4621-9fb1-00a09d8bec37}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CommandlineHandler]);

View File

@ -30,6 +30,7 @@ EXTRA_COMPONENTS += [
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
EXTRA_COMPONENTS += [
'CommandLine.js',
'OopCommandLine.js',
'SimulatorScreen.js'
]

View File

@ -451,6 +451,7 @@
@BINPATH@/components/amWebInstallListener.js
@BINPATH@/components/nsBlocklistService.js
@BINPATH@/components/OopCommandLine.js
@BINPATH@/components/CommandLine.js
#endif
#ifdef MOZ_UPDATER

View File

@ -2358,10 +2358,23 @@ bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID,
AudioChannel audioChannel = static_cast<AudioChannel>(aResult.GetEnumValue());
if (audioChannel != mAudioChannel &&
!mDecoder &&
CheckAudioChannelPermissions(aValue)) {
mAudioChannel = audioChannel;
if (audioChannel == mAudioChannel ||
!CheckAudioChannelPermissions(aValue)) {
return true;
}
// We cannot change the AudioChannel of a decoder.
if (mDecoder) {
return true;
}
mAudioChannel = audioChannel;
if (mSrcStream) {
nsRefPtr<MediaStream> stream = mSrcStream->GetStream();
if (stream) {
stream->SetAudioChannelType(mAudioChannel);
}
}
return true;
@ -2822,6 +2835,12 @@ void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
NS_ASSERTION(!mSrcStream && !mSrcStreamListener, "Should have been ended already");
mSrcStream = aStream;
nsRefPtr<MediaStream> stream = mSrcStream->GetStream();
if (stream) {
stream->SetAudioChannelType(mAudioChannel);
}
// XXX if we ever support capturing the output of a media element which is
// playing a stream, we'll need to add a CombineWithPrincipal call here.
mSrcStreamListener = new StreamListener(this);

View File

@ -324,10 +324,18 @@ IsDirectShowSupportedType(const nsACString& aType)
#ifdef MOZ_FMP4
static bool
IsMP4SupportedType(const nsACString& aType)
IsMP4SupportedType(const nsACString& aType,
const nsAString& aCodecs = EmptyString())
{
// Currently on B2G, FMP4 is only working for MSE playback.
// For other normal MP4, it still uses current omx decoder.
// Bug 1061034 is a follow-up bug to enable all MP4s with MOZ_FMP4
#ifdef MOZ_OMX_DECODER
return false;
#else
return Preferences::GetBool("media.fragmented-mp4.exposed", false) &&
MP4Decoder::CanHandleMediaType(aType);
MP4Decoder::CanHandleMediaType(aType, aCodecs);
#endif
}
#endif
@ -410,7 +418,7 @@ DecoderTraits::CanHandleMediaType(const char* aMIMEType,
}
#endif
#ifdef MOZ_FMP4
if (MP4Decoder::CanHandleMediaType(nsDependentCString(aMIMEType),
if (IsMP4SupportedType(nsDependentCString(aMIMEType),
aRequestedCodecs)) {
return aHaveRequestedCodecs ? CANPLAY_YES : CANPLAY_MAYBE;
}

View File

@ -29,7 +29,7 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(MediaKeyMessageEvent, Event)
protected:
virtual ~MediaKeyMessageEvent();
MediaKeyMessageEvent(EventTarget* aOwner);
explicit MediaKeyMessageEvent(EventTarget* aOwner);
JS::Heap<JSObject*> mMessage;
nsString mDestinationURL;

View File

@ -40,7 +40,7 @@ GstMozVideoBufferData* gst_moz_video_buffer_get_data(const GstMozVideoBuffer* bu
class GstMozVideoBufferData {
public:
GstMozVideoBufferData(layers::PlanarYCbCrImage* aImage) : mImage(aImage) {}
explicit GstMozVideoBufferData(layers::PlanarYCbCrImage* aImage) : mImage(aImage) {}
static void* Copy(void* aData) {
return new GstMozVideoBufferData(reinterpret_cast<GstMozVideoBufferData*>(aData)->mImage);

View File

@ -38,7 +38,7 @@ class GStreamerReader : public MediaDecoderReader
typedef gfx::IntRect IntRect;
public:
GStreamerReader(AbstractMediaDecoder* aDecoder);
explicit GStreamerReader(AbstractMediaDecoder* aDecoder);
virtual ~GStreamerReader();
virtual nsresult Init(MediaDecoderReader* aCloneDonor);

View File

@ -29,6 +29,7 @@
#include "MediaStreamSource.h"
#include "MediaTaskQueue.h"
#include "MP3FrameParser.h"
#include "nsThreadUtils.h"
#include "ImageContainer.h"
#include "SharedThreadPool.h"
@ -131,6 +132,7 @@ MediaCodecReader::TrackInputCopier::Copy(MediaBuffer* aSourceBuffer,
MediaCodecReader::Track::Track()
: mSourceIsStopped(true)
, mDurationLock("MediaCodecReader::Track::mDurationLock")
, mDurationUs(INT64_C(0))
, mInputIndex(sInvalidInputIndex)
, mInputEndOfStream(false)
@ -193,10 +195,96 @@ MediaCodecReader::CodecBufferInfo::CodecBufferInfo()
{
}
MediaCodecReader::SignalObject::SignalObject(const char* aName)
: mMonitor(aName)
, mSignaled(false)
{
}
MediaCodecReader::SignalObject::~SignalObject()
{
}
void
MediaCodecReader::SignalObject::Wait()
{
MonitorAutoLock al(mMonitor);
if (!mSignaled) {
mMonitor.Wait();
}
}
void
MediaCodecReader::SignalObject::Signal()
{
MonitorAutoLock al(mMonitor);
mSignaled = true;
mMonitor.Notify();
}
MediaCodecReader::ParseCachedDataRunnable::ParseCachedDataRunnable(nsRefPtr<MediaCodecReader> aReader,
const char* aBuffer,
uint32_t aLength,
int64_t aOffset,
nsRefPtr<SignalObject> aSignal)
: mReader(aReader)
, mBuffer(aBuffer)
, mLength(aLength)
, mOffset(aOffset)
, mSignal(aSignal)
{
MOZ_ASSERT(mReader, "Should have a valid MediaCodecReader.");
MOZ_ASSERT(mBuffer, "Should have a valid buffer.");
MOZ_ASSERT(mOffset >= INT64_C(0), "Should have a valid offset.");
}
NS_IMETHODIMP
MediaCodecReader::ParseCachedDataRunnable::Run()
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
if (mReader->ParseDataSegment(mBuffer, mLength, mOffset)) {
MonitorAutoLock monLock(mReader->mParserMonitor);
if (mReader->mNextParserPosition >= mOffset + mLength &&
mReader->mParsedDataLength < mOffset + mLength) {
mReader->mParsedDataLength = mOffset + mLength;
}
}
if (mSignal != nullptr) {
mSignal->Signal();
}
return NS_OK;
}
MediaCodecReader::ProcessCachedDataTask::ProcessCachedDataTask(nsRefPtr<MediaCodecReader> aReader,
int64_t aOffset)
: mReader(aReader)
, mOffset(aOffset)
{
MOZ_ASSERT(mReader, "Should have a valid MediaCodecReader.");
MOZ_ASSERT(mOffset >= INT64_C(0), "Should have a valid offset.");
}
void
MediaCodecReader::ProcessCachedDataTask::Run()
{
mReader->ProcessCachedData(mOffset, nullptr);
nsRefPtr<ReferenceKeeperRunnable<MediaCodecReader>> runnable(
new ReferenceKeeperRunnable<MediaCodecReader>(mReader));
mReader = nullptr;
NS_DispatchToMainThread(runnable.get());
}
MediaCodecReader::MediaCodecReader(AbstractMediaDecoder* aDecoder)
: MediaOmxCommonReader(aDecoder)
, mColorConverterBufferSize(0)
, mExtractor(nullptr)
, mParserMonitor("MediaCodecReader::mParserMonitor")
, mParseDataFromCache(true)
, mNextParserPosition(INT64_C(0))
, mParsedDataLength(INT64_C(0))
{
mHandler = new MessageHandler(this);
mVideoListener = new VideoResourceListener(this);
@ -421,6 +509,144 @@ MediaCodecReader::HasVideo()
return mInfo.mVideo.mHasVideo;
}
void
MediaCodecReader::NotifyDataArrived(const char* aBuffer,
uint32_t aLength,
int64_t aOffset)
{
MonitorAutoLock monLock(mParserMonitor);
if (mNextParserPosition == mParsedDataLength &&
mNextParserPosition >= aOffset &&
mNextParserPosition <= aOffset + aLength) {
// No pending parsing runnable currently. And available data are adjacent to
// parsed data.
int64_t shift = mNextParserPosition - aOffset;
const char* buffer = aBuffer + shift;
uint32_t length = aLength - shift;
int64_t offset = mNextParserPosition;
if (length > 0) {
MonitorAutoUnlock monUnlock(mParserMonitor);
ParseDataSegment(buffer, length, offset);
}
mParseDataFromCache = false;
mParsedDataLength = offset + length;
mNextParserPosition = mParsedDataLength;
}
}
int64_t
MediaCodecReader::ProcessCachedData(int64_t aOffset,
nsRefPtr<SignalObject> aSignal)
{
// We read data in chunks of 32 KiB. We can reduce this
// value if media, such as sdcards, is too slow.
// Because of SD card's slowness, need to keep sReadSize to small size.
// See Bug 914870.
static const int64_t sReadSize = 32 * 1024;
MOZ_ASSERT(!NS_IsMainThread(), "Should not be on main thread.");
{
MonitorAutoLock monLock(mParserMonitor);
if (!mParseDataFromCache) {
// Skip cache processing since data can be continuously be parsed by
// ParseDataSegment() from NotifyDataArrived() directly.
return INT64_C(0);
}
}
MediaResource *resource = mDecoder->GetResource();
MOZ_ASSERT(resource);
int64_t resourceLength = resource->GetCachedDataEnd(0);
NS_ENSURE_TRUE(resourceLength >= 0, INT64_C(-1));
if (aOffset >= resourceLength) {
return INT64_C(0); // Cache is empty, nothing to do
}
int64_t bufferLength = std::min<int64_t>(resourceLength - aOffset, sReadSize);
nsAutoArrayPtr<char> buffer(new char[bufferLength]);
nsresult rv = resource->ReadFromCache(buffer.get(), aOffset, bufferLength);
NS_ENSURE_SUCCESS(rv, INT64_C(-1));
MonitorAutoLock monLock(mParserMonitor);
if (mParseDataFromCache) {
nsRefPtr<ParseCachedDataRunnable> runnable(
new ParseCachedDataRunnable(this,
buffer.forget(),
bufferLength,
aOffset,
aSignal));
rv = NS_DispatchToMainThread(runnable.get());
NS_ENSURE_SUCCESS(rv, INT64_C(-1));
mNextParserPosition = aOffset + bufferLength;
if (mNextParserPosition < resource->GetCachedDataEnd(0)) {
// We cannot read data in the main thread because it
// might block for too long. Instead we post an IO task
// to the IO thread if there is more data available.
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
new ProcessCachedDataTask(this, mNextParserPosition));
}
}
return bufferLength;
}
bool
MediaCodecReader::ParseDataSegment(const char* aBuffer,
uint32_t aLength,
int64_t aOffset)
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
int64_t duration = INT64_C(-1);
{
MonitorAutoLock monLock(mParserMonitor);
// currently only mp3 files are supported for incremental parsing
if (mMP3FrameParser == nullptr) {
return false;
}
if (!mMP3FrameParser->IsMP3()) {
return true; // NO-OP
}
mMP3FrameParser->Parse(aBuffer, aLength, aOffset);
duration = mMP3FrameParser->GetDuration();
}
bool durationUpdateRequired = false;
{
MutexAutoLock al(mAudioTrack.mDurationLock);
if (duration > mAudioTrack.mDurationUs) {
mAudioTrack.mDurationUs = duration;
durationUpdateRequired = true;
}
}
if (durationUpdateRequired && HasVideo()) {
MutexAutoLock al(mVideoTrack.mDurationLock);
durationUpdateRequired = duration > mVideoTrack.mDurationUs;
}
if (durationUpdateRequired) {
MOZ_ASSERT(mDecoder);
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->UpdateEstimatedMediaDuration(duration);
}
return true;
}
nsresult
MediaCodecReader::ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags)
@ -435,6 +661,10 @@ MediaCodecReader::ReadMetadata(MediaInfo* aInfo,
CheckAudioOffload();
#endif
if (!TriggerIncrementalParser()) {
return NS_ERROR_FAILURE;
}
if (IsWaitingMediaResources()) {
return NS_OK;
}
@ -454,9 +684,18 @@ MediaCodecReader::ReadMetadata(MediaInfo* aInfo,
}
// Set the total duration (the max of the audio and video track).
int64_t duration = mAudioTrack.mDurationUs > mVideoTrack.mDurationUs ?
mAudioTrack.mDurationUs : mVideoTrack.mDurationUs;
if (duration >= 0LL) {
int64_t audioDuration = INT64_C(-1);
{
MutexAutoLock al(mAudioTrack.mDurationLock);
audioDuration = mAudioTrack.mDurationUs;
}
int64_t videoDuration = INT64_C(-1);
{
MutexAutoLock al(mVideoTrack.mDurationLock);
videoDuration = mVideoTrack.mDurationUs;
}
int64_t duration = audioDuration > videoDuration ? audioDuration : videoDuration;
if (duration >= INT64_C(0)) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mDecoder->SetMediaDuration(duration);
}
@ -814,8 +1053,7 @@ MediaCodecReader::CreateMediaSources()
return false;
}
sp<MetaData> extractorMetaData = mExtractor->getMetaData();
// TODO: Check MP3 file format
mMetaData = mExtractor->getMetaData();
const ssize_t invalidTrackIndex = -1;
ssize_t audioTrackIndex = invalidTrackIndex;
@ -960,7 +1198,6 @@ MediaCodecReader::CreateMediaCodec(sp<ALooper>& aLooper,
bool
MediaCodecReader::ConfigureMediaCodec(Track& aTrack)
{
if (aTrack.mSource != nullptr && aTrack.mCodec != nullptr) {
if (!aTrack.mCodec->allocated()) {
return false;
@ -1009,6 +1246,54 @@ MediaCodecReader::DestroyMediaCodecs(Track& aTrack)
aTrack.mCodec = nullptr;
}
bool
MediaCodecReader::TriggerIncrementalParser()
{
if (mMetaData == nullptr) {
return false;
}
int64_t duration = INT64_C(-1);
{
MonitorAutoLock monLock(mParserMonitor);
// only support incremental parsing for mp3 currently.
if (mMP3FrameParser != nullptr) {
return true;
}
mParseDataFromCache = true;
mNextParserPosition = INT64_C(0);
mParsedDataLength = INT64_C(0);
// MP3 file duration
mMP3FrameParser = new MP3FrameParser(mDecoder->GetResource()->GetLength());
const char* mime = nullptr;
if (mMetaData->findCString(kKeyMIMEType, &mime) &&
!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) {
{
MonitorAutoUnlock monUnlock(mParserMonitor);
// trigger parsing logic and wait for finishing parsing data in the beginning.
nsRefPtr<SignalObject> signalObject = new SignalObject("MediaCodecReader::UpdateDuration()");
if (ProcessCachedData(INT64_C(0), signalObject) > INT64_C(0)) {
signalObject->Wait();
}
}
duration = mMP3FrameParser->GetDuration();
}
}
{
MutexAutoLock al(mAudioTrack.mDurationLock);
if (duration > mAudioTrack.mDurationUs) {
mAudioTrack.mDurationUs = duration;
}
}
return true;
}
bool
MediaCodecReader::UpdateDuration()
{
@ -1016,23 +1301,26 @@ MediaCodecReader::UpdateDuration()
if (mAudioTrack.mSource != nullptr) {
sp<MetaData> audioFormat = mAudioTrack.mSource->getFormat();
if (audioFormat != nullptr) {
int64_t audioDurationUs = 0LL;
if (audioFormat->findInt64(kKeyDuration, &audioDurationUs) &&
audioDurationUs > mAudioTrack.mDurationUs) {
mAudioTrack.mDurationUs = audioDurationUs;
int64_t duration = INT64_C(0);
if (audioFormat->findInt64(kKeyDuration, &duration)) {
MutexAutoLock al(mAudioTrack.mDurationLock);
if (duration > mAudioTrack.mDurationUs) {
mAudioTrack.mDurationUs = duration;
}
}
}
}
// TODO: MP3 file duration
// read video duration
if (mVideoTrack.mSource != nullptr) {
sp<MetaData> videoFormat = mVideoTrack.mSource->getFormat();
if (videoFormat != nullptr) {
int64_t videoDurationUs = 0LL;
if (videoFormat->findInt64(kKeyDuration, &videoDurationUs) &&
videoDurationUs > mVideoTrack.mDurationUs) {
mVideoTrack.mDurationUs = videoDurationUs;
int64_t duration = INT64_C(0);
if (videoFormat->findInt64(kKeyDuration, &duration)) {
MutexAutoLock al(mVideoTrack.mDurationLock);
if (duration > mVideoTrack.mDurationUs) {
mVideoTrack.mDurationUs = duration;
}
}
}
}
@ -1396,7 +1684,7 @@ MediaCodecReader::EnsureCodecFormatParsed(Track& aTrack)
size_t index = 0;
size_t offset = 0;
size_t size = 0;
int64_t timeUs = 0LL;
int64_t timeUs = INT64_C(0);
uint32_t flags = 0;
while ((status = aTrack.mCodec->dequeueOutputBuffer(&index, &offset, &size,
&timeUs, &flags)) != INFO_FORMAT_CHANGED) {

View File

@ -9,7 +9,11 @@
#include <utils/threads.h>
#include <base/message_loop.h>
#include <mozilla/CheckedInt.h>
#include <mozilla/Mutex.h>
#include <mozilla/Monitor.h>
#include "MediaData.h"
@ -22,14 +26,15 @@ struct ALooper;
struct AMessage;
class MOZ_EXPORT MediaExtractor;
class MOZ_EXPORT MetaData;
class MOZ_EXPORT MediaBuffer;
struct MOZ_EXPORT MediaSource;
struct MediaCodec;
} // namespace android
namespace mozilla {
class MediaTaskQueue;
class MP3FrameParser;
class MediaCodecReader : public MediaOmxCommonReader
{
@ -55,6 +60,11 @@ public:
// irreversible, whereas ReleaseMediaResources() is reversible.
virtual void Shutdown();
// Used to retrieve some special information that can only be retrieved after
// all contents have been continuously parsed. (ex. total duration of some
// variable-bit-rate MP3 files.)
virtual void NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset);
// Flush the MediaTaskQueue, flush MediaCodec and raise the mDiscontinuity.
virtual nsresult ResetDecode() MOZ_OVERRIDE;
@ -109,6 +119,8 @@ protected:
nsAutoPtr<TrackInputCopier> mInputCopier;
// media parameters
Mutex mDurationLock; // mDurationUs might be read or updated from multiple
// threads.
int64_t mDurationUs;
// playback parameters
@ -122,6 +134,11 @@ protected:
bool mFlushed; // meaningless when mSeekTimeUs is invalid.
bool mDiscontinuity;
nsRefPtr<MediaTaskQueue> mTaskQueue;
private:
// Forbidden
Track(const Track &rhs) MOZ_DELETE;
const Track &operator=(const Track&) MOZ_DELETE;
};
// Receive a message from MessageHandler.
@ -188,6 +205,11 @@ private:
struct AudioTrack : public Track
{
AudioTrack();
private:
// Forbidden
AudioTrack(const AudioTrack &rhs) MOZ_DELETE;
const AudioTrack &operator=(const AudioTrack &rhs) MOZ_DELETE;
};
struct VideoTrack : public Track
@ -203,6 +225,11 @@ private:
nsIntSize mFrameSize;
nsIntRect mPictureRect;
gfx::IntRect mRelativePictureRect;
private:
// Forbidden
VideoTrack(const VideoTrack &rhs) MOZ_DELETE;
const VideoTrack &operator=(const VideoTrack &rhs) MOZ_DELETE;
};
struct CodecBufferInfo
@ -217,6 +244,101 @@ private:
uint32_t mFlags;
};
class SignalObject
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SignalObject)
SignalObject(const char* aName);
~SignalObject();
void Wait();
void Signal();
private:
// Forbidden
SignalObject() MOZ_DELETE;
SignalObject(const SignalObject &rhs) MOZ_DELETE;
const SignalObject &operator=(const SignalObject &rhs) MOZ_DELETE;
Monitor mMonitor;
bool mSignaled;
};
class ParseCachedDataRunnable : public nsRunnable
{
public:
ParseCachedDataRunnable(nsRefPtr<MediaCodecReader> aReader,
const char* aBuffer,
uint32_t aLength,
int64_t aOffset,
nsRefPtr<SignalObject> aSignal);
NS_IMETHOD Run() MOZ_OVERRIDE;
private:
// Forbidden
ParseCachedDataRunnable() MOZ_DELETE;
ParseCachedDataRunnable(const ParseCachedDataRunnable &rhs) MOZ_DELETE;
const ParseCachedDataRunnable &operator=(const ParseCachedDataRunnable &rhs) MOZ_DELETE;
nsRefPtr<MediaCodecReader> mReader;
nsAutoArrayPtr<const char> mBuffer;
uint32_t mLength;
int64_t mOffset;
nsRefPtr<SignalObject> mSignal;
};
friend class ParseCachedDataRunnable;
class ProcessCachedDataTask : public Task
{
public:
ProcessCachedDataTask(nsRefPtr<MediaCodecReader> aReader,
int64_t aOffset);
void Run() MOZ_OVERRIDE;
private:
// Forbidden
ProcessCachedDataTask() MOZ_DELETE;
ProcessCachedDataTask(const ProcessCachedDataTask &rhs) MOZ_DELETE;
const ProcessCachedDataTask &operator=(const ProcessCachedDataTask &rhs) MOZ_DELETE;
nsRefPtr<MediaCodecReader> mReader;
int64_t mOffset;
};
friend class ProcessCachedDataTask;
// This class is used to keep one reference count of T in it. And this class
// can make sure the stored reference count will be released on the dispatched
// thread. By using this class properly (ex. passing the pointer into this
// runnable first, then releasing the original pointer held by ourselves, and
// then dispatching this runnable onto the desired thread), we can avoid
// running the destructor of the referenced object on any other threads
// unexpectedly before this runnable has been executed.
template<class T>
class ReferenceKeeperRunnable : public nsRunnable
{
public:
ReferenceKeeperRunnable(nsRefPtr<T> aPointer)
: mPointer(aPointer)
{
}
NS_IMETHOD Run() MOZ_OVERRIDE
{
mPointer = nullptr;
return NS_OK;
}
private:
// Forbidden
ReferenceKeeperRunnable() MOZ_DELETE;
ReferenceKeeperRunnable(const ReferenceKeeperRunnable &rhs) MOZ_DELETE;
const ReferenceKeeperRunnable &operator=(const ReferenceKeeperRunnable &rhs) MOZ_DELETE;
nsRefPtr<T> mPointer;
};
// Forbidden
MediaCodecReader() MOZ_DELETE;
const MediaCodecReader& operator=(const MediaCodecReader& rhs) MOZ_DELETE;
@ -260,6 +382,8 @@ private:
mAudioTrack.mTaskQueue);
}
bool TriggerIncrementalParser();
bool UpdateDuration();
bool UpdateAudioInfo();
bool UpdateVideoInfo();
@ -275,10 +399,17 @@ private:
uint8_t* GetColorConverterBuffer(int32_t aWidth, int32_t aHeight);
void ClearColorConverterBuffer();
int64_t ProcessCachedData(int64_t aOffset,
nsRefPtr<SignalObject> aSignal);
bool ParseDataSegment(const char* aBuffer,
uint32_t aLength,
int64_t aOffset);
android::sp<MessageHandler> mHandler;
android::sp<VideoResourceListener> mVideoListener;
android::sp<android::ALooper> mLooper;
android::sp<android::MetaData> mMetaData;
// media tracks
AudioTrack mAudioTrack;
@ -289,6 +420,13 @@ private:
android::I420ColorConverterHelper mColorConverter;
nsAutoArrayPtr<uint8_t> mColorConverterBuffer;
size_t mColorConverterBufferSize;
// incremental parser
Monitor mParserMonitor;
bool mParseDataFromCache;
int64_t mNextParserPosition;
int64_t mParsedDataLength;
nsAutoPtr<MP3FrameParser> mMP3FrameParser;
};
} // namespace mozilla

View File

@ -18,7 +18,7 @@ namespace dom {
class MediaStreamAudioSourceNodeEngine : public AudioNodeEngine
{
public:
MediaStreamAudioSourceNodeEngine(AudioNode* aNode)
explicit MediaStreamAudioSourceNodeEngine(AudioNode* aNode)
: AudioNodeEngine(aNode), mEnabled(false) {}
bool IsEnabled() const { return mEnabled; }

View File

@ -83,6 +83,11 @@ protected:
class MediaEngineSource : public nsISupports
{
public:
// code inside webrtc.org assumes these sizes; don't use anything smaller
// without verifying it's ok
static const unsigned int kMaxDeviceNameLength = 128;
static const unsigned int kMaxUniqueIdLength = 256;
virtual ~MediaEngineSource() {}
/* Populate the human readable name of this device in the nsAString */

View File

@ -225,10 +225,8 @@ MediaEngineWebRTC::EnumerateVideoDevices(MediaSourceType aMediaSource,
}
for (int i = 0; i < num; i++) {
const unsigned int kMaxDeviceNameLength = 128; // XXX FIX!
const unsigned int kMaxUniqueIdLength = 256;
char deviceName[kMaxDeviceNameLength];
char uniqueId[kMaxUniqueIdLength];
char deviceName[MediaEngineSource::kMaxDeviceNameLength];
char uniqueId[MediaEngineSource::kMaxUniqueIdLength];
// paranoia
deviceName[0] = '\0';
@ -246,10 +244,12 @@ MediaEngineWebRTC::EnumerateVideoDevices(MediaSourceType aMediaSource,
LOG((" Capture Device Index %d, Name %s", i, deviceName));
webrtc::CaptureCapability cap;
int numCaps = ptrViECapture->NumberOfCapabilities(uniqueId, kMaxUniqueIdLength);
int numCaps = ptrViECapture->NumberOfCapabilities(uniqueId,
MediaEngineSource::kMaxUniqueIdLength);
LOG(("Number of Capabilities %d", numCaps));
for (int j = 0; j < numCaps; j++) {
if (ptrViECapture->GetCaptureCapability(uniqueId, kMaxUniqueIdLength,
if (ptrViECapture->GetCaptureCapability(uniqueId,
MediaEngineSource::kMaxUniqueIdLength,
j, cap ) != 0 ) {
break;
}

View File

@ -220,9 +220,6 @@ protected:
~MediaEngineWebRTCVideoSource() { Shutdown(); }
private:
static const unsigned int KMaxDeviceNameLength = 128;
static const unsigned int KMaxUniqueIdLength = 256;
// Initialize the needed Video engine interfaces.
void Init();
void Shutdown();
@ -350,9 +347,6 @@ protected:
int mSamples;
private:
static const unsigned int KMaxDeviceNameLength = 128;
static const unsigned int KMaxUniqueIdLength = 256;
void Init();
void Shutdown();

View File

@ -218,7 +218,7 @@ MediaEngineWebRTCVideoSource::ChooseCapability(
return GuessCapability(aConstraints, aPrefs);
#else
NS_ConvertUTF16toUTF8 uniqueId(mUniqueId);
int num = mViECapture->NumberOfCapabilities(uniqueId.get(), KMaxUniqueIdLength);
int num = mViECapture->NumberOfCapabilities(uniqueId.get(), kMaxUniqueIdLength);
if (num <= 0) {
// Mac doesn't support capabilities.
return GuessCapability(aConstraints, aPrefs);
@ -240,7 +240,7 @@ MediaEngineWebRTCVideoSource::ChooseCapability(
for (uint32_t i = 0; i < candidateSet.Length();) {
webrtc::CaptureCapability cap;
mViECapture->GetCaptureCapability(uniqueId.get(), KMaxUniqueIdLength,
mViECapture->GetCaptureCapability(uniqueId.get(), kMaxUniqueIdLength,
candidateSet[i], cap);
if (!SatisfyConstraintSet(aConstraints.mRequired, cap)) {
candidateSet.RemoveElementAt(i);
@ -260,7 +260,7 @@ MediaEngineWebRTCVideoSource::ChooseCapability(
SourceSet rejects;
for (uint32_t j = 0; j < candidateSet.Length();) {
webrtc::CaptureCapability cap;
mViECapture->GetCaptureCapability(uniqueId.get(), KMaxUniqueIdLength,
mViECapture->GetCaptureCapability(uniqueId.get(), kMaxUniqueIdLength,
candidateSet[j], cap);
if (!SatisfyConstraintSet(array[i], cap)) {
rejects.AppendElement(candidateSet[j]);
@ -288,7 +288,7 @@ MediaEngineWebRTCVideoSource::ChooseCapability(
bool higher = true;
for (uint32_t i = 0; i < candidateSet.Length(); i++) {
mViECapture->GetCaptureCapability(NS_ConvertUTF16toUTF8(mUniqueId).get(),
KMaxUniqueIdLength, candidateSet[i], cap);
kMaxUniqueIdLength, candidateSet[i], cap);
if (higher) {
if (i == 0 ||
(mCapability.width > cap.width && mCapability.height > cap.height)) {
@ -451,7 +451,7 @@ MediaEngineWebRTCVideoSource::Allocate(const VideoTrackConstraintsN &aConstraint
ChooseCapability(aConstraints, aPrefs);
if (mViECapture->AllocateCaptureDevice(NS_ConvertUTF16toUTF8(mUniqueId).get(),
KMaxUniqueIdLength, mCaptureIndex)) {
kMaxUniqueIdLength, mCaptureIndex)) {
return NS_ERROR_FAILURE;
}
mState = kAllocated;
@ -654,13 +654,11 @@ MediaEngineWebRTCVideoSource::Init()
return;
}
const uint32_t KMaxDeviceNameLength = 128;
const uint32_t KMaxUniqueIdLength = 256;
char deviceName[KMaxDeviceNameLength];
char uniqueId[KMaxUniqueIdLength];
char deviceName[kMaxDeviceNameLength];
char uniqueId[kMaxUniqueIdLength];
if (mViECapture->GetCaptureDevice(mCaptureIndex,
deviceName, KMaxDeviceNameLength,
uniqueId, KMaxUniqueIdLength)) {
deviceName, kMaxDeviceNameLength,
uniqueId, kMaxUniqueIdLength)) {
return;
}
@ -707,15 +705,21 @@ void MediaEngineWebRTCVideoSource::Refresh(int aIndex) {
// Caller looked up this source by uniqueId; since deviceName == uniqueId nothing else changes
#else
// Caller looked up this source by uniqueId, so it shouldn't change
const uint32_t KMaxDeviceNameLength = 128;
char deviceName[KMaxDeviceNameLength];
char deviceName[kMaxDeviceNameLength];
char uniqueId[kMaxUniqueIdLength];
if (mViECapture->GetCaptureDevice(aIndex,
deviceName, KMaxDeviceNameLength,
nullptr, 0)) {
deviceName, sizeof(deviceName),
uniqueId, sizeof(uniqueId))) {
return;
}
CopyUTF8toUTF16(deviceName, mDeviceName);
#ifdef DEBUG
nsString temp;
CopyUTF8toUTF16(uniqueId, temp);
MOZ_ASSERT(temp.Equals(mUniqueId));
#endif
#endif
}

View File

@ -142,10 +142,11 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI, uint32_t aFixup
nsresult rv;
nsAutoCString uriString(aStringURI);
uriString.Trim(" "); // Cleanup the empty spaces that might be on each end.
// Eliminate embedded newlines, which single-line text fields now allow:
uriString.StripChars("\r\n");
// Cleanup the empty spaces that might be on each end:
uriString.Trim(" ");
NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE);
@ -950,7 +951,7 @@ void nsDefaultURIFixup::KeywordURIFixup(const nsACString & aURIString,
(spaceLoc < qMarkLoc || quoteLoc < qMarkLoc)) ||
qMarkLoc == 0)
{
rv = KeywordToURI(aURIString, aPostData,
rv = KeywordToURI(aFixupInfo->mOriginalInput, aPostData,
getter_AddRefs(aFixupInfo->mPreferredURI));
if (NS_SUCCEEDED(rv) && aFixupInfo->mPreferredURI)
{

View File

@ -60,6 +60,14 @@ let testcases = [
[".test", "http://.test/", "http://www..test/", true, true],
["mozilla is amazing", null, null, true, true],
["mozilla ", "http://mozilla/", "http://www.mozilla.com/", true, true],
[" mozilla ", "http://mozilla/", "http://www.mozilla.com/", true, true],
["mozilla \\", null, null, true, true],
["mozilla \\ foo.txt", null, null, true, true],
["mozilla \\\r foo.txt", null, null, true, true],
["mozilla\n", "http://mozilla/", "http://www.mozilla.com/", true, true],
["mozilla \r\n", "http://mozilla/", "http://www.mozilla.com/", true, true],
["moz\r\nfirefox\nos\r", "http://mozfirefoxos/", "http://www.mozfirefoxos.com/", true, true],
["moz\r\n firefox\n", null, null, true, true],
["", null, null, true, true],
["[]", null, null, true, true]
];
@ -74,10 +82,13 @@ if (Services.appinfo.OS.toLowerCase().startsWith("win")) {
testcases.push(["mozilla\\", "http://mozilla\\/", "http://www.mozilla/", true, true]);
}
function sanitize(input) {
return input.replace(/\r|\n/g, "").trim();
}
function run_test() {
for (let [testInput, expectedFixedURI, alternativeURI,
expectKeywordLookup, expectProtocolChange] of testcases) {
testInput = testInput.trim();
for (let flags of flagInputs) {
let info;
let fixupURIOnly = null;
@ -121,7 +132,7 @@ function run_test() {
// Check the preferred URI
if (couldDoKeywordLookup && expectKeywordLookup) {
let urlparamInput = encodeURIComponent(testInput).replace("%20", "+", "g");
let urlparamInput = encodeURIComponent(sanitize(testInput)).replace("%20", "+", "g");
let searchURL = kSearchEngineURL.replace("{searchTerms}", urlparamInput);
do_check_eq(info.preferredURI.spec, searchURL);
} else {
@ -129,7 +140,7 @@ function run_test() {
// the fixed URI should be preferred:
do_check_eq(info.preferredURI.spec, info.fixedURI.spec);
}
do_check_eq(testInput, info.originalInput);
do_check_eq(sanitize(testInput), info.originalInput);
}
}
}

View File

@ -39,7 +39,7 @@ public:
return activity.forget();
}
Activity(nsPIDOMWindow* aWindow);
explicit Activity(nsPIDOMWindow* aWindow);
protected:
nsresult Initialize(nsPIDOMWindow* aWindow,

View File

@ -18,7 +18,7 @@ namespace dom {
class AnimationEffect MOZ_FINAL : public nsWrapperCache
{
public:
AnimationEffect(Animation* aAnimation)
explicit AnimationEffect(Animation* aAnimation)
: mAnimation(aAnimation)
{
SetIsDOMBinding();

View File

@ -54,7 +54,7 @@ class ArchiveReaderEvent : public nsRunnable
public:
NS_DECL_NSIRUNNABLE
ArchiveReaderEvent(ArchiveReader* aArchiveReader);
explicit ArchiveReaderEvent(ArchiveReader* aArchiveReader);
protected:
virtual ~ArchiveReaderEvent();

View File

@ -23,8 +23,8 @@ class ArchiveRequestEvent : public nsRunnable
public:
NS_DECL_NSIRUNNABLE
ArchiveRequestEvent(ArchiveRequest* request)
: mRequest(request)
explicit ArchiveRequestEvent(ArchiveRequest* aRequest)
: mRequest(aRequest)
{
MOZ_COUNT_CTOR(ArchiveRequestEvent);
}

View File

@ -2670,48 +2670,23 @@ nsDOMWindowUtils::SetAsyncScrollOffset(nsIDOMNode* aNode,
if (!element) {
return NS_ERROR_INVALID_ARG;
}
nsIFrame* frame = element->GetPrimaryFrame();
if (!frame) {
return NS_ERROR_UNEXPECTED;
}
nsIScrollableFrame* scrollable = do_QueryFrame(frame);
nsPresContext* presContext = frame->PresContext();
nsIFrame* rootScrollFrame = presContext->PresShell()->GetRootScrollFrame();
if (!scrollable) {
if (rootScrollFrame && rootScrollFrame->GetContent() == element) {
frame = rootScrollFrame;
scrollable = do_QueryFrame(frame);
}
}
if (!scrollable) {
return NS_ERROR_UNEXPECTED;
}
Layer* layer = FrameLayerBuilder::GetDedicatedLayer(scrollable->GetScrolledFrame(),
nsDisplayItem::TYPE_SCROLL_LAYER);
if (!layer) {
if (rootScrollFrame == frame && !presContext->GetParentPresContext()) {
nsIWidget* widget = GetWidget();
if (widget) {
LayerManager* manager = widget->GetLayerManager();
if (manager) {
layer = manager->GetRoot();
}
}
}
if (!layer) {
return NS_ERROR_UNEXPECTED;
}
}
FrameMetrics::ViewID viewId;
if (!nsLayoutUtils::FindIDFor(element, &viewId)) {
return NS_ERROR_UNEXPECTED;
}
ShadowLayerForwarder* forwarder = layer->Manager()->AsShadowForwarder();
nsIWidget* widget = GetWidget();
if (!widget) {
return NS_ERROR_FAILURE;
}
LayerManager* manager = widget->GetLayerManager();
if (!manager) {
return NS_ERROR_FAILURE;
}
ShadowLayerForwarder* forwarder = manager->AsShadowForwarder();
if (!forwarder || !forwarder->HasShadowManager()) {
return NS_ERROR_UNEXPECTED;
}
forwarder->GetShadowManager()->SendSetAsyncScrollOffset(
layer->AsShadowableLayer()->GetShadow(), viewId, aX, aY);
forwarder->GetShadowManager()->SendSetAsyncScrollOffset(viewId, aX, aY);
return NS_OK;
}

View File

@ -14544,7 +14544,7 @@ class CGEventClass(CGBindingImplClass):
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(${nativeType}, ${parentType})
protected:
virtual ~${nativeType}();
${nativeType}(mozilla::dom::EventTarget* aOwner);
explicit ${nativeType}(mozilla::dom::EventTarget* aOwner);
""",
nativeType=self.descriptor.nativeType.split('::')[-1],

View File

@ -269,7 +269,7 @@ public:
StackFrame)
// aStack must not be null.
JSStackFrame(JS::Handle<JSObject*> aStack);
explicit JSStackFrame(JS::Handle<JSObject*> aStack);
static already_AddRefed<nsIStackFrame>
CreateStack(JSContext* aCx, int32_t aMaxDepth = -1);

View File

@ -10,6 +10,7 @@
#include "mozilla/Assertions.h"
#include "nsTArrayForwardDeclare.h"
#include "mozilla/Move.h"
#include "mozilla/Maybe.h"
class nsCycleCollectionTraversalCallback;
@ -21,73 +22,66 @@ template <typename T>
struct Nullable
{
private:
// mIsNull MUST COME FIRST because otherwise the casting in our array
// conversion operators would shift where it is found in the struct.
bool mIsNull;
T mValue;
Maybe<T> mValue;
public:
Nullable()
: mIsNull(true)
: mValue()
{}
explicit Nullable(T aValue)
: mIsNull(false)
, mValue(aValue)
{}
: mValue()
{
mValue.emplace(aValue);
}
explicit Nullable(Nullable<T>&& aOther)
: mIsNull(aOther.mIsNull)
, mValue(mozilla::Move(aOther.mValue))
: mValue(mozilla::Move(aOther.mValue))
{}
Nullable(const Nullable<T>& aOther)
: mIsNull(aOther.mIsNull)
, mValue(aOther.mValue)
: mValue(aOther.mValue)
{}
void operator=(const Nullable<T>& aOther)
{
mIsNull = aOther.mIsNull;
mValue = aOther.mValue;
}
void SetValue(T aValue) {
mValue = aValue;
mIsNull = false;
mValue.reset();
mValue.emplace(aValue);
}
// For cases when |T| is some type with nontrivial copy behavior, we may want
// to get a reference to our internal copy of T and work with it directly
// instead of relying on the copying version of SetValue().
T& SetValue() {
mIsNull = false;
return mValue;
if (mValue.isNothing()) {
mValue.emplace();
}
return mValue.ref();
}
void SetNull() {
mIsNull = true;
mValue.reset();
}
const T& Value() const {
MOZ_ASSERT(!mIsNull);
return mValue;
return mValue.ref();
}
T& Value() {
MOZ_ASSERT(!mIsNull);
return mValue;
return mValue.ref();
}
bool IsNull() const {
return mIsNull;
return mValue.isNothing();
}
bool Equals(const Nullable<T>& aOtherNullable) const
{
return (mIsNull && aOtherNullable.mIsNull) ||
(!mIsNull && !aOtherNullable.mIsNull &&
mValue == aOtherNullable.mValue);
return mValue == aOtherNullable.mValue;
}
bool operator==(const Nullable<T>& aOtherNullable) const
@ -99,23 +93,6 @@ public:
{
return !Equals(aOtherNullable);
}
// Make it possible to use a const Nullable of an array type with other
// array types.
template<typename U>
operator const Nullable< nsTArray<U> >&() const {
// Make sure that T is ok to reinterpret to nsTArray<U>
const nsTArray<U>& arr = mValue;
(void)arr;
return *reinterpret_cast<const Nullable< nsTArray<U> >*>(this);
}
template<typename U>
operator const Nullable< FallibleTArray<U> >&() const {
// Make sure that T is ok to reinterpret to FallibleTArray<U>
const FallibleTArray<U>& arr = mValue;
(void)arr;
return *reinterpret_cast<const Nullable< FallibleTArray<U> >*>(this);
}
};

View File

@ -27,7 +27,7 @@ class TestCImplementedInterface2 : public nsISupports,
public nsWrapperCache
{
public:
TestCImplementedInterface2(nsPIDOMWindow* aParent)
explicit TestCImplementedInterface2(nsPIDOMWindow* aParent)
{}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestCImplementedInterface2)

View File

@ -11,7 +11,7 @@
class RwLockAutoEnterRead
{
public:
RwLockAutoEnterRead(PRRWLock* aRwLock)
explicit RwLockAutoEnterRead(PRRWLock* aRwLock)
: mRwLock(aRwLock)
{
MOZ_ASSERT(mRwLock);
@ -30,7 +30,7 @@ protected:
class RwLockAutoEnterWrite
{
public:
RwLockAutoEnterWrite(PRRWLock* aRwLock)
explicit RwLockAutoEnterWrite(PRRWLock* aRwLock)
: mRwLock(aRwLock)
{
MOZ_ASSERT(mRwLock);

View File

@ -30,7 +30,7 @@ class RecorderProfileManager;
class CameraControlImpl : public ICameraControl
{
public:
CameraControlImpl(uint32_t aCameraId);
explicit CameraControlImpl(uint32_t aCameraId);
virtual void AddListener(CameraControlListener* aListener) MOZ_OVERRIDE;
virtual void RemoveListener(CameraControlListener* aListener) MOZ_OVERRIDE;

View File

@ -23,7 +23,7 @@ class CameraPreviewMediaStream : public MediaStream
typedef mozilla::layers::Image Image;
public:
CameraPreviewMediaStream(DOMMediaStream* aWrapper);
explicit CameraPreviewMediaStream(DOMMediaStream* aWrapper);
virtual void AddAudioOutput(void* aKey) MOZ_OVERRIDE;
virtual void SetAudioOutputVolume(void* aKey, float aVolume) MOZ_OVERRIDE;

View File

@ -262,7 +262,7 @@ public:
nsresult GetJsObject(JSContext* aCx, JSObject** aObject) const;
protected:
RecorderProfileManager(uint32_t aCameraId);
explicit RecorderProfileManager(uint32_t aCameraId);
virtual ~RecorderProfileManager();
uint32_t mCameraId;

View File

@ -40,7 +40,7 @@ public:
// Great Renaming proposed in bug 983177.
static bool HasSupport(JSContext* aCx, JSObject* aGlobal);
CameraCapabilities(nsPIDOMWindow* aWindow);
explicit CameraCapabilities(nsPIDOMWindow* aWindow);
// Populate the camera capabilities interface from the specific
// camera control object.

View File

@ -81,7 +81,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
StartRecordingHelper(nsDOMCameraControl* aDOMCameraControl)
explicit StartRecordingHelper(nsDOMCameraControl* aDOMCameraControl)
: mDOMCameraControl(aDOMCameraControl)
{
MOZ_COUNT_CTOR(StartRecordingHelper);

View File

@ -145,7 +145,7 @@ protected:
NS_INLINE_DECL_REFCOUNTING(DOMCameraConfiguration)
DOMCameraConfiguration();
DOMCameraConfiguration(const dom::CameraConfiguration& aConfiguration);
explicit DOMCameraConfiguration(const dom::CameraConfiguration& aConfiguration);
// Additional configuration options that aren't exposed to the DOM
uint32_t mMaxFocusAreas;

View File

@ -31,7 +31,7 @@ DOMCameraControlListener::~DOMCameraControlListener()
class DOMCameraControlListener::DOMCallback : public nsRunnable
{
public:
DOMCallback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl)
explicit DOMCallback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl)
: mDOMCameraControl(aDOMCameraControl)
{
MOZ_COUNT_CTOR(DOMCameraControlListener::DOMCallback);
@ -276,7 +276,7 @@ DOMCameraControlListener::OnShutter()
class Callback : public DOMCallback
{
public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl)
explicit Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl)
: DOMCallback(aDOMCameraControl)
{ }

View File

@ -22,7 +22,7 @@ namespace mozilla {
class FallbackCameraControl : public CameraControlImpl
{
public:
FallbackCameraControl(uint32_t aCameraId) : CameraControlImpl(aCameraId) { }
explicit FallbackCameraControl(uint32_t aCameraId) : CameraControlImpl(aCameraId) { }
virtual nsresult Set(uint32_t aKey, const nsAString& aValue) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; }
virtual nsresult Get(uint32_t aKey, nsAString& aValue) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; }

View File

@ -240,7 +240,7 @@ protected:
class ICameraControlParameterSetAutoEnter
{
public:
ICameraControlParameterSetAutoEnter(ICameraControl* aCameraControl)
explicit ICameraControlParameterSetAutoEnter(ICameraControl* aCameraControl)
: mCameraControl(aCameraControl)
{
mCameraControl->BeginBatchParameterSet();

View File

@ -35,7 +35,7 @@ struct ImageCacheEntryData {
, mSourceSurface(aOther.mSourceSurface)
, mSize(aOther.mSize)
{}
ImageCacheEntryData(const ImageCacheKey& aKey)
explicit ImageCacheEntryData(const ImageCacheKey& aKey)
: mImage(aKey.mImage)
, mILC(nullptr)
, mCanvas(aKey.mCanvas)
@ -61,8 +61,8 @@ public:
typedef ImageCacheKey KeyType;
typedef const ImageCacheKey* KeyTypePointer;
ImageCacheEntry(const KeyType *key) :
mData(new ImageCacheEntryData(*key)) {}
explicit ImageCacheEntry(const KeyType* aKey) :
mData(new ImageCacheEntryData(*aKey)) {}
ImageCacheEntry(const ImageCacheEntry &toCopy) :
mData(new ImageCacheEntryData(*toCopy.mData)) {}
~ImageCacheEntry() {}
@ -115,7 +115,7 @@ class ImageCacheObserver MOZ_FINAL : public nsIObserver
public:
NS_DECL_ISUPPORTS
ImageCacheObserver(ImageCache* aImageCache)
explicit ImageCacheObserver(ImageCache* aImageCache)
: mImageCache(aImageCache)
{
RegisterMemoryPressureEvent();

View File

@ -298,7 +298,7 @@ class AdjustedTarget
public:
typedef CanvasRenderingContext2D::ContextState ContextState;
AdjustedTarget(CanvasRenderingContext2D *ctx,
explicit AdjustedTarget(CanvasRenderingContext2D* ctx,
mgfx::Rect *aBounds = nullptr)
: mCtx(nullptr)
{
@ -438,7 +438,7 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CanvasPattern, mContext)
class CanvasRenderingContext2DUserData : public LayerUserData {
public:
CanvasRenderingContext2DUserData(CanvasRenderingContext2D *aContext)
explicit CanvasRenderingContext2DUserData(CanvasRenderingContext2D *aContext)
: mContext(aContext)
{
aContext->mUserDatas.AppendElement(this);

View File

@ -15,7 +15,7 @@ namespace dom {
class TextMetrics MOZ_FINAL : public NonRefcountedDOMObject
{
public:
TextMetrics(float w) : width(w)
explicit TextMetrics(float aValue) : width(aValue)
{
MOZ_COUNT_CTOR(TextMetrics);
}

View File

@ -26,7 +26,7 @@ class WebGLBuffer MOZ_FINAL
, public WebGLContextBoundObject
{
public:
WebGLBuffer(WebGLContext *context);
explicit WebGLBuffer(WebGLContext* aContext);
void Delete();

View File

@ -1129,7 +1129,7 @@ namespace mozilla {
class WebGLContextUserData : public LayerUserData {
public:
WebGLContextUserData(HTMLCanvasElement *aContent)
explicit WebGLContextUserData(HTMLCanvasElement* aContent)
: mContent(aContent)
{}
@ -1510,8 +1510,8 @@ class UpdateContextLossStatusTask : public nsRunnable
nsRefPtr<WebGLContext> mContext;
public:
UpdateContextLossStatusTask(WebGLContext* context)
: mContext(context)
explicit UpdateContextLossStatusTask(WebGLContext* aContext)
: mContext(aContext)
{
}

View File

@ -30,7 +30,7 @@ class WebGLContextLossHandler
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(WebGLContextLossHandler)
WebGLContextLossHandler(WebGLContext* webgl);
explicit WebGLContextLossHandler(WebGLContext* aWebgl);
~WebGLContextLossHandler();
void RunTimer();

View File

@ -36,7 +36,7 @@ struct GLComponents
: mComponents(0)
{ }
GLComponents(GLenum format);
explicit GLComponents(GLenum aFormat);
// Returns true iff other has all (or more) of
// the components present in this GLComponents

View File

@ -144,8 +144,8 @@ public:
// Constructor. Takes a reference to the WebGLElementArrayCache that is to be
// the parent. Does not initialize the tree. Should be followed by a call
// to Update() to attempt initializing the tree.
WebGLElementArrayCacheTree(WebGLElementArrayCache& p)
: mParent(p)
explicit WebGLElementArrayCacheTree(WebGLElementArrayCache& aValue)
: mParent(aValue)
{
}

View File

@ -23,7 +23,7 @@ class WebGLExtensionBase
, public WebGLContextBoundObject
{
public:
WebGLExtensionBase(WebGLContext*);
explicit WebGLExtensionBase(WebGLContext* aValue);
WebGLContext *GetParentObject() const {
return Context();
@ -288,7 +288,7 @@ class WebGLExtensionVertexArray
: public WebGLExtensionBase
{
public:
WebGLExtensionVertexArray(WebGLContext*);
explicit WebGLExtensionVertexArray(WebGLContext* aValue);
virtual ~WebGLExtensionVertexArray();
already_AddRefed<WebGLVertexArray> CreateVertexArrayOES();
@ -305,7 +305,7 @@ class WebGLExtensionInstancedArrays
: public WebGLExtensionBase
{
public:
WebGLExtensionInstancedArrays(WebGLContext* context);
explicit WebGLExtensionInstancedArrays(WebGLContext* aContext);
virtual ~WebGLExtensionInstancedArrays();
void DrawArraysInstancedANGLE(GLenum mode, GLint first,
@ -324,7 +324,7 @@ class WebGLExtensionBlendMinMax
: public WebGLExtensionBase
{
public:
WebGLExtensionBlendMinMax(WebGLContext*);
explicit WebGLExtensionBlendMinMax(WebGLContext* aValue);
virtual ~WebGLExtensionBlendMinMax();
static bool IsSupported(const WebGLContext*);

View File

@ -31,7 +31,7 @@ class WebGLProgram MOZ_FINAL
, public WebGLContextBoundObject
{
public:
WebGLProgram(WebGLContext *context);
explicit WebGLProgram(WebGLContext* aContext);
void Delete();

View File

@ -27,7 +27,7 @@ public:
// -------------------------------------------------------------------------
// CONSTRUCTOR
WebGLQuery(WebGLContext *context);
explicit WebGLQuery(WebGLContext* aContext);
// -------------------------------------------------------------------------
// MEMBER FUNCTIONS

View File

@ -35,7 +35,7 @@ class WebGLTexture MOZ_FINAL
, public WebGLFramebufferAttachable
{
public:
WebGLTexture(WebGLContext *context);
explicit WebGLTexture(WebGLContext* aContext);
void Delete();

View File

@ -15,7 +15,7 @@ struct WebGLUniformInfo {
bool isArray;
ShDataType type;
WebGLUniformInfo(uint32_t s = 0, bool a = false, ShDataType t = SH_NONE)
explicit WebGLUniformInfo(uint32_t s = 0, bool a = false, ShDataType t = SH_NONE)
: arraySize(s), isArray(a), type(t) {}
int ElementSize() const {

View File

@ -58,13 +58,13 @@ namespace mozilla {
// implementations not expecting characters outside the GLSL ES set.
class StripComments {
public:
StripComments(const nsAString& str)
explicit StripComments(const nsAString& aStr)
: m_parseState(BeginningOfLine)
, m_end(str.EndReading())
, m_current(str.BeginReading())
, m_end(aStr.EndReading())
, m_current(aStr.BeginReading())
, m_position(0)
{
m_result.SetLength(str.Length());
m_result.SetLength(aStr.Length());
parse();
}

View File

@ -74,7 +74,7 @@ public:
// -----------------------------------------------------------------------------
// PROTECTED
protected:
WebGLVertexArray(WebGLContext* context);
explicit WebGLVertexArray(WebGLContext* aContext);
virtual ~WebGLVertexArray() {
MOZ_ASSERT(IsDeleted());

View File

@ -19,8 +19,8 @@ public:
virtual void GenVertexArray() MOZ_OVERRIDE { };
private:
WebGLVertexArrayFake(WebGLContext *context)
: WebGLVertexArray(context)
explicit WebGLVertexArrayFake(WebGLContext* aContext)
: WebGLVertexArray(aContext)
{ }
~WebGLVertexArrayFake() {

View File

@ -19,8 +19,8 @@ public:
virtual void GenVertexArray() MOZ_OVERRIDE;
private:
WebGLVertexArrayGL(WebGLContext* context)
: WebGLVertexArray(context)
explicit WebGLVertexArrayGL(WebGLContext* aContext)
: WebGLVertexArray(aContext)
{ }
~WebGLVertexArrayGL() {

View File

@ -24,7 +24,7 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CryptoKeyPair)
public:
CryptoKeyPair(nsIGlobalObject* aGlobal)
explicit CryptoKeyPair(nsIGlobalObject* aGlobal)
: mGlobal(aGlobal)
, mPublicKey(new CryptoKey(aGlobal))
, mPrivateKey(new CryptoKey(aGlobal))

View File

@ -110,7 +110,7 @@ enum TelemetryAlgorithm {
class ClearException
{
public:
ClearException(JSContext* aCx)
explicit ClearException(JSContext* aCx)
: mCx(aCx)
{}
@ -379,8 +379,8 @@ WebCryptoTask::CallCallback(nsresult rv)
class FailureTask : public WebCryptoTask
{
public:
FailureTask(nsresult rv) {
mEarlyRv = rv;
explicit FailureTask(nsresult aRv) {
mEarlyRv = aRv;
}
};

View File

@ -31,7 +31,7 @@ class VersionChangeListener MOZ_FINAL : public nsIDOMEventListener
public:
NS_DECL_ISUPPORTS
VersionChangeListener(IDBDatabase* aDatabase)
explicit VersionChangeListener(IDBDatabase* aDatabase)
: mDatabase(aDatabase)
{}

View File

@ -1790,7 +1790,7 @@ public:
NS_FORWARD_NSICONTENTPERMISSIONREQUEST(mCursor->);
DeviceStorageCursorRequest(nsDOMDeviceStorageCursor* aCursor)
explicit DeviceStorageCursorRequest(nsDOMDeviceStorageCursor* aCursor)
: mCursor(aCursor) { }
private:

View File

@ -34,7 +34,7 @@ enum LineBreakType
class MOZ_STACK_CLASS ContentEventHandler
{
public:
ContentEventHandler(nsPresContext* aPresContext);
explicit ContentEventHandler(nsPresContext* aPresContext);
// NS_QUERY_SELECTED_TEXT event handler
nsresult OnQuerySelectedText(WidgetQueryContentEvent* aEvent);

View File

@ -71,7 +71,7 @@ private:
class EventTargetChainItem
{
private:
EventTargetChainItem(EventTarget* aTarget);
explicit EventTargetChainItem(EventTarget* aTarget);
public:
EventTargetChainItem()
: mFlags(0)

View File

@ -3544,7 +3544,7 @@ EventStateManager::SetCursor(int32_t aCursor, imgIContainer* aContainer,
class MOZ_STACK_CLASS ESMEventCB : public EventDispatchingCallback
{
public:
ESMEventCB(nsIContent* aTarget) : mTarget(aTarget) {}
explicit ESMEventCB(nsIContent* aTarget) : mTarget(aTarget) {}
virtual void HandleEvent(EventChainPostVisitor& aVisitor)
{

View File

@ -386,7 +386,7 @@ IMEContentObserver::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
class PositionChangeEvent MOZ_FINAL : public nsRunnable
{
public:
PositionChangeEvent(IMEContentObserver* aDispatcher)
explicit PositionChangeEvent(IMEContentObserver* aDispatcher)
: mDispatcher(aDispatcher)
{
MOZ_ASSERT(mDispatcher);
@ -1037,7 +1037,7 @@ IMEContentObserver::MaybeNotifyIMEOfPositionChange()
class AsyncMergeableNotificationsFlusher : public nsRunnable
{
public:
AsyncMergeableNotificationsFlusher(IMEContentObserver* aIMEContentObserver)
explicit AsyncMergeableNotificationsFlusher(IMEContentObserver* aIMEContentObserver)
: mIMEContentObserver(aIMEContentObserver)
{
MOZ_ASSERT(mIMEContentObserver);

View File

@ -746,7 +746,7 @@ IMEStateManager::GetNewIMEState(nsPresContext* aPresContext,
// Helper class, used for IME enabled state change notification
class IMEEnabledStateChangedEvent : public nsRunnable {
public:
IMEEnabledStateChangedEvent(uint32_t aState)
explicit IMEEnabledStateChangedEvent(uint32_t aState)
: mState(aState)
{
}

View File

@ -21,7 +21,7 @@ class PaintRequest MOZ_FINAL : public nsIDOMPaintRequest
, public nsWrapperCache
{
public:
PaintRequest(nsIDOMEvent* aParent)
explicit PaintRequest(nsIDOMEvent* aParent)
: mParent(aParent)
{
mRequest.mFlags = 0;
@ -59,7 +59,7 @@ class PaintRequestList MOZ_FINAL : public nsISupports,
public nsWrapperCache
{
public:
PaintRequestList(nsIDOMEvent *aParent) : mParent(aParent)
explicit PaintRequestList(nsIDOMEvent *aParent) : mParent(aParent)
{
SetIsDOMBinding();
}

View File

@ -33,7 +33,7 @@ public:
AsyncWork(nsIRequestObserver* aObserver, nsISupports* aCtxt);
protected:
AsyncHelper(nsISupports* aStream)
explicit AsyncHelper(nsISupports* aStream)
: mStream(aStream),
mStatus(NS_OK)
{ }

View File

@ -152,7 +152,7 @@ private:
class AsyncFlusher : public AsyncHelper
{
public:
AsyncFlusher(nsISupports* aStream)
explicit AsyncFlusher(nsISupports* aStream)
: AsyncHelper(aStream)
{ }
protected:

View File

@ -256,7 +256,7 @@ public:
NS_DECL_NSIRUNNABLE
private:
FinishHelper(FileHandleBase* aFileHandle);
explicit FinishHelper(FileHandleBase* aFileHandle);
~FinishHelper()
{ }

View File

@ -92,7 +92,7 @@ private:
private:
inline
FileHandleQueue(FileHandleBase* aFileHandle);
explicit FileHandleQueue(FileHandleBase* aFileHandle);
~FileHandleQueue();

View File

@ -50,7 +50,7 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIRUNNABLE
CloseRunnable(FileHelper* aFileHelper)
explicit CloseRunnable(FileHelper* aFileHelper)
: mFileHelper(aFileHelper)
{ }
@ -66,7 +66,7 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIRUNNABLE
DestroyRunnable(FileHelper* aFileHelper)
explicit DestroyRunnable(FileHelper* aFileHelper)
: mFileHelper(aFileHelper)
{ }

View File

@ -150,7 +150,7 @@ CreateFileTask::Work()
class AutoClose
{
public:
AutoClose(nsIOutputStream* aStream)
explicit AutoClose(nsIOutputStream* aStream)
: mStream(aStream)
{
MOZ_ASSERT(aStream);

View File

@ -41,7 +41,7 @@ class MOZ_STACK_CLASS TransactionPoolEventTarget : public StackBasedEventTarget
public:
NS_DECL_NSIEVENTTARGET
TransactionPoolEventTarget(IDBTransaction* aTransaction)
explicit TransactionPoolEventTarget(IDBTransaction* aTransaction)
: mTransaction(aTransaction)
{ }

View File

@ -47,7 +47,7 @@ public:
}
protected:
HelperBase(IDBRequest* aRequest)
explicit HelperBase(IDBRequest* aRequest)
: mRequest(aRequest)
{ }

View File

@ -43,7 +43,7 @@ namespace {
class CursorHelper : public AsyncConnectionHelper
{
public:
CursorHelper(IDBCursor* aCursor)
explicit CursorHelper(IDBCursor* aCursor)
: AsyncConnectionHelper(aCursor->Transaction(), aCursor->Request()),
mCursor(aCursor), mActor(nullptr)
{

View File

@ -52,7 +52,7 @@ namespace {
class NoRequestDatabaseHelper : public AsyncConnectionHelper
{
public:
NoRequestDatabaseHelper(IDBTransaction* aTransaction)
explicit NoRequestDatabaseHelper(IDBTransaction* aTransaction)
: AsyncConnectionHelper(aTransaction, nullptr)
{
NS_ASSERTION(IndexedDatabaseManager::IsMainProcess(), "Wrong process!");

View File

@ -134,7 +134,7 @@ public:
}
protected:
IDBVersionChangeEvent(mozilla::dom::EventTarget* aOwner)
explicit IDBVersionChangeEvent(mozilla::dom::EventTarget* aOwner)
: Event(aOwner, nullptr, nullptr)
{
SetIsDOMBinding();

View File

@ -65,7 +65,7 @@ public:
IMPL_EVENT_HANDLER(progress)
private:
IDBFileRequest(nsPIDOMWindow* aWindow);
explicit IDBFileRequest(nsPIDOMWindow* aWindow);
~IDBFileRequest();
void

View File

@ -456,7 +456,7 @@ TransactionThreadPool::AbortTransactionsForDatabase(IDBDatabase* aDatabase)
struct MOZ_STACK_CLASS TransactionSearchInfo
{
TransactionSearchInfo(nsIOfflineStorage* aDatabase)
explicit TransactionSearchInfo(nsIOfflineStorage* aDatabase)
: db(aDatabase), found(false)
{
}

View File

@ -62,7 +62,7 @@ protected:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIRUNNABLE
TransactionQueue(IDBTransaction* aTransaction);
explicit TransactionQueue(IDBTransaction* aTransaction);
void Unblock();
@ -84,7 +84,7 @@ protected:
struct TransactionInfo
{
TransactionInfo(IDBTransaction* aTransaction)
explicit TransactionInfo(IDBTransaction* aTransaction)
{
MOZ_COUNT_CTOR(TransactionInfo);

View File

@ -103,7 +103,7 @@ public:
class IPCDeleteDatabaseHelper : public AsyncConnectionHelper
{
public:
IPCDeleteDatabaseHelper(IDBRequest* aRequest)
explicit IPCDeleteDatabaseHelper(IDBRequest* aRequest)
: AsyncConnectionHelper(static_cast<IDBDatabase*>(nullptr), aRequest)
{ }

View File

@ -388,13 +388,27 @@ VideoDevice::VideoDevice(MediaEngineVideoSource* aSource)
mFacingMode = dom::VideoFacingModeEnum::User;
}
#endif // MOZ_B2G_CAMERA
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
// Names are generated. Example: "Camera 0, Facing back, Orientation 90"
//
// See media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/
// webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java
if (mName.Find(NS_LITERAL_STRING("Facing back")) != kNotFound) {
mHasFacingMode = true;
mFacingMode = dom::VideoFacingModeEnum::Environment;
} else if (mName.Find(NS_LITERAL_STRING("Facing front")) != kNotFound) {
mHasFacingMode = true;
mFacingMode = dom::VideoFacingModeEnum::User;
}
#endif // ANDROID
#ifdef XP_MACOSX
// Kludge to test user-facing cameras on OSX.
if (mName.Find(NS_LITERAL_STRING("Face")) != -1) {
mHasFacingMode = true;
mFacingMode = dom::VideoFacingModeEnum::User;
}
#endif
mMediaSource = aSource->GetMediaSource();
}

View File

@ -21,7 +21,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDELETEDMESSAGEINFO
DeletedMessageInfo(const DeletedMessageInfoData& aData);
explicit DeletedMessageInfo(const DeletedMessageInfoData& aData);
DeletedMessageInfo(int32_t* aMessageIds,
uint32_t aMsgCount,

Some files were not shown because too many files have changed in this diff Show More