Bug 986787 - Fix -Wreorder warning and other cleanups in MediaEngineTabeVideoSource.cpp. r=rjesup

This commit is contained in:
Chris Peterson 2014-03-26 00:59:01 -04:00
parent b1f2b0fdbd
commit ced241328f
2 changed files with 10 additions and 17 deletions

View File

@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsGlobalWindow.h"
#include "nsDOMWindowUtils.h"
#include "nsIDOMClientRect.h"
@ -16,6 +20,7 @@
#include "VideoUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
namespace mozilla {
using namespace mozilla::gfx;
@ -23,19 +28,10 @@ using namespace mozilla::gfx;
NS_IMPL_ISUPPORTS1(MediaEngineTabVideoSource, MediaEngineVideoSource)
MediaEngineTabVideoSource::MediaEngineTabVideoSource()
: mName(NS_LITERAL_STRING("&getUserMedia.videoDevice.tabShare;")),
mUuid(NS_LITERAL_STRING("uuid")),
mData(0),
mMonitor("MediaEngineTabVideoSource")
: mMonitor("MediaEngineTabVideoSource")
{
}
MediaEngineTabVideoSource::~MediaEngineTabVideoSource()
{
if (mData)
free(mData);
}
nsresult
MediaEngineTabVideoSource::StartRunnable::Run()
{
@ -111,14 +107,13 @@ MediaEngineTabVideoSource::InitRunnable::Run()
void
MediaEngineTabVideoSource::GetName(nsAString_internal& aName)
{
aName.Assign(mName);
aName.Assign(NS_LITERAL_STRING("&getUserMedia.videoDevice.tabShare;"));
}
void
MediaEngineTabVideoSource::GetUUID(nsAString_internal& aUuid)
{
aUuid.Assign(mUuid);
aUuid.Assign(NS_LITERAL_STRING("uuid"));
}
nsresult
@ -250,7 +245,7 @@ MediaEngineTabVideoSource::Draw() {
nsRefPtr<layers::ImageContainer> container = layers::LayerManager::CreateImageContainer();
nsRefPtr<gfxASurface> surf;
surf = new gfxImageSurface(static_cast<unsigned char*>(mData),
surf = new gfxImageSurface(mData.rwget(),
ThebesIntSize(size), stride, format);
if (surf->CairoStatus() != 0) {
return;

View File

@ -17,7 +17,6 @@ class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventList
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_NSITIMERCALLBACK
MediaEngineTabVideoSource();
~MediaEngineTabVideoSource();
virtual void GetName(nsAString_internal&);
virtual void GetUUID(nsAString_internal&);
@ -56,11 +55,10 @@ private:
int mBufW;
int mBufH;
int mTimePerFrame;
unsigned char *mData;
ScopedFreePtr<unsigned char> mData;
nsCOMPtr<nsIDOMWindow> mWindow;
nsRefPtr<layers::CairoImage> mImage;
nsCOMPtr<nsITimer> mTimer;
nsAutoString mName, mUuid;
Monitor mMonitor;
nsCOMPtr<nsITabSource> mTabSource;
};