Merge m-c to fx-team.

This commit is contained in:
Ryan VanderMeulen 2014-04-15 23:28:51 -04:00
commit eeb2349619
171 changed files with 2226 additions and 948 deletions

View File

@ -597,7 +597,7 @@ PivotContext.prototype = {
while (parent && (parent = parent.parent)) {
ancestry.push(parent);
}
} catch (e) {
} catch (x) {
// A defunct accessible will raise an exception geting parent.
Logger.debug('Failed to get parent:', x);
}

View File

@ -274,7 +274,6 @@ pref("ui.dragThresholdY", 25);
pref("layers.offmainthreadcomposition.enabled", true);
#ifndef MOZ_WIDGET_GONK
pref("dom.ipc.tabs.disabled", true);
pref("layers.acceleration.disabled", true);
pref("layers.offmainthreadcomposition.async-animations", false);
pref("layers.async-video.enabled", false);
#else

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="55bcc2d7e44dc805c24b57d1e783fc26e8a2ee86"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>
@ -128,7 +128,7 @@
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="09485b73629856b21b2ed6073e327ab0e69a1189"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="a3467d423c2ed54f2b4efbc5b47c06af85c3bdc3"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="f8e49f3837230cfbb2d6fbcf239d1f25b57b39a7"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="72e3a520e3c700839f07ba0113fd527b923c3330"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="3b002889eca9e47f77ef10af44619c8c56df069b"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="52c909ccead537f8f9dbf634f3e6639078a8b0bd">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="55bcc2d7e44dc805c24b57d1e783fc26e8a2ee86"/>

View File

@ -1,8 +1,8 @@
{
"config_version": 2,
"tooltool_manifest": "releng-flame.tt",
"mock_target": "mozilla-centos6-i386",
"mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"],
"mock_target": "mozilla-centos6-x86_64",
"mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2"],
"mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
"build_targets": [],
"upload_files": [
@ -30,7 +30,7 @@
"b2g_manifest": "flame.xml",
"b2g_manifest_branch": "master",
"b2g_manifest_intree": true,
"additional_source_tarballs": [],
"additional_source_tarballs": ["backup-flame.tar.xz"],
"gecko_l10n_root": "https://hg.mozilla.org/l10n-central",
"gaia": {
"l10n": {

View File

@ -1,2 +1,7 @@
[
{"size": 169226356,
"digest": "f9456848fd661b8be05d6a30607fad4787bcecfe676b53f9a4074653fdda6a377c961038c866c5d83355e3afd89f1a3bd947a142aeaf7dd7d81b6c376185badd",
"filename": "backup-flame.tar.xz",
"algorithm": "sha512"
}
]

View File

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "c766bc0d49af19f18788ad8ed0542b82db81f1d8",
"revision": "b43fa272b6a254e7b15a79bb7771133a6d950c49",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="8d6c36d74ba9aefbc8c3618fc93dd4907a0dbf5e"/>

View File

@ -1,3 +1,4 @@
. "$topsrcdir/b2g/config/mozconfigs/common"
. $topsrcdir/build/macosx/mozconfig.common
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}

View File

@ -1,3 +1,4 @@
. "$topsrcdir/b2g/config/mozconfigs/common"
. $topsrcdir/build/macosx/mozconfig.common
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d47c0627017ef77b1adf179792c6543a349af72"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="3d4b4b06475d2376bad23ac46da185cd48a68d17"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -753,17 +753,19 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage)
{
nsresult rv;
nsRefPtr<gfxASurface> thebesSurface =
RefPtr<SourceSurface> surface =
aImage->GetFrame(imgIContainer::FRAME_FIRST,
imgIContainer::FLAG_SYNC_DECODE);
NS_ENSURE_TRUE(thebesSurface, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE);
nsRefPtr<gfxImageSurface> thebesImageSurface =
thebesSurface->GetAsReadableARGB32ImageSurface();
NS_ENSURE_TRUE(thebesImageSurface, NS_ERROR_FAILURE);
// For either of the following formats we want to set the biBitCount member
// of the BITMAPINFOHEADER struct to 32, below. For that value the bitmap
// format defines that the A8/X8 WORDs in the bitmap byte stream be ignored
// for the BI_RGB value we use for the biCompression member.
MOZ_ASSERT(surface->GetFormat() == SurfaceFormat::B8G8R8A8 ||
surface->GetFormat() == SurfaceFormat::B8G8R8X8);
RefPtr<DataSourceSurface> dataSurface =
thebesImageSurface->CopyToB8G8R8A8DataSourceSurface();
RefPtr<DataSourceSurface> dataSurface = surface->GetDataSurface();
NS_ENSURE_TRUE(dataSurface, NS_ERROR_FAILURE);
int32_t width = dataSurface->GetSize().width;

View File

@ -229,6 +229,7 @@ LOCAL_INCLUDES += [
'/layout/svg',
'/layout/xul',
'/netwerk/base/src',
'/xpcom/ds',
]
if CONFIG['GNU_CC'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':

View File

@ -124,6 +124,7 @@
#include "nsILineBreaker.h"
#include "nsILoadContext.h"
#include "nsILoadGroup.h"
#include "nsIMemoryReporter.h"
#include "nsIMIMEService.h"
#include "nsINode.h"
#include "nsINodeInfo.h"

View File

@ -100,9 +100,11 @@
#undef free // apparently defined by some windows header, clashing with a free()
// method in SkTypes.h
#ifdef USE_SKIA
#include "SkiaGLGlue.h"
#include "SurfaceStream.h"
#include "SurfaceTypes.h"
#endif
using mozilla::gl::GLContext;
using mozilla::gl::SkiaGLGlue;
@ -900,6 +902,7 @@ CanvasRenderingContext2D::EnsureTarget()
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
#if USE_SKIA
if (glue && glue->GetGrContext() && glue->GetGLContext()) {
mTarget = Factory::CreateDrawTargetSkiaWithGrContext(glue->GetGrContext(), size, format);
if (mTarget) {
@ -909,6 +912,7 @@ CanvasRenderingContext2D::EnsureTarget()
printf_stderr("Failed to create a SkiaGL DrawTarget, falling back to software\n");
}
}
#endif
if (!mTarget) {
mTarget = layerManager->CreateDrawTarget(size, format);
}
@ -4244,12 +4248,14 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasLayer::Data data;
if (mStream) {
#ifdef USE_SKIA
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
if (glue) {
data.mGLContext = glue->GetGLContext();
data.mStream = mStream.get();
}
#endif
} else {
data.mDrawTarget = mTarget;
}
@ -4292,7 +4298,9 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
if (glue) {
canvasLayer->SetPreTransactionCallback(
CanvasRenderingContext2DUserData::PreTransactionCallback, userData);
#if USE_SKIA
data.mGLContext = glue->GetGLContext();
#endif
data.mStream = mStream.get();
data.mTexID = (uint32_t)((uintptr_t)mTarget->GetNativeSurface(NativeSurfaceType::OPENGL_TEXTURE));
}

View File

@ -4674,24 +4674,15 @@ HTMLInputElement::GetValueAsDate(const nsAString& aValue,
return false;
}
uint32_t endOfYearOffset = 0;
for (; NS_IsAsciiDigit(aValue[endOfYearOffset]); ++endOfYearOffset);
uint32_t endOfYearOffset = aValue.Length() - 6;
// The year must be at least 4 digits long.
if (aValue[endOfYearOffset] != '-' || endOfYearOffset < 4) {
if (aValue[endOfYearOffset] != '-' ||
aValue[endOfYearOffset + 3] != '-') {
return false;
}
// Now, we know where is the next '-' and what should be the size of the
// string.
if (aValue[endOfYearOffset + 3] != '-' ||
aValue.Length() != 10 + (endOfYearOffset - 4)) {
return false;
}
nsresult ec;
*aYear = PromiseFlatString(StringHead(aValue, endOfYearOffset)).ToInteger(&ec);
if (NS_FAILED(ec) || *aYear == 0) {
if (!DigitSubStringToNumber(aValue, 0, endOfYearOffset, aYear) ||
*aYear < 1) {
return false;
}

View File

@ -13,7 +13,7 @@
#include "nsIThread.h"
#include "mozilla/Monitor.h"
#include "nsISupportsImpl.h"
#include "nsObserverService.h"
#include "nsIObserver.h"
class AsyncLatencyLogger;
class LogEvent;

View File

@ -23,12 +23,14 @@ class SharedThreadPool;
// they're received, and are guaranteed to not be executed concurrently.
// They may be executed on different threads, and a memory barrier is used
// to make this threadsafe for objects that aren't already threadsafe.
class MediaTaskQueue : public AtomicRefCounted<MediaTaskQueue> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MediaTaskQueue)
MediaTaskQueue(TemporaryRef<SharedThreadPool> aPool);
class MediaTaskQueue MOZ_FINAL {
~MediaTaskQueue();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaTaskQueue)
MediaTaskQueue(TemporaryRef<SharedThreadPool> aPool);
nsresult Dispatch(nsIRunnable* aRunnable);
// Removes all pending tasks from the task queue, and blocks until

View File

@ -143,11 +143,13 @@ public:
// MediaTaskQueue passed into the PlatformDecoderModules's Create*Decoder()
// function. This may not be necessary for platforms with async APIs
// for decoding.
class MediaDataDecoder : public AtomicRefCounted<MediaDataDecoder> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MediaDataDecoder)
class MediaDataDecoder {
protected:
virtual ~MediaDataDecoder() {};
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDataDecoder)
// Initialize the decoder. The decoder should be ready to decode after
// this returns. The decoder should do any initialization here, rather
// than in its constructor or PlatformDecoderModule::Create*Decoder(),

View File

@ -14,12 +14,14 @@
namespace mozilla {
class MFTDecoder : public AtomicRefCounted<MFTDecoder> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MTFDecoder)
MFTDecoder();
class MFTDecoder MOZ_FINAL {
~MFTDecoder();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MFTDecoder)
MFTDecoder();
// Creates the MFT. First thing to do as part of setup.
//
// Params:

View File

@ -0,0 +1,296 @@
/* 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 "gtest/gtest.h"
#include <algorithm>
#include "mozilla/ArrayUtils.h"
#include "VP8TrackEncoder.h"
#include "ImageContainer.h"
#include "MediaStreamGraph.h"
#include "WebMWriter.h" // TODO: it's weird to include muxer header to get the class definition of VP8 METADATA
using ::testing::TestWithParam;
using ::testing::Values;
using namespace mozilla::layers;
using namespace mozilla;
// A helper object to generate of different YUV planes.
class YUVBufferGenerator {
public:
YUVBufferGenerator() {}
void Init(const mozilla::gfx::IntSize &aSize)
{
mImageSize = aSize;
int yPlaneLen = aSize.width * aSize.height;
int cbcrPlaneLen = (yPlaneLen + 1) / 2;
int frameLen = yPlaneLen + cbcrPlaneLen;
// Generate source buffer.
mSourceBuffer.SetLength(frameLen);
// Fill Y plane.
memset(mSourceBuffer.Elements(), 0x10, yPlaneLen);
// Fill Cb/Cr planes.
memset(mSourceBuffer.Elements() + yPlaneLen, 0x80, cbcrPlaneLen);
}
mozilla::gfx::IntSize GetSize() const
{
return mImageSize;
}
void Generate(nsTArray<nsRefPtr<Image> > &aImages)
{
aImages.AppendElement(CreateI420Image());
aImages.AppendElement(CreateNV12Image());
aImages.AppendElement(CreateNV21Image());
}
private:
Image *CreateI420Image()
{
PlanarYCbCrImage *image = new PlanarYCbCrImage(new BufferRecycleBin());
PlanarYCbCrData data;
const uint32_t yPlaneSize = mImageSize.width * mImageSize.height;
const uint32_t halfWidth = (mImageSize.width + 1) / 2;
const uint32_t halfHeight = (mImageSize.height + 1) / 2;
const uint32_t uvPlaneSize = halfWidth * halfHeight;
// Y plane.
uint8_t *y = mSourceBuffer.Elements();
data.mYChannel = y;
data.mYSize.width = mImageSize.width;
data.mYSize.height = mImageSize.height;
data.mYStride = mImageSize.width;
data.mYSkip = 0;
// Cr plane.
uint8_t *cr = y + yPlaneSize + uvPlaneSize;
data.mCrChannel = cr;
data.mCrSkip = 0;
// Cb plane
uint8_t *cb = y + yPlaneSize;
data.mCbChannel = cb;
data.mCbSkip = 0;
// CrCb plane vectors.
data.mCbCrStride = halfWidth;
data.mCbCrSize.width = halfWidth;
data.mCbCrSize.height = halfHeight;
image->SetData(data);
return image;
}
Image *CreateNV12Image()
{
PlanarYCbCrImage *image = new PlanarYCbCrImage(new BufferRecycleBin());
PlanarYCbCrData data;
const uint32_t yPlaneSize = mImageSize.width * mImageSize.height;
const uint32_t halfWidth = (mImageSize.width + 1) / 2;
const uint32_t halfHeight = (mImageSize.height + 1) / 2;
// Y plane.
uint8_t *y = mSourceBuffer.Elements();
data.mYChannel = y;
data.mYSize.width = mImageSize.width;
data.mYSize.height = mImageSize.height;
data.mYStride = mImageSize.width;
data.mYSkip = 0;
// Cr plane.
uint8_t *cr = y + yPlaneSize;
data.mCrChannel = cr;
data.mCrSkip = 1;
// Cb plane
uint8_t *cb = y + yPlaneSize + 1;
data.mCbChannel = cb;
data.mCbSkip = 1;
// 4:2:0.
data.mCbCrStride = mImageSize.width;
data.mCbCrSize.width = halfWidth;
data.mCbCrSize.height = halfHeight;
image->SetData(data);
return image;
}
Image *CreateNV21Image()
{
PlanarYCbCrImage *image = new PlanarYCbCrImage(new BufferRecycleBin());
PlanarYCbCrData data;
const uint32_t yPlaneSize = mImageSize.width * mImageSize.height;
const uint32_t halfWidth = (mImageSize.width + 1) / 2;
const uint32_t halfHeight = (mImageSize.height + 1) / 2;
// Y plane.
uint8_t *y = mSourceBuffer.Elements();
data.mYChannel = y;
data.mYSize.width = mImageSize.width;
data.mYSize.height = mImageSize.height;
data.mYStride = mImageSize.width;
data.mYSkip = 0;
// Cr plane.
uint8_t *cr = y + yPlaneSize + 1;
data.mCrChannel = cr;
data.mCrSkip = 1;
// Cb plane
uint8_t *cb = y + yPlaneSize;
data.mCbChannel = cb;
data.mCbSkip = 1;
// 4:2:0.
data.mCbCrStride = mImageSize.width;
data.mCbCrSize.width = halfWidth;
data.mCbCrSize.height = halfHeight;
image->SetData(data);
return image;
}
private:
mozilla::gfx::IntSize mImageSize;
nsTArray<uint8_t> mSourceBuffer;
};
struct InitParam {
bool mShouldSucceed; // This parameter should cause success or fail result
int mWidth; // frame width
int mHeight; // frame height
mozilla::TrackRate mTrackRate; // track rate. 90K is the most commond track rate.
};
class TestVP8TrackEncoder: public VP8TrackEncoder
{
public:
::testing::AssertionResult TestInit(const InitParam &aParam)
{
nsresult result = Init(aParam.mWidth, aParam.mHeight, aParam.mWidth, aParam.mHeight, aParam.mTrackRate);
if (((NS_FAILED(result) && aParam.mShouldSucceed)) || (NS_SUCCEEDED(result) && !aParam.mShouldSucceed))
{
return ::testing::AssertionFailure()
<< " width = " << aParam.mWidth
<< " height = " << aParam.mHeight
<< " TrackRate = " << aParam.mTrackRate << ".";
}
else
{
return ::testing::AssertionSuccess();
}
}
};
// Init test
TEST(VP8VideoTrackEncoder, Initialization)
{
InitParam params[] = {
// Failure cases.
{ false, 640, 480, 0 }, // Trackrate should be larger than 1.
{ false, 640, 480, -1 }, // Trackrate should be larger than 1.
{ false, 0, 0, 90000 }, // Height/ width should be larger than 1.
{ false, 0, 1, 90000 }, // Height/ width should be larger than 1.
{ false, 1, 0, 90000}, // Height/ width should be larger than 1.
// Success cases
{ true, 640, 480, 90000}, // Standard VGA
{ true, 800, 480, 90000}, // Standard WVGA
{ true, 960, 540, 90000}, // Standard qHD
{ true, 1280, 720, 90000} // Standard HD
};
for (size_t i = 0; i < ArrayLength(params); i++)
{
TestVP8TrackEncoder encoder;
EXPECT_TRUE(encoder.TestInit(params[i]));
}
}
// Get MetaData test
TEST(VP8VideoTrackEncoder, FetchMetaData)
{
InitParam params[] = {
// Success cases
{ true, 640, 480, 90000}, // Standard VGA
{ true, 800, 480, 90000}, // Standard WVGA
{ true, 960, 540, 90000}, // Standard qHD
{ true, 1280, 720, 90000} // Standard HD
};
for (size_t i = 0; i < ArrayLength(params); i++)
{
TestVP8TrackEncoder encoder;
EXPECT_TRUE(encoder.TestInit(params[i]));
nsRefPtr<TrackMetadataBase> meta = encoder.GetMetadata();
nsRefPtr<VP8Metadata> vp8Meta(static_cast<VP8Metadata*>(meta.get()));
// METADATA should be depend on how to initiate encoder.
EXPECT_TRUE(vp8Meta->mWidth == params[i].mWidth);
EXPECT_TRUE(vp8Meta->mHeight == params[i].mHeight);
}
}
// Encode test
TEST(VP8VideoTrackEncoder, FrameEncode)
{
// Initiate VP8 encoder
TestVP8TrackEncoder encoder;
InitParam param = {true, 640, 480, 90000};
encoder.TestInit(param);
// Create YUV images as source.
nsTArray<nsRefPtr<Image>> images;
YUVBufferGenerator generator;
generator.Init(mozilla::gfx::IntSize(640, 480));
generator.Generate(images);
// Put generated YUV frame into video segment.
// Duration of each frame is 1 second.
VideoSegment segment;
for (nsTArray<nsRefPtr<Image>>::size_type i = 0; i < images.Length(); i++)
{
nsRefPtr<Image> image = images[i];
segment.AppendFrame(image.forget(), mozilla::TrackTicks(90000), generator.GetSize());
}
// track change notification.
encoder.NotifyQueuedTrackChanges(nullptr, 0, 0, 0, 0, segment);
// Pull Encoded Data back from encoder.
EncodedFrameContainer container;
EXPECT_TRUE(NS_SUCCEEDED(encoder.GetEncodedTrack(container)));
}
// EOS test
TEST(VP8VideoTrackEncoder, EncodeComplete)
{
// Initiate VP8 encoder
TestVP8TrackEncoder encoder;
InitParam param = {true, 640, 480, 90000};
encoder.TestInit(param);
// track end notification.
VideoSegment segment;
encoder.NotifyQueuedTrackChanges(nullptr, 0, 0, 0, MediaStreamListener::TRACK_EVENT_ENDED, segment);
// Pull Encoded Data back from encoder. Since we have sent
// EOS to encoder, encoder.GetEncodedTrack should return
// NS_OK immidiately.
EncodedFrameContainer container;
EXPECT_TRUE(NS_SUCCEEDED(encoder.GetEncodedTrack(container)));
}

View File

@ -11,6 +11,10 @@ UNIFIED_SOURCES += [
'TestTrackEncoder.cpp',
]
if CONFIG['MOZ_WEBM_ENCODER']:
UNIFIED_SOURCES += ['TestVideoTrackEncoder.cpp',
]
EXPORT_LIBRARY = True
include('/ipc/chromium/chromium-config.mozbuild')

View File

@ -8,6 +8,8 @@
#include "mozilla/EventStates.h"
#include "mozilla/dom/SVGFEImageElementBinding.h"
#include "mozilla/dom/SVGFilterElement.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsSVGUtils.h"
@ -211,22 +213,16 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
currentRequest->GetImage(getter_AddRefs(imageContainer));
}
nsRefPtr<gfxASurface> currentFrame;
RefPtr<SourceSurface> image;
if (imageContainer) {
currentFrame =
imageContainer->GetFrame(imgIContainer::FRAME_CURRENT,
imgIContainer::FLAG_SYNC_DECODE);
image = imageContainer->GetFrame(imgIContainer::FRAME_CURRENT,
imgIContainer::FLAG_SYNC_DECODE);
}
if (!currentFrame) {
if (!image) {
return FilterPrimitiveDescription(PrimitiveType::Empty);
}
gfxPlatform* platform = gfxPlatform::GetPlatform();
DrawTarget* dt = platform->ScreenReferenceDrawTarget();
RefPtr<SourceSurface> image =
platform->GetSourceSurfaceForSurface(dt, currentFrame);
IntSize nativeSize;
imageContainer->GetWidth(&nativeSize.width);
imageContainer->GetHeight(&nativeSize.height);

View File

@ -9,17 +9,17 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/WebappOSUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "NetworkUtil",
"@mozilla.org/network/util;1",
"nsINetUtil");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "WebappOSUtils",
"resource://gre/modules/WebappOSUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
@ -342,7 +342,8 @@ this.AppsUtils = {
checkManifestContentType(aInstallOrigin, aWebappOrigin, aContentType) {
let hadCharset = { };
let charset = { };
let contentType = NetworkUtil.parseContentType(aContentType, charset, hadCharset);
let netutil = Cc["@mozilla.org/network/util;1"].getService(Ci.nsINetUtil);
let contentType = netutil.parseContentType(aContentType, charset, hadCharset);
if (aInstallOrigin != aWebappOrigin &&
contentType != "application/x-web-app-manifest+json") {
return false;

View File

@ -8,7 +8,7 @@
#define mozilla_dom_bluetooth_bluetoothprofilecontroller_h__
#include "BluetoothUuid.h"
#include "mozilla/RefPtr.h"
#include "nsISupportsImpl.h"
#include "nsAutoPtr.h"
#include "nsITimer.h"
@ -57,10 +57,12 @@ class BluetoothProfileManagerBase;
class BluetoothReplyRunnable;
typedef void (*BluetoothProfileControllerCallback)();
class BluetoothProfileController : public RefCounted<BluetoothProfileController>
class BluetoothProfileController MOZ_FINAL
{
~BluetoothProfileController();
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(BluetoothProfileController)
NS_INLINE_DECL_REFCOUNTING(BluetoothProfileController)
/**
* @param aConnect: If it's a connect request, the value should be set
* to true. For disconnect request, set it to false.
@ -83,7 +85,6 @@ public:
BluetoothProfileControllerCallback aCallback,
uint16_t aServiceUuid,
uint32_t aCod = 0);
~BluetoothProfileController();
/**
* The controller starts connecting/disconnecting profiles one by one

View File

@ -91,9 +91,39 @@ public:
, mIOLoop(nullptr)
, mFd(aFd)
, mShuttingDownOnIOThread(false)
, mChannel(0)
, mAuth(false)
, mEncrypt(false)
{
}
DroidSocketImpl(BluetoothSocket* aConsumer,
int aChannel, bool aAuth, bool aEncrypt)
: mConsumer(aConsumer)
, mReadMsgForClientFd(false)
, mIOLoop(nullptr)
, mFd(-1)
, mShuttingDownOnIOThread(false)
, mChannel(aChannel)
, mAuth(aAuth)
, mEncrypt(aEncrypt)
{ }
DroidSocketImpl(BluetoothSocket* aConsumer, const nsAString& aDeviceAddress,
int aChannel, bool aAuth, bool aEncrypt)
: mConsumer(aConsumer)
, mReadMsgForClientFd(false)
, mIOLoop(nullptr)
, mFd(-1)
, mShuttingDownOnIOThread(false)
, mDeviceAddress(aDeviceAddress)
, mChannel(aChannel)
, mAuth(aAuth)
, mEncrypt(aEncrypt)
{
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
}
~DroidSocketImpl()
{
MOZ_ASSERT(NS_IsMainThread());
@ -134,6 +164,9 @@ public:
mShuttingDownOnIOThread = true;
}
void Connect();
void Listen();
void SetUpIO(bool aWrite)
{
MOZ_ASSERT(!mIOLoop);
@ -236,6 +269,11 @@ private:
* If true, do not requeue whatever task we're running
*/
bool mShuttingDownOnIOThread;
nsString mDeviceAddress;
int mChannel;
bool mAuth;
bool mEncrypt;
};
template<class T>
@ -368,19 +406,60 @@ private:
UnixSocketRawData* mData;
};
class SocketSetUpIOTask : public Task
class DroidSocketImplTask : public CancelableTask
{
virtual void Run()
public:
DroidSocketImpl* GetDroidSocketImpl() const
{
return mDroidSocketImpl;
}
void Cancel() MOZ_OVERRIDE
{
mDroidSocketImpl = nullptr;
}
bool IsCanceled() const
{
return !mDroidSocketImpl;
}
protected:
DroidSocketImplTask(DroidSocketImpl* aDroidSocketImpl)
: mDroidSocketImpl(aDroidSocketImpl)
{
MOZ_ASSERT(mDroidSocketImpl);
}
private:
DroidSocketImpl* mDroidSocketImpl;
};
class SocketConnectTask : public DroidSocketImplTask
{
public:
SocketConnectTask(DroidSocketImpl* aDroidSocketImpl)
: DroidSocketImplTask(aDroidSocketImpl)
{ }
void Run() MOZ_OVERRIDE
{
MOZ_ASSERT(!NS_IsMainThread());
mImpl->SetUpIO(mWrite);
MOZ_ASSERT(!IsCanceled());
GetDroidSocketImpl()->Connect();
}
};
DroidSocketImpl* mImpl;
bool mWrite;
class SocketListenTask : public DroidSocketImplTask
{
public:
SocketSetUpIOTask(DroidSocketImpl* aImpl, bool aWrite)
: mImpl(aImpl), mWrite(aWrite) { }
SocketListenTask(DroidSocketImpl* aDroidSocketImpl)
: DroidSocketImplTask(aDroidSocketImpl)
{ }
void Run() MOZ_OVERRIDE
{
MOZ_ASSERT(!NS_IsMainThread());
if (!IsCanceled()) {
GetDroidSocketImpl()->Listen();
}
}
};
class SocketConnectClientFdTask : public Task
@ -396,6 +475,78 @@ public:
SocketConnectClientFdTask(DroidSocketImpl* aImpl) : mImpl(aImpl) { }
};
void
DroidSocketImpl::Connect()
{
MOZ_ASSERT(sBluetoothSocketInterface);
bt_bdaddr_t remoteBdAddress;
StringToBdAddressType(mDeviceAddress, &remoteBdAddress);
// TODO: uuid as argument
int fd = -1;
bt_status_t status =
sBluetoothSocketInterface->connect(&remoteBdAddress,
BTSOCK_RFCOMM,
UUID_OBEX_OBJECT_PUSH,
mChannel,
&fd,
(BTSOCK_FLAG_ENCRYPT * mEncrypt) |
(BTSOCK_FLAG_AUTH * mAuth));
NS_ENSURE_TRUE_VOID(status == BT_STATUS_SUCCESS);
NS_ENSURE_TRUE_VOID(fd >= 0);
mFd = fd;
MOZ_ASSERT(!mIOLoop);
mIOLoop = MessageLoopForIO::current();
// Set up a read watch
mIOLoop->WatchFileDescriptor(mFd.get(),
true,
MessageLoopForIO::WATCH_READ,
&mReadWatcher,
this);
// Set up a write watch
mIOLoop->WatchFileDescriptor(mFd.get(),
false,
MessageLoopForIO::WATCH_WRITE,
&mWriteWatcher,
this);
}
void
DroidSocketImpl::Listen()
{
MOZ_ASSERT(sBluetoothSocketInterface);
// TODO: uuid and service name as arguments
int fd = -1;
bt_status_t status =
sBluetoothSocketInterface->listen(BTSOCK_RFCOMM,
"OBEX Object Push",
UUID_OBEX_OBJECT_PUSH,
mChannel,
&fd,
(BTSOCK_FLAG_ENCRYPT * mEncrypt) |
(BTSOCK_FLAG_AUTH * mAuth));
NS_ENSURE_TRUE_VOID(status == BT_STATUS_SUCCESS);
NS_ENSURE_TRUE_VOID(fd >= 0);
mFd = fd;
MOZ_ASSERT(!mIOLoop);
mIOLoop = MessageLoopForIO::current();
// Set up a read watch
mIOLoop->WatchFileDescriptor(mFd.get(),
true,
MessageLoopForIO::WATCH_READ,
&mReadWatcher,
this);
}
ssize_t
DroidSocketImpl::ReadMsg(int aFd, void *aBuffer, size_t aLength)
{
@ -580,65 +731,30 @@ BluetoothSocket::CloseDroidSocket()
}
bool
BluetoothSocket::CreateDroidSocket(int aFd)
BluetoothSocket::Connect(const nsAString& aDeviceAddress, int aChannel)
{
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_FALSE(mImpl, false);
mImpl = new DroidSocketImpl(this, aFd);
mIsServer = false;
mImpl = new DroidSocketImpl(this, aDeviceAddress, aChannel, mAuth, mEncrypt);
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
new SocketSetUpIOTask(mImpl, !mIsServer));
new SocketConnectTask(mImpl));
return true;
}
bool
BluetoothSocket::Connect(const nsAString& aDeviceAddress, int aChannel)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!aDeviceAddress.IsEmpty());
NS_ENSURE_TRUE(sBluetoothSocketInterface, false);
bt_bdaddr_t remoteBdAddress;
StringToBdAddressType(aDeviceAddress, &remoteBdAddress);
// TODO: uuid as argument
int fd;
NS_ENSURE_TRUE(BT_STATUS_SUCCESS ==
sBluetoothSocketInterface->connect(&remoteBdAddress,
BTSOCK_RFCOMM,
UUID_OBEX_OBJECT_PUSH,
aChannel,
&fd,
(mAuth << 1) | mEncrypt),
false);
NS_ENSURE_TRUE(fd >= 0, false);
mIsServer = false;
return CreateDroidSocket(fd);
}
bool
BluetoothSocket::Listen(int aChannel)
{
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_TRUE(sBluetoothSocketInterface, false);
// TODO: uuid and service name as arguments
nsAutoCString serviceName("OBEX Object Push");
int fd;
NS_ENSURE_TRUE(BT_STATUS_SUCCESS ==
sBluetoothSocketInterface->listen(BTSOCK_RFCOMM,
serviceName.get(),
UUID_OBEX_OBJECT_PUSH,
aChannel,
&fd,
(mAuth << 1) | mEncrypt),
false);
NS_ENSURE_TRUE(fd >= 0, false);
NS_ENSURE_FALSE(mImpl, false);
mIsServer = true;
return CreateDroidSocket(fd);
mImpl = new DroidSocketImpl(this, aChannel, mAuth, mEncrypt);
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
new SocketListenTask(mImpl));
return true;
}
bool

View File

@ -77,7 +77,6 @@ private:
bool mIsServer;
int mReceivedSocketInfoLength;
bool CreateDroidSocket(int aFd);
bool ReceiveSocketInfo(nsAutoPtr<mozilla::ipc::UnixSocketRawData>& aMessage);
};

View File

@ -29,6 +29,27 @@ const ContentPanning = {
hybridEvents: false,
init: function cp_init() {
// If APZ is enabled, we do active element handling in C++
// (see widget/xpwidgets/ActiveElementManager.h), and panning
// itself in APZ, so we don't need to handle any touch events here.
if (docShell.asyncPanZoomEnabled === false) {
this._setupListenersForPanning();
}
addEventListener("unload",
this._unloadHandler.bind(this),
/* useCapture = */ false,
/* wantsUntrusted = */ false);
addMessageListener("Viewport:Change", this._recvViewportChange.bind(this));
addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
addEventListener("visibilitychange", this._handleVisibilityChange.bind(this));
kObservedEvents.forEach((topic) => {
Services.obs.addObserver(this, topic, false);
});
},
_setupListenersForPanning: function cp_setupListenersForPanning() {
var events;
try {
content.document.createEvent('TouchEvent');
@ -60,18 +81,6 @@ const ContentPanning = {
this.handleEvent.bind(this),
/* useCapture = */ false);
}.bind(this));
addEventListener("unload",
this._unloadHandler.bind(this),
/* useCapture = */ false,
/* wantsUntrusted = */ false);
addMessageListener("Viewport:Change", this._recvViewportChange.bind(this));
addMessageListener("Gesture:DoubleTap", this._recvDoubleTap.bind(this));
addEventListener("visibilitychange", this._handleVisibilityChange.bind(this));
kObservedEvents.forEach((topic) => {
Services.obs.addObserver(this, topic, false);
});
},
handleEvent: function cp_handleEvent(evt) {
@ -195,8 +204,7 @@ const ContentPanning = {
// We prevent start events to avoid sending a focus event at the end of this
// touch series. See bug 889717.
if (docShell.asyncPanZoomEnabled === false &&
(this.panning || this.preventNextClick)) {
if ((this.panning || this.preventNextClick)) {
evt.preventDefault();
}
},
@ -235,7 +243,7 @@ const ContentPanning = {
let view = target.ownerDocument ? target.ownerDocument.defaultView
: target;
view.addEventListener('click', this, true, true);
} else if (docShell.asyncPanZoomEnabled === false) {
} else {
// We prevent end events to avoid sending a focus event. See bug 889717.
evt.preventDefault();
}
@ -284,18 +292,15 @@ const ContentPanning = {
return;
}
// If the application is not managed by the AsyncPanZoomController, then
// scroll manually.
if (docShell.asyncPanZoomEnabled === false) {
this.scrollCallback(delta.scale(-1));
}
// Scroll manually.
this.scrollCallback(delta.scale(-1));
if (!this.panning && isPan) {
this.panning = true;
this._activationTimer.cancel();
}
if (this.panning && docShell.asyncPanZoomEnabled === false) {
if (this.panning) {
// Only do this when we're actually executing a pan gesture.
// Otherwise synthetic mouse events will be canceled.
evt.stopPropagation();
@ -592,9 +597,8 @@ const ContentPanning = {
delete this.primaryPointerId;
this._activationTimer.cancel();
// If there is a scroll action but the application is not managed by
// the AsyncPanZoom controller, let's do a manual kinetic panning action.
if (this.panning && docShell.asyncPanZoomEnabled === false) {
// If there is a scroll action, let's do a manual kinetic panning action.
if (this.panning) {
KineticPanning.start(this);
}
},

View File

@ -284,12 +284,15 @@ CameraControlImpl::OnError(CameraControlListener::CameraErrorContext aContext,
"StartCamera",
"StopCamera",
"AutoFocus",
"StartFaceDetection",
"StopFaceDetection",
"TakePicture",
"StartRecording",
"StopRecording",
"SetConfiguration",
"StartPreview",
"StopPreview",
"ResumeContinuousFocus",
"Unspecified"
};
if (static_cast<unsigned int>(aError) < sizeof(error) / sizeof(error[0]) &&
@ -414,30 +417,25 @@ CameraControlImpl::SetConfiguration(const Configuration& aConfig)
}
nsresult
CameraControlImpl::AutoFocus(bool aCancelExistingCall)
CameraControlImpl::AutoFocus()
{
class Message : public ControlMessage
{
public:
Message(CameraControlImpl* aCameraControl,
CameraControlListener::CameraErrorContext aContext,
bool aCancelExistingCall)
CameraControlListener::CameraErrorContext aContext)
: ControlMessage(aCameraControl, aContext)
, mCancelExistingCall(aCancelExistingCall)
{ }
nsresult
RunImpl() MOZ_OVERRIDE
{
return mCameraControl->AutoFocusImpl(mCancelExistingCall);
return mCameraControl->AutoFocusImpl();
}
protected:
bool mCancelExistingCall;
};
return mCameraThread->Dispatch(
new Message(this, CameraControlListener::kInAutoFocus, aCancelExistingCall), NS_DISPATCH_NORMAL);
new Message(this, CameraControlListener::kInAutoFocus), NS_DISPATCH_NORMAL);
}
nsresult
@ -611,6 +609,28 @@ CameraControlImpl::StopPreview()
new Message(this, CameraControlListener::kInStopPreview), NS_DISPATCH_NORMAL);
}
nsresult
CameraControlImpl::ResumeContinuousFocus()
{
class Message : public ControlMessage
{
public:
Message(CameraControlImpl* aCameraControl,
CameraControlListener::CameraErrorContext aContext)
: ControlMessage(aCameraControl, aContext)
{ }
nsresult
RunImpl() MOZ_OVERRIDE
{
return mCameraControl->ResumeContinuousFocusImpl();
}
};
return mCameraThread->Dispatch(
new Message(this, CameraControlListener::kInResumeContinuousFocus), NS_DISPATCH_NORMAL);
}
nsresult
CameraControlImpl::Stop()
{

View File

@ -19,8 +19,6 @@
#include "DeviceStorageFileDescriptor.h"
#include "CameraControlListener.h"
class DeviceStorageFileDescriptor;
namespace mozilla {
namespace layers {
@ -42,13 +40,14 @@ public:
virtual nsresult SetConfiguration(const Configuration& aConfig) MOZ_OVERRIDE;
virtual nsresult StartPreview() MOZ_OVERRIDE;
virtual nsresult StopPreview() MOZ_OVERRIDE;
virtual nsresult AutoFocus(bool aCancelExistingCall) MOZ_OVERRIDE;
virtual nsresult AutoFocus() MOZ_OVERRIDE;
virtual nsresult StartFaceDetection() MOZ_OVERRIDE;
virtual nsresult StopFaceDetection() MOZ_OVERRIDE;
virtual nsresult TakePicture() MOZ_OVERRIDE;
virtual nsresult StartRecording(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions) MOZ_OVERRIDE;
virtual nsresult StopRecording() MOZ_OVERRIDE;
virtual nsresult ResumeContinuousFocus() MOZ_OVERRIDE;
already_AddRefed<RecorderProfileManager> GetRecorderProfileManager();
uint32_t GetCameraId() { return mCameraId; }
@ -102,13 +101,14 @@ protected:
virtual nsresult SetConfigurationImpl(const Configuration& aConfig) = 0;
virtual nsresult StartPreviewImpl() = 0;
virtual nsresult StopPreviewImpl() = 0;
virtual nsresult AutoFocusImpl(bool aCancelExistingCall) = 0;
virtual nsresult AutoFocusImpl() = 0;
virtual nsresult StartFaceDetectionImpl() = 0;
virtual nsresult StopFaceDetectionImpl() = 0;
virtual nsresult TakePictureImpl() = 0;
virtual nsresult StartRecordingImpl(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions) = 0;
virtual nsresult StopRecordingImpl() = 0;
virtual nsresult ResumeContinuousFocusImpl() = 0;
virtual nsresult PushParametersImpl() = 0;
virtual nsresult PullParametersImpl() = 0;
virtual already_AddRefed<RecorderProfileManager> GetRecorderProfileManagerImpl() = 0;

View File

@ -95,6 +95,7 @@ public:
kInSetConfiguration,
kInStartPreview,
kInStopPreview,
kInResumeContinuousFocus,
kInUnspecified
};
enum CameraError

View File

@ -844,6 +844,29 @@ nsDOMCameraControl::SetConfiguration(const CameraConfiguration& aConfiguration,
aRv = mCameraControl->SetConfiguration(config);
}
class ImmediateErrorCallback : public nsRunnable
{
public:
ImmediateErrorCallback(CameraErrorCallback* aCallback, const nsAString& aMessage)
: mCallback(aCallback)
, mMessage(aMessage)
{ }
NS_IMETHODIMP
Run()
{
MOZ_ASSERT(NS_IsMainThread());
ErrorResult ignored;
mCallback->Call(mMessage, ignored);
return NS_OK;
}
protected:
nsRefPtr<CameraErrorCallback> mCallback;
nsString mMessage;
};
void
nsDOMCameraControl::AutoFocus(CameraAutoFocusCallback& aOnSuccess,
const Optional<OwningNonNull<CameraErrorCallback> >& aOnError,
@ -851,17 +874,16 @@ nsDOMCameraControl::AutoFocus(CameraAutoFocusCallback& aOnSuccess,
{
MOZ_ASSERT(mCameraControl);
nsRefPtr<CameraAutoFocusCallback> cb = mAutoFocusOnSuccessCb.forget();
bool cancel = false;
nsRefPtr<CameraAutoFocusCallback> cb = mAutoFocusOnSuccessCb;
if (cb) {
// we have a callback, which means we're already in the process of
// auto-focusing--cancel the old callback
nsRefPtr<CameraErrorCallback> ecb = mAutoFocusOnErrorCb.forget();
if (ecb) {
ErrorResult ignored;
ecb->Call(NS_LITERAL_STRING("Interrupted"), ignored);
if (aOnError.WasPassed()) {
// There is already a call to AutoFocus() in progress, abort this new one
// and invoke the error callback (if one was passed in).
NS_DispatchToMainThread(new ImmediateErrorCallback(&aOnError.Value(),
NS_LITERAL_STRING("AutoFocusAlreadyInProgress")));
}
cancel = true;
aRv = NS_ERROR_FAILURE;
return;
}
mAutoFocusOnSuccessCb = &aOnSuccess;
@ -870,7 +892,7 @@ nsDOMCameraControl::AutoFocus(CameraAutoFocusCallback& aOnSuccess,
mAutoFocusOnErrorCb = &aOnError.Value();
}
aRv = mCameraControl->AutoFocus(cancel);
aRv = mCameraControl->AutoFocus();
}
void
@ -897,11 +919,11 @@ nsDOMCameraControl::TakePicture(const CameraPictureOptions& aOptions,
nsRefPtr<CameraTakePictureCallback> cb = mTakePictureOnSuccessCb;
if (cb) {
// There is already a call to TakePicture() in progress, abort this one and
// invoke the error callback (if one was passed in).
if (aOnError.WasPassed()) {
ErrorResult ignored;
aOnError.Value().Call(NS_LITERAL_STRING("TakePictureAlreadyInProgress"), ignored);
// There is already a call to TakePicture() in progress, abort this new
// one and invoke the error callback (if one was passed in).
NS_DispatchToMainThread(new ImmediateErrorCallback(&aOnError.Value(),
NS_LITERAL_STRING("TakePictureAlreadyInProgress")));
}
aRv = NS_ERROR_FAILURE;
return;
@ -958,6 +980,13 @@ nsDOMCameraControl::ReleaseHardware(const Optional<OwningNonNull<CameraReleaseCa
aRv = mCameraControl->Stop();
}
void
nsDOMCameraControl::ResumeContinuousFocus(ErrorResult& aRv)
{
MOZ_ASSERT(mCameraControl);
aRv = mCameraControl->ResumeContinuousFocus();
}
void
nsDOMCameraControl::Shutdown()
{

View File

@ -128,6 +128,7 @@ public:
void ReleaseHardware(const dom::Optional<dom::OwningNonNull<dom::CameraReleaseCallback> >& aOnSuccess,
const dom::Optional<dom::OwningNonNull<dom::CameraErrorCallback> >& aOnError,
ErrorResult& aRv);
void ResumeContinuousFocus(ErrorResult& aRv);
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;

View File

@ -9,7 +9,7 @@
#include "nsPIDOMWindow.h"
#include "mozilla/Services.h"
#include "nsContentPermissionHelper.h"
#include "nsObserverService.h"
#include "nsIObserverService.h"
#include "nsIPermissionManager.h"
#include "DOMCameraControl.h"
#include "nsDOMClassInfo.h"

View File

@ -58,19 +58,20 @@ public:
protected:
~FallbackCameraControl();
virtual nsresult StartPreviewImpl() { return NS_ERROR_FAILURE; }
virtual nsresult StopPreviewImpl() { return NS_ERROR_FAILURE; }
virtual nsresult AutoFocusImpl(bool aCancelExistingCall) { return NS_ERROR_FAILURE; }
virtual nsresult StartFaceDetectionImpl() { return NS_ERROR_FAILURE; }
virtual nsresult StopFaceDetectionImpl() { return NS_ERROR_FAILURE; }
virtual nsresult TakePictureImpl() { return NS_ERROR_FAILURE; }
virtual nsresult StartPreviewImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult StopPreviewImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult AutoFocusImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult StartFaceDetectionImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult StopFaceDetectionImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult TakePictureImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult StartRecordingImpl(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions = nullptr)
const StartRecordingOptions* aOptions = nullptr) MOZ_OVERRIDE
{ return NS_ERROR_FAILURE; }
virtual nsresult StopRecordingImpl() { return NS_ERROR_FAILURE; }
virtual nsresult PushParametersImpl() { return NS_ERROR_FAILURE; }
virtual nsresult PullParametersImpl() { return NS_ERROR_FAILURE; }
virtual already_AddRefed<RecorderProfileManager> GetRecorderProfileManagerImpl() { return nullptr; }
virtual nsresult StopRecordingImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult ResumeContinuousFocusImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult PushParametersImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual nsresult PullParametersImpl() MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
virtual already_AddRefed<RecorderProfileManager> GetRecorderProfileManagerImpl() MOZ_OVERRIDE { return nullptr; }
private:
FallbackCameraControl(const FallbackCameraControl&) MOZ_DELETE;

View File

@ -564,15 +564,12 @@ nsGonkCameraControl::PausePreview()
}
nsresult
nsGonkCameraControl::AutoFocusImpl(bool aCancelExistingCall)
nsGonkCameraControl::AutoFocusImpl()
{
MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
RETURN_IF_NO_CAMERA_HW();
if (aCancelExistingCall) {
if (mCameraHw.get()) {
mCameraHw->CancelAutoFocus();
}
}
DOM_CAMERA_LOGI("Starting auto focus\n");
if (mCameraHw->AutoFocus() != OK) {
return NS_ERROR_FAILURE;
@ -1045,6 +1042,23 @@ nsGonkCameraControl::StopRecordingImpl()
return NS_DispatchToMainThread(new RecordingComplete(mVideoFile), NS_DISPATCH_NORMAL);
}
nsresult
nsGonkCameraControl::ResumeContinuousFocusImpl()
{
MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
RETURN_IF_NO_CAMERA_HW();
DOM_CAMERA_LOGI("Resuming continuous autofocus\n");
// see
// http://developer.android.com/reference/android/hardware/Camera.Parameters.html#FOCUS_MODE_CONTINUOUS_PICTURE
if (NS_WARN_IF(mCameraHw->CancelAutoFocus() != OK)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
void
nsGonkCameraControl::OnAutoFocusComplete(bool aSuccess)
{

View File

@ -105,13 +105,14 @@ protected:
virtual nsresult StartPreviewImpl() MOZ_OVERRIDE;
virtual nsresult StopPreviewImpl() MOZ_OVERRIDE;
virtual nsresult AutoFocusImpl(bool aCancelExistingCall) MOZ_OVERRIDE;
virtual nsresult AutoFocusImpl() MOZ_OVERRIDE;
virtual nsresult StartFaceDetectionImpl() MOZ_OVERRIDE;
virtual nsresult StopFaceDetectionImpl() MOZ_OVERRIDE;
virtual nsresult TakePictureImpl() MOZ_OVERRIDE;
virtual nsresult StartRecordingImpl(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions = nullptr) MOZ_OVERRIDE;
virtual nsresult StopRecordingImpl() MOZ_OVERRIDE;
virtual nsresult ResumeContinuousFocusImpl() MOZ_OVERRIDE;
virtual nsresult PushParametersImpl() MOZ_OVERRIDE;
virtual nsresult PullParametersImpl() MOZ_OVERRIDE;
virtual already_AddRefed<RecorderProfileManager> GetRecorderProfileManagerImpl() MOZ_OVERRIDE;

View File

@ -292,11 +292,11 @@ GonkCameraHardware::AutoFocus()
return mCamera->autoFocus();
}
void
int
GonkCameraHardware::CancelAutoFocus()
{
DOM_CAMERA_LOGI("%s\n", __func__);
mCamera->cancelAutoFocus();
return mCamera->cancelAutoFocus();
}
int

View File

@ -78,7 +78,7 @@ public:
virtual int GetSensorOrientation(uint32_t aType = RAW_SENSOR_ORIENTATION);
virtual int AutoFocus();
virtual void CancelAutoFocus();
virtual int CancelAutoFocus();
virtual int StartFaceDetection();
virtual int StopFaceDetection();
virtual int TakePicture();

View File

@ -10,7 +10,7 @@
#include "nsAutoPtr.h"
#include "nsISupportsImpl.h"
class DeviceStorageFileDescriptor;
struct DeviceStorageFileDescriptor;
class nsIFile;
@ -152,13 +152,14 @@ public:
virtual nsresult StartPreview() = 0;
virtual nsresult StopPreview() = 0;
virtual nsresult AutoFocus(bool aCancelExistingCall) = 0;
virtual nsresult AutoFocus() = 0;
virtual nsresult TakePicture() = 0;
virtual nsresult StartRecording(DeviceStorageFileDescriptor *aFileDescriptor,
const StartRecordingOptions* aOptions = nullptr) = 0;
virtual nsresult StopRecording() = 0;
virtual nsresult StartFaceDetection() = 0;
virtual nsresult StopFaceDetection() = 0;
virtual nsresult ResumeContinuousFocus() = 0;
virtual nsresult Set(uint32_t aKey, const nsAString& aValue) = 0;
virtual nsresult Get(uint32_t aKey, nsAString& aValue) = 0;

View File

@ -321,13 +321,7 @@ private:
friend class WatchFileEvent;
friend class DeviceStorageRequest;
class VolumeNameCache : public mozilla::RefCounted<VolumeNameCache>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeNameCache)
nsTArray<nsString> mVolumeNames;
};
static mozilla::StaticRefPtr<VolumeNameCache> sVolumeNameCache;
static mozilla::StaticAutoPtr<nsTArray<nsString>> sVolumeNameCache;
#ifdef MOZ_WIDGET_GONK
nsString mLastStatus;

View File

@ -9,11 +9,9 @@
#include "mozilla/ipc/FileDescriptor.h"
class DeviceStorageFileDescriptor MOZ_FINAL
: public mozilla::RefCounted<DeviceStorageFileDescriptor>
struct DeviceStorageFileDescriptor MOZ_FINAL
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DeviceStorageFileDescriptor)
NS_INLINE_DECL_REFCOUNTING(DeviceStorageFileDescriptor)
nsRefPtr<DeviceStorageFile> mDSFile;
mozilla::ipc::FileDescriptor mFileDescriptor;
};

View File

@ -9,7 +9,7 @@
#include "mozilla/dom/devicestorage/PDeviceStorageRequestChild.h"
class DeviceStorageFile;
class DeviceStorageFileDescriptor;
struct DeviceStorageFileDescriptor;
namespace mozilla {
namespace dom {

View File

@ -115,15 +115,16 @@ DeviceStorageUsedSpaceCache::CreateOrGet()
return sDeviceStorageUsedSpaceCache;
}
TemporaryRef<DeviceStorageUsedSpaceCache::CacheEntry>
already_AddRefed<DeviceStorageUsedSpaceCache::CacheEntry>
DeviceStorageUsedSpaceCache::GetCacheEntry(const nsAString& aStorageName)
{
nsTArray<RefPtr<CacheEntry> >::size_type numEntries = mCacheEntries.Length();
nsTArray<RefPtr<CacheEntry> >::index_type i;
nsTArray<nsRefPtr<CacheEntry>>::size_type numEntries = mCacheEntries.Length();
nsTArray<nsRefPtr<CacheEntry>>::index_type i;
for (i = 0; i < numEntries; i++) {
RefPtr<CacheEntry> cacheEntry = mCacheEntries[i];
nsRefPtr<CacheEntry>& cacheEntry = mCacheEntries[i];
if (cacheEntry->mStorageName.Equals(aStorageName)) {
return cacheEntry;
nsRefPtr<CacheEntry> addRefedCacheEntry = cacheEntry;
return addRefedCacheEntry.forget();
}
}
return nullptr;
@ -149,7 +150,7 @@ DeviceStorageUsedSpaceCache::AccumUsedSizes(const nsAString& aStorageName,
uint64_t* aMusicSoFar,
uint64_t* aTotalSoFar)
{
RefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
nsRefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
if (!cacheEntry || cacheEntry->mDirty) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -174,7 +175,7 @@ DeviceStorageUsedSpaceCache::SetUsedSizes(const nsAString& aStorageName,
uint64_t aMusicSize,
uint64_t aTotalUsedSize)
{
RefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
nsRefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
if (!cacheEntry) {
cacheEntry = new CacheEntry;
cacheEntry->mStorageName = aStorageName;
@ -189,10 +190,10 @@ DeviceStorageUsedSpaceCache::SetUsedSizes(const nsAString& aStorageName,
cacheEntry->mDirty = false;
}
class GlobalDirs : public RefCounted<GlobalDirs>
class GlobalDirs
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(GlobalDirs)
NS_INLINE_DECL_REFCOUNTING(GlobalDirs)
#if !defined(MOZ_WIDGET_GONK)
nsCOMPtr<nsIFile> pictures;
nsCOMPtr<nsIFile> videos;
@ -3179,16 +3180,15 @@ nsDOMDeviceStorage::Shutdown()
obs->RemoveObserver(this, "disk-space-watcher");
}
StaticRefPtr<nsDOMDeviceStorage::VolumeNameCache>
nsDOMDeviceStorage::sVolumeNameCache;
StaticAutoPtr<nsTArray<nsString>> nsDOMDeviceStorage::sVolumeNameCache;
// static
void
nsDOMDeviceStorage::GetOrderedVolumeNames(
nsDOMDeviceStorage::VolumeNameArray &aVolumeNames)
{
if (sVolumeNameCache && sVolumeNameCache->mVolumeNames.Length() > 0) {
aVolumeNames.AppendElements(sVolumeNameCache->mVolumeNames);
if (sVolumeNameCache && sVolumeNameCache->Length() > 0) {
aVolumeNames.AppendElements(*sVolumeNameCache);
return;
}
#ifdef MOZ_WIDGET_GONK
@ -3209,8 +3209,8 @@ nsDOMDeviceStorage::GetOrderedVolumeNames(
if (aVolumeNames.IsEmpty()) {
aVolumeNames.AppendElement(EmptyString());
}
sVolumeNameCache = new VolumeNameCache;
sVolumeNameCache->mVolumeNames.AppendElements(aVolumeNames);
sVolumeNameCache = new nsTArray<nsString>;
sVolumeNameCache->AppendElements(aVolumeNames);
}
// static

View File

@ -29,7 +29,6 @@ class nsPIDOMWindow;
#include "prtime.h"
#include "DeviceStorage.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
#include "mozilla/RefPtr.h"
#include "mozilla/StaticPtr.h"
namespace mozilla {
@ -80,7 +79,7 @@ public:
NS_IMETHOD Run() MOZ_OVERRIDE
{
mozilla::RefPtr<DeviceStorageUsedSpaceCache::CacheEntry> cacheEntry;
nsRefPtr<DeviceStorageUsedSpaceCache::CacheEntry> cacheEntry;
cacheEntry = mCache->GetCacheEntry(mStorageName);
if (cacheEntry) {
cacheEntry->mDirty = true;
@ -120,10 +119,10 @@ public:
private:
friend class InvalidateRunnable;
class CacheEntry : public mozilla::RefCounted<CacheEntry>
struct CacheEntry
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DeviceStorageUsedSpaceCache::CacheEntry)
NS_INLINE_DECL_REFCOUNTING(DeviceStorageUsedSpaceCache::CacheEntry)
bool mDirty;
nsString mStorageName;
int64_t mFreeBytes;
@ -132,9 +131,9 @@ private:
uint64_t mMusicUsedSize;
uint64_t mTotalUsedSize;
};
mozilla::TemporaryRef<CacheEntry> GetCacheEntry(const nsAString& aStorageName);
already_AddRefed<CacheEntry> GetCacheEntry(const nsAString& aStorageName);
nsTArray<mozilla::RefPtr<CacheEntry> > mCacheEntries;
nsTArray<nsRefPtr<CacheEntry>> mCacheEntries;
nsCOMPtr<nsIThread> mIOThread;

View File

@ -12,7 +12,7 @@ interface nsIDOMEventListener;
interface nsIFile;
%{C++
class DeviceStorageFileDescriptor;
struct DeviceStorageFileDescriptor;
%}
[ptr] native DeviceStorageFdPtr(DeviceStorageFileDescriptor);

View File

@ -50,6 +50,7 @@ using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/Comp
using mozilla::CSSPoint from "Units.h";
using mozilla::CSSToScreenScale from "Units.h";
using mozilla::CommandInt from "mozilla/EventForwards.h";
using mozilla::layers::GeckoContentController::APZStateChange from "mozilla/layers/GeckoContentController.h";
namespace mozilla {
namespace dom {
@ -410,11 +411,10 @@ child:
HandleLongTapUp(CSSPoint point, ScrollableLayerGuid aGuid);
/**
* Notifies the child that the parent has begun or finished transforming
* the visible child content area. Useful for showing/hiding scrollbars.
* Notifies the child about various APZ state changes.
* See GeckoContentController::NotifyAPZStateChange() for details.
*/
NotifyTransformBegin(ViewID aViewId);
NotifyTransformEnd(ViewID aViewId);
NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg);
/**
* Sending an activate message moves focus to the child.

View File

@ -74,6 +74,7 @@
#include "mozilla/gfx/Matrix.h"
#include "UnitTransforms.h"
#include "ClientLayerManager.h"
#include "ActiveElementManager.h"
#include "nsColorPickerProxy.h"
@ -687,6 +688,7 @@ TabChild::TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t
, mContextMenuHandled(false)
, mWaitingTouchListeners(false)
, mIgnoreKeyPressEvent(false)
, mActiveElementManager(new ActiveElementManager())
{
if (!sActiveDurationMsSet) {
Preferences::AddIntVarCache(&sActiveDurationMs,
@ -1730,23 +1732,49 @@ TabChild::RecvHandleLongTapUp(const CSSPoint& aPoint, const ScrollableLayerGuid&
}
bool
TabChild::RecvNotifyTransformBegin(const ViewID& aViewId)
TabChild::RecvNotifyAPZStateChange(const ViewID& aViewId,
const APZStateChange& aChange,
const int& aArg)
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStarted();
switch (aChange)
{
case APZStateChange::TransformBegin:
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStarted();
}
break;
}
return true;
}
bool
TabChild::RecvNotifyTransformEnd(const ViewID& aViewId)
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStopped();
case APZStateChange::TransformEnd:
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStopped();
}
break;
}
case APZStateChange::StartTouch:
{
mActiveElementManager->HandleTouchStart(aArg);
break;
}
case APZStateChange::StartPanning:
{
mActiveElementManager->HandlePanStart();
break;
}
case APZStateChange::EndTouch:
{
mActiveElementManager->HandleTouchEnd(aArg);
break;
}
default:
// APZStateChange has a 'sentinel' value, and the compiler complains
// if an enumerator is not handled and there is no 'default' case.
break;
}
return true;
}
@ -1951,6 +1979,10 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
return true;
}
if (aEvent.message == NS_TOUCH_START && localEvent.touches.Length() > 0) {
mActiveElementManager->SetTargetElement(localEvent.touches[0]->Target());
}
nsCOMPtr<nsPIDOMWindow> outerWindow = do_GetInterface(WebNavigation());
nsCOMPtr<nsPIDOMWindow> innerWindow = outerWindow->GetCurrentInnerWindow();

View File

@ -42,6 +42,10 @@ namespace layout {
class RenderFrameChild;
}
namespace widget {
class ActiveElementManager;
}
namespace dom {
class TabChild;
@ -228,6 +232,7 @@ class TabChild : public PBrowserChild,
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
typedef mozilla::layout::RenderFrameChild RenderFrameChild;
typedef mozilla::layout::ScrollingBehavior ScrollingBehavior;
typedef mozilla::widget::ActiveElementManager ActiveElementManager;
public:
/**
@ -296,8 +301,9 @@ public:
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
virtual bool RecvHandleLongTapUp(const CSSPoint& aPoint,
const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
virtual bool RecvNotifyTransformBegin(const ViewID& aViewId) MOZ_OVERRIDE;
virtual bool RecvNotifyTransformEnd(const ViewID& aViewId) MOZ_OVERRIDE;
virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId,
const APZStateChange& aChange,
const int& aArg) MOZ_OVERRIDE;
virtual bool RecvActivate() MOZ_OVERRIDE;
virtual bool RecvDeactivate() MOZ_OVERRIDE;
virtual bool RecvMouseEvent(const nsString& aType,
@ -544,6 +550,7 @@ private:
void FireSingleTapEvent(LayoutDevicePoint aPoint);
bool mIgnoreKeyPressEvent;
nsRefPtr<ActiveElementManager> mActiveElementManager;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};

View File

@ -554,17 +554,12 @@ void TabParent::HandleLongTapUp(const CSSPoint& aPoint,
}
}
void TabParent::NotifyTransformBegin(ViewID aViewId)
void TabParent::NotifyAPZStateChange(ViewID aViewId,
APZStateChange aChange,
int aArg)
{
if (!mIsDestroyed) {
unused << SendNotifyTransformBegin(aViewId);
}
}
void TabParent::NotifyTransformEnd(ViewID aViewId)
{
if (!mIsDestroyed) {
unused << SendNotifyTransformEnd(aViewId);
unused << SendNotifyAPZStateChange(aViewId, aChange, aArg);
}
}

View File

@ -212,8 +212,9 @@ public:
void HandleLongTapUp(const CSSPoint& aPoint,
int32_t aModifiers,
const ScrollableLayerGuid& aGuid);
void NotifyTransformBegin(ViewID aViewId);
void NotifyTransformEnd(ViewID aViewId);
void NotifyAPZStateChange(ViewID aViewId,
APZStateChange aChange,
int aArg);
void Activate();
void Deactivate();

View File

@ -11,7 +11,7 @@
#include "nsGlobalWindow.h"
#include "nsClassHashtable.h"
#include "nsRefPtrHashtable.h"
#include "nsObserverService.h"
#include "nsIObserver.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"

View File

@ -163,12 +163,12 @@ private:
/***************************************************************************/
class AutoMounter : public RefCounted<AutoMounter>
class AutoMounter
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(AutoMounter)
NS_INLINE_DECL_REFCOUNTING(AutoMounter)
typedef nsTArray<RefPtr<Volume> > VolumeArray;
typedef nsTArray<RefPtr<Volume>> VolumeArray;
AutoMounter()
: mResponseCallback(new AutoMounterResponseCallback),
@ -692,21 +692,21 @@ UsbCableEventIOThread()
*
**************************************************************************/
class UsbCableObserver : public SwitchObserver,
public RefCounted<UsbCableObserver>
class UsbCableObserver MOZ_FINAL : public SwitchObserver
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(UsbCableObserver)
UsbCableObserver()
{
RegisterSwitchObserver(SWITCH_USB, this);
}
~UsbCableObserver()
{
UnregisterSwitchObserver(SWITCH_USB, this);
}
public:
NS_INLINE_DECL_REFCOUNTING(UsbCableObserver)
UsbCableObserver()
{
RegisterSwitchObserver(SWITCH_USB, this);
}
virtual void Notify(const SwitchEvent& aEvent)
{
DBG("UsbCable switch device: %d state: %s\n",

View File

@ -9,7 +9,7 @@
#include "nsIVolume.h"
#include "nsString.h"
#include "mozilla/Observer.h"
#include "mozilla/RefPtr.h"
#include "nsISupportsImpl.h"
#include "nsWhitespaceTokenizer.h"
namespace mozilla {
@ -24,10 +24,11 @@ namespace system {
*
***************************************************************************/
class Volume : public RefCounted<Volume>
class Volume MOZ_FINAL
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Volume)
NS_INLINE_DECL_REFCOUNTING(Volume)
Volume(const nsCSubstring& aVolumeName);
typedef long STATE; // States are now defined in nsIVolume.idl

View File

@ -6,6 +6,7 @@
#define mozilla_system_volumecommand_h__
#include "nsString.h"
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
#include <algorithm>
#include <vold/ResponseCode.h>
@ -32,15 +33,16 @@ class VolumeCommand;
*
***************************************************************************/
class VolumeResponseCallback : public RefCounted<VolumeResponseCallback>
class VolumeResponseCallback
{
protected:
virtual ~VolumeResponseCallback() {}
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeResponseCallback)
NS_INLINE_DECL_REFCOUNTING(VolumeResponseCallback)
VolumeResponseCallback()
: mResponseCode(0), mPending(false) {}
virtual ~VolumeResponseCallback() {}
bool Done() const
{
// Response codes from the 200, 400, and 500 series all indicated that
@ -106,10 +108,14 @@ private:
*
***************************************************************************/
class VolumeCommand : public RefCounted<VolumeCommand>
class VolumeCommand
{
protected:
virtual ~VolumeCommand() {}
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeCommand)
NS_INLINE_DECL_REFCOUNTING(VolumeCommand)
VolumeCommand(VolumeResponseCallback* aCallback)
: mBytesConsumed(0),
mCallback(aCallback)
@ -124,8 +130,6 @@ public:
SetCmd(aCommand);
}
virtual ~VolumeCommand() {}
void SetCmd(const nsACString& aCommand)
{
mCmd.Truncate();

View File

@ -11,7 +11,7 @@
#include "base/message_loop.h"
#include "mozilla/FileUtils.h"
#include "mozilla/Observer.h"
#include "mozilla/RefPtr.h"
#include "nsISupportsImpl.h"
#include "nsString.h"
#include "nsTArray.h"
@ -73,16 +73,16 @@ namespace system {
*
***************************************************************************/
class VolumeManager : public MessageLoopForIO::LineWatcher,
public RefCounted<VolumeManager>
class VolumeManager MOZ_FINAL : public MessageLoopForIO::LineWatcher
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeManager)
virtual ~VolumeManager();
typedef nsTArray<RefPtr<Volume> > VolumeArray;
public:
NS_INLINE_DECL_REFCOUNTING(VolumeManager)
typedef nsTArray<RefPtr<Volume>> VolumeArray;
VolumeManager();
virtual ~VolumeManager();
//-----------------------------------------------------------------------
//

View File

@ -19,14 +19,15 @@ class nsVolumeService;
* class, but whose methods are called from IOThread.
*/
class VolumeServiceIOThread : public VolumeManager::StateObserver,
public Volume::EventObserver,
public RefCounted<VolumeServiceIOThread>
public Volume::EventObserver
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeServiceIOThread)
VolumeServiceIOThread(nsVolumeService* aVolumeService);
~VolumeServiceIOThread();
public:
NS_INLINE_DECL_REFCOUNTING(VolumeServiceIOThread)
VolumeServiceIOThread(nsVolumeService* aVolumeService);
private:
void UpdateAllVolumes();

View File

@ -334,6 +334,20 @@ interface CameraControl : MediaStream
void setConfiguration(optional CameraConfiguration configuration,
optional CameraSetConfigurationCallback onSuccess,
optional CameraErrorCallback onError);
/* if focusMode is set to either 'continuous-picture' or 'continuous-video',
then calling autoFocus() will trigger its onSuccess callback immediately
if the camera was either successfully focused, or if no focus could be
acquired; if the focus acquisition is still in progress, the onSuccess
callback will be invoked later, its argument indicating success or
failure.
once autoFocus() is called with a continuous autofocus mode set, the
continuous autofocus process is stopped and focus is locked in the
current state until this method is called.
*/
[Throws]
void resumeContinuousFocus();
};
/* The coordinates of a point, relative to the camera sensor, of the center of

View File

@ -53,11 +53,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=821850
is(typeof bound.wrappedJSObject.unexposedProperty, 'undefined',
"Unexposed property should not be defined in content");
// Check that here document.QueryInterface works
ok("QueryInterface" in document,
"Should have a document.QueryInterface here");
is(document.QueryInterface(Components.interfaces.nsIDOMDocument),
document, "Should be able to QI the document");
// Check that here HTMLImageElement.QueryInterface works
var img = document.querySelector("img");
ok("QueryInterface" in img,
"Should have a img.QueryInterface here");
is(img.QueryInterface(Components.interfaces.nsIImageLoadingContent),
img, "Should be able to QI the image");
// Make sure standard constructors work right in the presence of
// sandboxPrototype and Xray-resolved constructors.
@ -289,6 +290,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=821850
<div id="content">
<div id="bound">Bound element</div>
<div id="bound2">Bound element</div>
<img/>
</div>
<pre id="test">
</pre>

View File

@ -165,34 +165,34 @@ INSERT_TESTS = {
'tests': [
{ 'id': 'IIMG:url_TEXT-1_SC',
'rte1-id': 'a-insertimage-0',
'desc': 'Insert image with URL "http://goo.gl/bar.png"',
'value': 'http://goo.gl/bar.png',
'desc': 'Insert image with URL "bar.png"',
'value': 'bar.png',
'checkAttrs': True,
'pad': 'foo^bar',
'expected': [ 'foo<img src="http://goo.gl/bar.png">|bar',
'foo<img src="http://goo.gl/bar.png">^bar' ] },
'expected': [ 'foo<img src="bar.png">|bar',
'foo<img src="bar.png">^bar' ] },
{ 'id': 'IIMG:url_IMG-1_SO',
'desc': 'Change existing image to new URL, selection on <img>',
'value': 'http://baz.com/quz.png',
'value': 'quz.png',
'checkAttrs': True,
'pad': '<span>foo{<img src="http://goo.gl/bar.png">}bar</span>',
'expected': [ '<span>foo<img src="http://baz.com/quz.png"/>|bar</span>',
'<span>foo<img src="http://baz.com/quz.png"/>^bar</span>' ] },
'pad': '<span>foo{<img src="bar.png">}bar</span>',
'expected': [ '<span>foo<img src="quz.png"/>|bar</span>',
'<span>foo<img src="quz.png"/>^bar</span>' ] },
{ 'id': 'IIMG:url_SPAN-IMG-1_SO',
'desc': 'Change existing image to new URL, selection in text surrounding <img>',
'value': 'http://baz.com/quz.png',
'value': 'quz.png',
'checkAttrs': True,
'pad': 'foo[<img src="http://goo.gl/bar.png">]bar',
'expected': [ 'foo<img src="http://baz.com/quz.png"/>|bar',
'foo<img src="http://baz.com/quz.png"/>^bar' ] },
'pad': 'foo[<img src="bar.png">]bar',
'expected': [ 'foo<img src="quz.png"/>|bar',
'foo<img src="quz.png"/>^bar' ] },
{ 'id': 'IIMG:._SPAN-IMG-1_SO',
'desc': 'Remove existing image or URL, selection on <img>',
'value': '',
'checkAttrs': True,
'pad': '<span>foo{<img src="http://goo.gl/bar.png">}bar</span>',
'pad': '<span>foo{<img src="bar.png">}bar</span>',
'expected': [ '<span>foo^bar</span>',
'<span>foo<img>|bar</span>',
'<span>foo<img>^bar</span>',
@ -203,7 +203,7 @@ INSERT_TESTS = {
'desc': 'Remove existing image or URL, selection in text surrounding <img>',
'value': '',
'checkAttrs': True,
'pad': 'foo[<img src="http://goo.gl/bar.png">]bar',
'pad': 'foo[<img src="bar.png">]bar',
'expected': [ 'foo^bar',
'foo<img>|bar',
'foo<img>^bar',

View File

@ -416,7 +416,7 @@ public:
*/
virtual TemporaryRef<DataSourceSurface> GetDataSurface();
DebugOnly<bool> mIsMapped;
bool mIsMapped;
};
/* This is an abstract object that accepts path segments. */

View File

@ -25,19 +25,21 @@ CopySurfaceDataToPackedArray(uint8_t* aSrc, uint8_t* aDst, IntSize aSrcSize,
/**
* Convert aSurface to a packed buffer in BGRA format. The pixel data is
* returned in a buffer allocated with new uint8_t[].
* returned in a buffer allocated with new uint8_t[]. The caller then has
* ownership of the buffer and is responsible for delete[]'ing it.
*/
uint8_t*
SurfaceToPackedBGRA(DataSourceSurface *aSurface);
/**
* Convert aSurface to a packed buffer in BGR format. The pixel data is
* returned in a buffer allocated with new uint8_t[].
* returned in a buffer allocated with new uint8_t[]. The caller then has
* ownership of the buffer and is responsible for delete[]'ing it.
*
* This function is currently only intended for use with surfaces of format
* SurfaceFormat::B8G8R8X8 since the X components of the pixel data are simply
* dropped (no attempt is made to un-pre-multiply alpha from the color
* components).
* SurfaceFormat::B8G8R8X8 since the X components of the pixel data (if any)
* are simply dropped (no attempt is made to un-pre-multiply alpha from the
* color components).
*/
uint8_t*
SurfaceToPackedBGR(DataSourceSurface *aSurface);

View File

@ -24,6 +24,8 @@ SharedSurface_GL::ProdCopy(SharedSurface_GL* src, SharedSurface_GL* dest,
{
GLContext* gl = src->GL();
gl->MakeCurrent();
if (src->AttachType() == AttachmentType::Screen &&
dest->AttachType() == AttachmentType::Screen)
{

View File

@ -26,6 +26,7 @@
#include "mozilla/layers/CompositorTypes.h"
#include "FrameMetrics.h"
#include "FilterSupport.h"
#include "mozilla/layers/GeckoContentController.h"
#ifdef _MSC_VER
#pragma warning( disable : 4800 )
@ -1069,6 +1070,16 @@ struct ParamTraits<mozilla::gfx::FilterDescription>
}
};
typedef mozilla::layers::GeckoContentController::APZStateChange APZStateChange;
template <>
struct ParamTraits<APZStateChange>
: public ContiguousTypedEnumSerializer<
APZStateChange,
APZStateChange::TransformBegin,
APZStateChange::APZStateChangeSentinel>
{};
} /* namespace IPC */
#endif /* __GFXMESSAGEUTILS_H__ */

View File

@ -137,18 +137,12 @@ enum SurfaceInitMode
/**
* A base class for a platform-dependent helper for use by TextureHost.
*/
class CompositorBackendSpecificData : public RefCounted<CompositorBackendSpecificData>
class CompositorBackendSpecificData
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositorBackendSpecificData)
CompositorBackendSpecificData()
{
MOZ_COUNT_CTOR(CompositorBackendSpecificData);
}
virtual ~CompositorBackendSpecificData()
{
MOZ_COUNT_DTOR(CompositorBackendSpecificData);
}
NS_INLINE_DECL_REFCOUNTING(CompositorBackendSpecificData)
protected:
virtual ~CompositorBackendSpecificData() {}
};
/**
@ -195,21 +189,20 @@ public:
* The target and viewport methods can be called before any DrawQuad call and
* affect any subsequent DrawQuad calls.
*/
class Compositor : public RefCounted<Compositor>
class Compositor
{
protected:
virtual ~Compositor() {}
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Compositor)
NS_INLINE_DECL_REFCOUNTING(Compositor)
Compositor(PCompositorParent* aParent = nullptr)
: mCompositorID(0)
, mDiagnosticTypes(DIAGNOSTIC_NONE)
, mParent(aParent)
, mScreenRotation(ROTATION_0)
{
MOZ_COUNT_CTOR(Compositor);
}
virtual ~Compositor()
{
MOZ_COUNT_DTOR(Compositor);
}
virtual TemporaryRef<DataTextureSource> CreateDataTextureSource(TextureFlags aFlags = 0) = 0;

View File

@ -37,15 +37,18 @@ namespace layers {
* to the compositor by the compositable host as a parameter to DrawQuad.
*/
struct Effect : public RefCounted<Effect>
struct Effect
{
MOZ_DECLARE_REFCOUNTED_TYPENAME(Effect)
NS_INLINE_DECL_REFCOUNTING(Effect)
Effect(EffectTypes aType) : mType(aType) {}
EffectTypes mType;
virtual void PrintInfo(nsACString& aTo, const char* aPrefix) = 0;
protected:
virtual ~Effect() {}
virtual void PrintInfo(nsACString& aTo, const char* aPrefix) =0;
};
// Render from a texture

View File

@ -68,14 +68,16 @@ class TextureClientData;
* where we have a different way of interfacing with the textures - in terms of
* drawing into the compositable and/or passing its contents to the compostior.
*/
class CompositableClient : public AtomicRefCounted<CompositableClient>
class CompositableClient
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableClient)
CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = 0);
protected:
virtual ~CompositableClient();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositableClient)
CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = 0);
virtual TextureInfo GetTextureInfo() const = 0;
LayersBackend GetCompositorBackendType() const;

View File

@ -19,14 +19,8 @@ namespace layers {
class ISurfaceAllocator;
class SimpleTextureClientPool : public RefCounted<SimpleTextureClientPool>
class SimpleTextureClientPool
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SimpleTextureClientPool)
SimpleTextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
ISurfaceAllocator *aAllocator);
~SimpleTextureClientPool()
{
for (auto it = mOutstandingTextureClients.begin(); it != mOutstandingTextureClients.end(); ++it) {
@ -34,6 +28,12 @@ public:
}
}
public:
NS_INLINE_DECL_REFCOUNTING(SimpleTextureClientPool)
SimpleTextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
ISurfaceAllocator *aAllocator);
/**
* If a TextureClient is AutoRecycled, when the last reference is
* released this object will be automatically return to the pool as

View File

@ -75,23 +75,17 @@ namespace layers {
* TextureClient's data until the compositor side confirmed that it is safe to
* deallocte or recycle the it.
*/
class TextureChild : public PTextureChild
, public AtomicRefCounted<TextureChild>
class TextureChild MOZ_FINAL : public PTextureChild
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureChild)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureChild)
TextureChild()
: mForwarder(nullptr)
, mTextureData(nullptr)
, mTextureClient(nullptr)
, mIPCOpen(false)
{
MOZ_COUNT_CTOR(TextureChild);
}
~TextureChild()
{
MOZ_COUNT_DTOR(TextureChild);
}
bool Recv__delete__() MOZ_OVERRIDE;

View File

@ -18,13 +18,15 @@ namespace layers {
class ISurfaceAllocator;
class TextureClientPool : public RefCounted<TextureClientPool>
class TextureClientPool MOZ_FINAL
{
~TextureClientPool();
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureClientPool)
NS_INLINE_DECL_REFCOUNTING(TextureClientPool)
TextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
ISurfaceAllocator *aAllocator);
~TextureClientPool();
/**
* Gets an allocated TextureClient of size and format that are determined

View File

@ -47,11 +47,13 @@ class ClientLayerManager;
// A class to help implement copy-on-write semantics for shared tiles.
class gfxSharedReadLock : public AtomicRefCounted<gfxSharedReadLock> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(gfxSharedReadLock)
class gfxSharedReadLock {
protected:
virtual ~gfxSharedReadLock() {}
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxSharedReadLock)
virtual int32_t ReadLock() = 0;
virtual int32_t ReadUnlock() = 0;
virtual int32_t GetReadCount() = 0;

View File

@ -779,7 +779,6 @@ APZCTreeManager::HandOffFling(AsyncPanZoomController* aPrev, ScreenPoint aVeloci
next->TakeOverFling(transformedVelocity);
}
bool
APZCTreeManager::FlushRepaintsForOverscrollHandoffChain()
{
@ -796,6 +795,30 @@ APZCTreeManager::FlushRepaintsForOverscrollHandoffChain()
return true;
}
bool
APZCTreeManager::CanBePanned(AsyncPanZoomController* aApzc)
{
MonitorAutoLock lock(mTreeLock); // to access mOverscrollHandoffChain
// Find |aApzc| in the handoff chain.
uint32_t i;
for (i = 0; i < mOverscrollHandoffChain.length(); ++i) {
if (mOverscrollHandoffChain[i] == aApzc) {
break;
}
}
// See whether any APZC in the handoff chain starting from |aApzc|
// has room to be panned.
for (uint32_t j = i; j < mOverscrollHandoffChain.length(); ++j) {
if (mOverscrollHandoffChain[j]->IsPannable()) {
return true;
}
}
return false;
}
bool
APZCTreeManager::HitTestAPZC(const ScreenIntPoint& aPoint)
{

View File

@ -214,6 +214,7 @@ public:
* Sets allowed touch behavior values for current touch-session for specific apzc (determined by guid).
* Should be invoked by the widget. Each value of the aValues arrays corresponds to the different
* touch point that is currently active.
* Must be called after receiving the TOUCH_START event that starts the touch-session.
*/
void SetAllowedTouchBehavior(const ScrollableLayerGuid& aGuid,
const nsTArray<TouchBehaviorFlags>& aValues);
@ -271,6 +272,13 @@ public:
bool FlushRepaintsForOverscrollHandoffChain();
/**
* Determine whether |aApzc|, or any APZC along its overscroll handoff chain,
* has room to be panned.
* Expects the overscroll handoff chain to already be built.
*/
bool CanBePanned(AsyncPanZoomController* aApzc);
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~APZCTreeManager();

View File

@ -61,22 +61,21 @@ struct ViewTransform {
* short circuit that stuff to directly affect layers as they are composited,
* for example, off-main thread animation, async video, async pan/zoom.
*/
class AsyncCompositionManager MOZ_FINAL : public RefCounted<AsyncCompositionManager>
class AsyncCompositionManager MOZ_FINAL
{
friend class AutoResolveRefLayers;
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(AsyncCompositionManager)
NS_INLINE_DECL_REFCOUNTING(AsyncCompositionManager)
AsyncCompositionManager(LayerManagerComposite* aManager)
: mLayerManager(aManager)
, mIsFirstPaint(false)
, mLayersUpdated(false)
, mReadyForCompose(true)
{
MOZ_COUNT_CTOR(AsyncCompositionManager);
}
~AsyncCompositionManager()
{
MOZ_COUNT_DTOR(AsyncCompositionManager);
}
/**

View File

@ -56,18 +56,18 @@ struct EffectChain;
/**
* A base class for doing CompositableHost and platform dependent task on TextureHost.
*/
class CompositableBackendSpecificData : public RefCounted<CompositableBackendSpecificData>
class CompositableBackendSpecificData
{
protected:
virtual ~CompositableBackendSpecificData() { }
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableBackendSpecificData)
NS_INLINE_DECL_REFCOUNTING(CompositableBackendSpecificData)
CompositableBackendSpecificData()
{
MOZ_COUNT_CTOR(CompositableBackendSpecificData);
}
virtual ~CompositableBackendSpecificData()
{
MOZ_COUNT_DTOR(CompositableBackendSpecificData);
}
virtual void SetCompositor(Compositor* aCompositor) {}
virtual void ClearData()
{
@ -124,14 +124,15 @@ protected:
* will use its TextureHost(s) and call Compositor::DrawQuad to do the actual
* rendering.
*/
class CompositableHost : public RefCounted<CompositableHost>
class CompositableHost
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableHost)
CompositableHost(const TextureInfo& aTextureInfo);
protected:
virtual ~CompositableHost();
public:
NS_INLINE_DECL_REFCOUNTING(CompositableHost)
CompositableHost(const TextureInfo& aTextureInfo);
static TemporaryRef<CompositableHost> Create(const TextureInfo& aTextureInfo);
virtual CompositableType GetType() = 0;

View File

@ -7,6 +7,7 @@
#define GFX_TextRenderer_H
#include "mozilla/gfx/2D.h"
#include "nsISupportsImpl.h"
#include <string>
namespace mozilla {
@ -14,10 +15,11 @@ namespace layers {
class Compositor;
class TextRenderer : public RefCounted<TextRenderer>
class TextRenderer
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextRenderer)
NS_INLINE_DECL_REFCOUNTING(TextRenderer)
TextRenderer(Compositor *aCompositor)
: mCompositor(aCompositor)
{

View File

@ -80,13 +80,16 @@ public:
*
* This class is used on the compositor side.
*/
class TextureSource : public RefCounted<TextureSource>
class TextureSource
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureSource)
TextureSource();
protected:
virtual ~TextureSource();
public:
NS_INLINE_DECL_REFCOUNTING(TextureSource)
TextureSource();
/**
* Return the size of the texture in texels.
* If this is a tile iterator, GetSize must return the size of the current tile.

View File

@ -132,6 +132,7 @@ namespace mozilla {
namespace layers {
typedef mozilla::layers::AllowedTouchBehavior AllowedTouchBehavior;
typedef GeckoContentController::APZStateChange APZStateChange;
/*
* The following prefs are used to control the behaviour of the APZC.
@ -420,9 +421,6 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
mCurrentAsyncScrollOffset(0, 0),
mAsyncScrollTimeoutTask(nullptr),
mHandlingTouchQueue(false),
mAllowedTouchBehaviorSet(false),
mPreventDefault(false),
mPreventDefaultSet(false),
mTreeManager(aTreeManager),
mScrollParentId(FrameMetrics::NULL_SCROLL_ID),
mAPZCId(sAsyncPanZoomControllerCount++),
@ -498,6 +496,12 @@ AsyncPanZoomController::GetTouchStartTolerance()
}
nsEventStatus AsyncPanZoomController::ReceiveInputEvent(const InputData& aEvent) {
if (aEvent.mInputType == MULTITOUCH_INPUT &&
aEvent.AsMultiTouchInput().mType == MultiTouchInput::MULTITOUCH_START) {
// Starting a new touch block, clear old touch block state.
mTouchBlockState = TouchBlockState();
}
// If we may have touch listeners and touch action property is enabled, we
// enable the machinery that allows touch listeners to preventDefault any touch inputs
// and also waits for the allowed touch behavior values to be received from the outside.
@ -509,10 +513,6 @@ nsEventStatus AsyncPanZoomController::ReceiveInputEvent(const InputData& aEvent)
(mState == NOTHING || mState == TOUCHING || IsPanningState(mState))) {
const MultiTouchInput& multiTouchInput = aEvent.AsMultiTouchInput();
if (multiTouchInput.mType == MultiTouchInput::MULTITOUCH_START) {
mAllowedTouchBehaviors.Clear();
mAllowedTouchBehaviorSet = false;
mPreventDefault = false;
mPreventDefaultSet = false;
SetState(WAITING_CONTENT_RESPONSE);
}
}
@ -615,11 +615,18 @@ nsEventStatus AsyncPanZoomController::OnTouchStart(const MultiTouchInput& aEvent
case FLING:
CancelAnimation();
// Fall through.
case NOTHING:
case NOTHING: {
mX.StartTouch(point.x);
mY.StartTouch(point.y);
APZCTreeManager* treeManagerLocal = mTreeManager;
if (treeManagerLocal) {
bool touchCanBePan = treeManagerLocal->CanBePanned(this);
mGeckoContentController->NotifyAPZStateChange(
GetGuid(), APZStateChange::StartTouch, touchCanBePan);
}
SetState(TOUCHING);
break;
}
case TOUCHING:
case PANNING:
case PANNING_LOCKED_X:
@ -698,6 +705,8 @@ nsEventStatus AsyncPanZoomController::OnTouchMove(const MultiTouchInput& aEvent)
nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent) {
APZC_LOG("%p got a touch-end in state %d\n", this, mState);
OnTouchEndOrCancel();
// In case no touch behavior triggered previously we can avoid sending
// scroll events or requesting content repaint. This condition is added
// to make tests consistent - in case touch-action is NONE (and therefore
@ -764,6 +773,7 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent)
nsEventStatus AsyncPanZoomController::OnTouchCancel(const MultiTouchInput& aEvent) {
APZC_LOG("%p got a touch-cancel in state %d\n", this, mState);
OnTouchEndOrCancel();
SetState(NOTHING);
return nsEventStatus_eConsumeNoDefault;
}
@ -929,15 +939,12 @@ nsEventStatus AsyncPanZoomController::OnLongPressUp(const TapGestureInput& aEven
return nsEventStatus_eIgnore;
}
nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEvent) {
APZC_LOG("%p got a single-tap-up in state %d\n", this, mState);
nsEventStatus AsyncPanZoomController::GenerateSingleTap(const ScreenIntPoint& aPoint, mozilla::Modifiers aModifiers) {
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
// If mZoomConstraints.mAllowDoubleTapZoom is true we wait for a call to OnSingleTapConfirmed before
// sending event to content
if (controller && !mZoomConstraints.mAllowDoubleTapZoom) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
if (controller) {
CSSPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
if (ConvertToGecko(aPoint, &geckoScreenPoint)) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aModifiers);
// Because this may be being running as part of APZCTreeManager::ReceiveInputEvent,
// calling controller->HandleSingleTap directly might mean that content receives
// the single tap message before the corresponding touch-up. To avoid that we
@ -947,30 +954,33 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven
NewRunnableMethod(controller.get(), &GeckoContentController::HandleSingleTap,
geckoScreenPoint, modifiers, GetGuid()),
0);
mTouchBlockState.mSingleTapOccurred = true;
return nsEventStatus_eConsumeNoDefault;
}
}
return nsEventStatus_eIgnore;
}
nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput& aEvent) {
APZC_LOG("%p got a single-tap-confirmed in state %d\n", this, mState);
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers);
CSSPoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
// See comment in OnSingleTapUp as to why we do this in PostDelayedTask.
controller->PostDelayedTask(
NewRunnableMethod(controller.get(), &GeckoContentController::HandleSingleTap,
geckoScreenPoint, modifiers, GetGuid()),
0);
return nsEventStatus_eConsumeNoDefault;
}
void AsyncPanZoomController::OnTouchEndOrCancel() {
mGeckoContentController->NotifyAPZStateChange(
GetGuid(), APZStateChange::EndTouch, mTouchBlockState.mSingleTapOccurred);
}
nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEvent) {
APZC_LOG("%p got a single-tap-up in state %d\n", this, mState);
// If mZoomConstraints.mAllowDoubleTapZoom is true we wait for a call to OnSingleTapConfirmed before
// sending event to content
if (!mZoomConstraints.mAllowDoubleTapZoom) {
return GenerateSingleTap(aEvent.mPoint, aEvent.modifiers);
}
return nsEventStatus_eIgnore;
}
nsEventStatus AsyncPanZoomController::OnSingleTapConfirmed(const TapGestureInput& aEvent) {
APZC_LOG("%p got a single-tap-confirmed in state %d\n", this, mState);
return GenerateSingleTap(aEvent.mPoint, aEvent.modifiers);
}
nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent) {
APZC_LOG("%p got a double-tap in state %d\n", this, mState);
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
@ -1092,15 +1102,17 @@ nsEventStatus AsyncPanZoomController::StartPanning(const MultiTouchInput& aEvent
} else {
if (GetAxisLockMode() == FREE) {
SetState(PANNING);
return nsEventStatus_eConsumeNoDefault;
} else {
HandlePanning(angle);
}
HandlePanning(angle);
}
if (IsPanningState(mState)) {
mGeckoContentController->NotifyAPZStateChange(GetGuid(), APZStateChange::StartPanning);
return nsEventStatus_eConsumeNoDefault;
}
// Don't consume an event that didn't trigger a panning.
return IsPanningState(mState) ? nsEventStatus_eConsumeNoDefault
: nsEventStatus_eIgnore;
return nsEventStatus_eIgnore;
}
void AsyncPanZoomController::UpdateWithTouchAtDevicePoint(const MultiTouchInput& aEvent) {
@ -1445,6 +1457,11 @@ void AsyncPanZoomController::FlushRepaintForOverscrollHandoff() {
UpdateSharedCompositorFrameMetrics();
}
bool AsyncPanZoomController::IsPannable() const {
ReentrantMonitorAutoEnter lock(mMonitor);
return mX.HasRoomToPan() || mY.HasRoomToPan();
}
void AsyncPanZoomController::RequestContentRepaint() {
RequestContentRepaint(mFrameMetrics);
}
@ -1890,8 +1907,8 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
}
void AsyncPanZoomController::ContentReceivedTouch(bool aPreventDefault) {
mPreventDefaultSet = true;
mPreventDefault = aPreventDefault;
mTouchBlockState.mPreventDefaultSet = true;
mTouchBlockState.mPreventDefault = aPreventDefault;
CheckContentResponse();
}
@ -1899,11 +1916,11 @@ void AsyncPanZoomController::CheckContentResponse() {
bool canProceedToTouchState = true;
if (mFrameMetrics.mMayHaveTouchListeners) {
canProceedToTouchState &= mPreventDefaultSet;
canProceedToTouchState &= mTouchBlockState.mPreventDefaultSet;
}
if (mTouchActionPropertyEnabled) {
canProceedToTouchState &= mAllowedTouchBehaviorSet;
canProceedToTouchState &= mTouchBlockState.mAllowedTouchBehaviorSet;
}
if (!canProceedToTouchState) {
@ -1916,14 +1933,14 @@ void AsyncPanZoomController::CheckContentResponse() {
}
if (mState == WAITING_CONTENT_RESPONSE) {
if (!mPreventDefault) {
if (!mTouchBlockState.mPreventDefault) {
SetState(NOTHING);
}
mHandlingTouchQueue = true;
while (!mTouchQueue.IsEmpty()) {
if (!mPreventDefault) {
if (!mTouchBlockState.mPreventDefault) {
HandleInputEvent(mTouchQueue[0]);
}
@ -1947,8 +1964,8 @@ bool AsyncPanZoomController::TouchActionAllowZoom() {
// Pointer events specification implies all touch points to allow zoom
// to perform it.
for (size_t i = 0; i < mAllowedTouchBehaviors.Length(); i++) {
if (!(mAllowedTouchBehaviors[i] & AllowedTouchBehavior::ZOOM)) {
for (size_t i = 0; i < mTouchBlockState.mAllowedTouchBehaviors.Length(); i++) {
if (!(mTouchBlockState.mAllowedTouchBehaviors[i] & AllowedTouchBehavior::ZOOM)) {
return false;
}
}
@ -1958,8 +1975,8 @@ bool AsyncPanZoomController::TouchActionAllowZoom() {
AsyncPanZoomController::TouchBehaviorFlags
AsyncPanZoomController::GetTouchBehavior(uint32_t touchIndex) {
if (touchIndex < mAllowedTouchBehaviors.Length()) {
return mAllowedTouchBehaviors[touchIndex];
if (touchIndex < mTouchBlockState.mAllowedTouchBehaviors.Length()) {
return mTouchBlockState.mAllowedTouchBehaviors[touchIndex];
}
return DefaultTouchBehavior;
}
@ -1973,9 +1990,9 @@ AsyncPanZoomController::GetAllowedTouchBehavior(ScreenIntPoint& aPoint) {
}
void AsyncPanZoomController::SetAllowedTouchBehavior(const nsTArray<TouchBehaviorFlags>& aBehaviors) {
mAllowedTouchBehaviors.Clear();
mAllowedTouchBehaviors.AppendElements(aBehaviors);
mAllowedTouchBehaviorSet = true;
mTouchBlockState.mAllowedTouchBehaviors.Clear();
mTouchBlockState.mAllowedTouchBehaviors.AppendElements(aBehaviors);
mTouchBlockState.mAllowedTouchBehaviorSet = true;
CheckContentResponse();
}
@ -1992,11 +2009,11 @@ void AsyncPanZoomController::SetState(PanZoomState aNewState) {
if (mGeckoContentController) {
if (!IsTransformingState(oldState) && IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformBegin(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.GetScrollId()));
mGeckoContentController->NotifyAPZStateChange(
GetGuid(), APZStateChange::TransformBegin);
} else if (IsTransformingState(oldState) && !IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformEnd(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.GetScrollId()));
mGeckoContentController->NotifyAPZStateChange(
GetGuid(), APZStateChange::TransformEnd);
}
}
}

View File

@ -315,6 +315,8 @@ public:
* Sets allowed touch behavior for current touch session.
* This method is invoked by the APZCTreeManager which in its turn invoked by
* the widget after performing touch-action values retrieving.
* Must be called after receiving the TOUCH_START even that started the
* touch session.
*/
void SetAllowedTouchBehavior(const nsTArray<TouchBehaviorFlags>& aBehaviors);
@ -332,6 +334,11 @@ public:
mTestAsyncScrollOffset = aPoint;
}
/**
* Returns whether this APZC has room to be panned (in any direction).
*/
bool IsPannable() const;
protected:
// Protected destructor, to discourage deletion outside of Release():
~AsyncPanZoomController();
@ -557,6 +564,36 @@ private:
was not set yet. we still need to abort animations. */
};
// State related to a single touch block. Does not persist across touch blocks.
struct TouchBlockState {
TouchBlockState()
: mAllowedTouchBehaviorSet(false),
mPreventDefault(false),
mPreventDefaultSet(false),
mSingleTapOccurred(false)
{}
// Values of allowed touch behavior for touch points of this touch block.
// Since there are maybe a few current active touch points per time (multitouch case)
// and each touch point should have its own value of allowed touch behavior- we're
// keeping an array of allowed touch behavior values, not the single value.
nsTArray<TouchBehaviorFlags> mAllowedTouchBehaviors;
// Specifies whether mAllowedTouchBehaviors is set for this touch events block.
bool mAllowedTouchBehaviorSet;
// Flag used to specify that content prevented the default behavior of this
// touch events block.
bool mPreventDefault;
// Specifies whether mPreventDefault property is set for this touch events block.
bool mPreventDefaultSet;
// Specifies whether a single tap event was generated during this touch block.
bool mSingleTapOccurred;
};
/*
* Returns whether current touch behavior values allow zooming.
*/
@ -617,6 +654,12 @@ private:
// changes, as it corresponds to the scale portion of those transforms.
void UpdateTransformScale();
// Helper function for OnSingleTapUp() and OnSingleTapConfirmed().
nsEventStatus GenerateSingleTap(const ScreenIntPoint& aPoint, mozilla::Modifiers aModifiers);
// Common processing at the end of a touch block.
void OnTouchEndOrCancel();
uint64_t mLayersId;
nsRefPtr<CompositorParent> mCompositorParent;
PCompositorParent* mCrossProcessCompositorParent;
@ -643,7 +686,9 @@ protected:
// monitor should be held. When setting |mState|, either the SetState()
// function can be used, or the monitor can be held and then |mState| updated.
// IMPORTANT: See the note about lock ordering at the top of APZCTreeManager.h.
ReentrantMonitor mMonitor;
// This is mutable to allow entering it from 'const' methods; doing otherwise
// would significantly limit what methods could be 'const'.
mutable ReentrantMonitor mMonitor;
// Specifies whether we should use touch-action css property. Initialized from
// the preferences. This property (in comparison with the global one) simplifies
@ -718,21 +763,8 @@ private:
// and we don't want to queue the events back up again.
bool mHandlingTouchQueue;
// Values of allowed touch behavior for current touch points.
// Since there are maybe a few current active touch points per time (multitouch case)
// and each touch point should have its own value of allowed touch behavior- we're
// keeping an array of allowed touch behavior values, not the single value.
nsTArray<TouchBehaviorFlags> mAllowedTouchBehaviors;
// Specifies whether mAllowedTouchBehaviors is set for current touch events block.
bool mAllowedTouchBehaviorSet;
// Flag used to specify that content prevented the default behavior of the current
// touch events block.
bool mPreventDefault;
// Specifies whether mPreventDefault property is set for current touch events block.
bool mPreventDefaultSet;
// Stores information about the current touch block.
TouchBlockState mTouchBlockState;
// Extra offset to add in SampleContentTransformForFrame for testing
CSSPoint mTestAsyncScrollOffset;

View File

@ -207,30 +207,30 @@ void Axis::SetVelocity(float aVelocity) {
mVelocity = aVelocity;
}
float Axis::GetCompositionEnd() {
float Axis::GetCompositionEnd() const {
return GetOrigin() + GetCompositionLength();
}
float Axis::GetPageEnd() {
float Axis::GetPageEnd() const {
return GetPageStart() + GetPageLength();
}
float Axis::GetOrigin() {
float Axis::GetOrigin() const {
CSSPoint origin = mAsyncPanZoomController->GetFrameMetrics().GetScrollOffset();
return GetPointOffset(origin);
}
float Axis::GetCompositionLength() {
float Axis::GetCompositionLength() const {
const FrameMetrics& metrics = mAsyncPanZoomController->GetFrameMetrics();
return GetRectLength(metrics.CalculateCompositedRectInCssPixels());
}
float Axis::GetPageStart() {
float Axis::GetPageStart() const {
CSSRect pageRect = mAsyncPanZoomController->GetFrameMetrics().mScrollableRect;
return GetRectOffset(pageRect);
}
float Axis::GetPageLength() {
float Axis::GetPageLength() const {
CSSRect pageRect = mAsyncPanZoomController->GetFrameMetrics().mScrollableRect;
return GetRectLength(pageRect);
}
@ -244,23 +244,29 @@ bool Axis::ScaleWillOverscrollBothSides(float aScale) {
return GetRectLength(metrics.mScrollableRect) < GetRectLength(cssCompositionBounds);
}
bool Axis::HasRoomToPan() const {
return GetOrigin() > GetPageStart()
|| GetCompositionEnd() < GetPageEnd();
}
AxisX::AxisX(AsyncPanZoomController* aAsyncPanZoomController)
: Axis(aAsyncPanZoomController)
{
}
float AxisX::GetPointOffset(const CSSPoint& aPoint)
float AxisX::GetPointOffset(const CSSPoint& aPoint) const
{
return aPoint.x;
}
float AxisX::GetRectLength(const CSSRect& aRect)
float AxisX::GetRectLength(const CSSRect& aRect) const
{
return aRect.width;
}
float AxisX::GetRectOffset(const CSSRect& aRect)
float AxisX::GetRectOffset(const CSSRect& aRect) const
{
return aRect.x;
}
@ -271,17 +277,17 @@ AxisY::AxisY(AsyncPanZoomController* aAsyncPanZoomController)
}
float AxisY::GetPointOffset(const CSSPoint& aPoint)
float AxisY::GetPointOffset(const CSSPoint& aPoint) const
{
return aPoint.y;
}
float AxisY::GetRectLength(const CSSRect& aRect)
float AxisY::GetRectLength(const CSSRect& aRect) const
{
return aRect.height;
}
float AxisY::GetRectOffset(const CSSRect& aRect)
float AxisY::GetRectOffset(const CSSRect& aRect) const
{
return aRect.y;
}

View File

@ -170,18 +170,23 @@ public:
*/
bool ScaleWillOverscrollBothSides(float aScale);
float GetOrigin();
float GetCompositionLength();
float GetPageStart();
float GetPageLength();
float GetCompositionEnd();
float GetPageEnd();
/**
* Returns whether there is room to pan on this axis in either direction.
*/
bool HasRoomToPan() const;
float GetOrigin() const;
float GetCompositionLength() const;
float GetPageStart() const;
float GetPageLength() const;
float GetCompositionEnd() const;
float GetPageEnd() const;
int32_t GetPos() const { return mPos; }
virtual float GetPointOffset(const CSSPoint& aPoint) = 0;
virtual float GetRectLength(const CSSRect& aRect) = 0;
virtual float GetRectOffset(const CSSRect& aRect) = 0;
virtual float GetPointOffset(const CSSPoint& aPoint) const = 0;
virtual float GetRectLength(const CSSRect& aRect) const = 0;
virtual float GetRectOffset(const CSSRect& aRect) const = 0;
protected:
int32_t mPos;
@ -195,17 +200,17 @@ protected:
class AxisX : public Axis {
public:
AxisX(AsyncPanZoomController* mAsyncPanZoomController);
virtual float GetPointOffset(const CSSPoint& aPoint);
virtual float GetRectLength(const CSSRect& aRect);
virtual float GetRectOffset(const CSSRect& aRect);
virtual float GetPointOffset(const CSSPoint& aPoint) const;
virtual float GetRectLength(const CSSRect& aRect) const;
virtual float GetRectOffset(const CSSRect& aRect) const;
};
class AxisY : public Axis {
public:
AxisY(AsyncPanZoomController* mAsyncPanZoomController);
virtual float GetPointOffset(const CSSPoint& aPoint);
virtual float GetRectLength(const CSSRect& aRect);
virtual float GetRectOffset(const CSSRect& aRect);
virtual float GetPointOffset(const CSSPoint& aPoint) const;
virtual float GetRectLength(const CSSRect& aRect) const;
virtual float GetRectOffset(const CSSRect& aRect) const;
};
}

View File

@ -113,13 +113,42 @@ public:
return false;
}
MOZ_BEGIN_NESTED_ENUM_CLASS(APZStateChange, int8_t)
/**
* APZ started modifying the view (including panning, zooming, and fling).
*/
TransformBegin,
/**
* APZ finished modifying the view.
*/
TransformEnd,
/**
* APZ started a touch.
* |aArg| is 1 if touch can be a pan, 0 otherwise.
*/
StartTouch,
/**
* APZ started a pan.
*/
StartPanning,
/**
* APZ finished processing a touch.
* |aArg| is 1 if touch was a click, 0 otherwise.
*/
EndTouch,
APZStateChangeSentinel
MOZ_END_NESTED_ENUM_CLASS(APZStateChange)
/**
* General tranformation notices for consumers. These fire any time
* the apzc is modifying the view, including panning, zooming, and
* fling.
* General notices of APZ state changes for consumers.
* |aGuid| identifies the APZC originating the state change.
* |aChange| identifies the type of state change
* |aArg| is used by some state changes to pass extra information (see
* the documentation for each state change above)
*/
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid) {}
virtual void NotifyTransformEnd(const ScrollableLayerGuid& aGuid) {}
virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
APZStateChange aChange,
int aArg = 0) {}
GeckoContentController() {}
@ -128,6 +157,8 @@ protected:
virtual ~GeckoContentController() {}
};
MOZ_FINISH_NESTED_ENUM_CLASS(GeckoContentController::APZStateChange)
}
}

View File

@ -331,10 +331,6 @@ static void ReleaseImageClientNow(ImageClient* aClient)
// static
void ImageBridgeChild::DispatchReleaseImageClient(ImageClient* aClient)
{
if (!IsCreated()) {
return;
}
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE,
NewRunnableFunction(&ReleaseImageClientNow, aClient));
@ -349,10 +345,6 @@ static void ReleaseTextureClientNow(TextureClient* aClient)
// static
void ImageBridgeChild::DispatchReleaseTextureClient(TextureClient* aClient)
{
if (!IsCreated()) {
return;
}
sImageBridgeChildSingleton->GetMessageLoop()->PostTask(
FROM_HERE,
NewRunnableFunction(&ReleaseTextureClientNow, aClient));
@ -372,10 +364,6 @@ static void UpdateImageClientNow(ImageClient* aClient, ImageContainer* aContaine
void ImageBridgeChild::DispatchImageClientUpdate(ImageClient* aClient,
ImageContainer* aContainer)
{
if (!IsCreated()) {
return;
}
if (InImageBridgeChildThread()) {
UpdateImageClientNow(aClient, aContainer);
return;
@ -400,10 +388,6 @@ static void FlushAllImagesSync(ImageClient* aClient, ImageContainer* aContainer,
//static
void ImageBridgeChild::FlushAllImages(ImageClient* aClient, ImageContainer* aContainer, bool aExceptFront)
{
if (!IsCreated()) {
return;
}
if (InImageBridgeChildThread()) {
FlushAllImagesNow(aClient, aContainer, aExceptFront);
return;
@ -593,14 +577,15 @@ bool ImageBridgeChild::StartUpOnThread(Thread* aThread)
void ImageBridgeChild::DestroyBridge()
{
if (!IsCreated()) {
return;
}
NS_ABORT_IF_FALSE(!InImageBridgeChildThread(),
"This method must not be called in this thread.");
// ...because we are about to dispatch synchronous messages to the
// ImageBridgeChild thread.
if (!IsCreated()) {
return;
}
ReentrantMonitor barrier("ImageBridgeDestroyTask lock");
ReentrantMonitorAutoEnter autoMon(barrier);
@ -622,8 +607,7 @@ void ImageBridgeChild::DestroyBridge()
bool InImageBridgeChildThread()
{
return ImageBridgeChild::IsCreated() &&
sImageBridgeChildThread->thread_id() == PlatformThread::CurrentId();
return sImageBridgeChildThread->thread_id() == PlatformThread::CurrentId();
}
MessageLoop * ImageBridgeChild::GetMessageLoop() const

View File

@ -23,10 +23,9 @@ class RenderFrameChild;
namespace layers {
class LayerTransactionChild : public PLayerTransactionChild
, public AtomicRefCounted<LayerTransactionChild>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(LayerTransactionChild)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LayerTransactionChild)
/**
* Clean this up, finishing with Send__delete__().
*
@ -43,8 +42,6 @@ protected:
: mIPCOpen(false)
{}
~LayerTransactionChild() { }
friend class AtomicRefCounted<LayerTransactionChild>;
friend class detail::RefCounted<LayerTransactionChild, detail::AtomicRefCount>;
virtual PGrallocBufferChild*
AllocPGrallocBufferChild(const IntSize&,

View File

@ -64,13 +64,14 @@ struct EffectChain;
* This is primarily intended for direct texturing APIs that need to attach
* shared objects (such as an EGLImage) to a gl texture.
*/
class CompositorTexturePoolOGL : public RefCounted<CompositorTexturePoolOGL>
class CompositorTexturePoolOGL
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositorTexturePoolOGL)
protected:
virtual ~CompositorTexturePoolOGL() {}
public:
NS_INLINE_DECL_REFCOUNTING(CompositorTexturePoolOGL)
virtual void Clear() = 0;
virtual GLuint GetTexture(GLenum aTarget, GLenum aEnum) = 0;

View File

@ -230,10 +230,10 @@ namespace FilterWrappers {
// Internally, this is achieved by wrapping the original FilterNode with
// conversion FilterNodes. These filter nodes are cached in such a way that no
// repeated or back-and-forth conversions happen.
class FilterCachedColorModels : public RefCounted<FilterCachedColorModels>
class FilterCachedColorModels
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(FilterCachedColorModels)
NS_INLINE_DECL_REFCOUNTING(FilterCachedColorModels)
// aFilter can be null. In that case, ForColorModel will return a non-null
// completely transparent filter for all color models.
FilterCachedColorModels(DrawTarget* aDT,

View File

@ -34,7 +34,7 @@ typedef enum {
nsLineStyle_kDotted = 3
} nsLineStyle;
class nsRenderingContext
class nsRenderingContext MOZ_FINAL
{
typedef mozilla::gfx::UserData UserData;
typedef mozilla::gfx::UserDataKey UserDataKey;
@ -42,7 +42,6 @@ class nsRenderingContext
public:
nsRenderingContext() : mP2A(0.) {}
// ~nsRenderingContext() {}
NS_INLINE_DECL_REFCOUNTING(nsRenderingContext)
@ -130,7 +129,12 @@ public:
return mUserData.Remove(key);
}
protected:
private:
// Private destructor, to discourage deletion outside of Release():
~nsRenderingContext()
{
}
int32_t GetMaxChunkLength();
nsRefPtr<gfxContext> mThebes;

View File

@ -168,7 +168,14 @@ FrameMetrics TestFrameMetrics() {
* consumed them and triggered scrolling behavior.
*/
static
void ApzcPan(AsyncPanZoomController* apzc, TestAPZCTreeManager* aTreeManager, int& aTime, int aTouchStartY, int aTouchEndY, bool expectIgnoredPan = false, bool hasTouchListeners = false) {
void ApzcPan(AsyncPanZoomController* apzc,
TestAPZCTreeManager* aTreeManager,
int& aTime,
int aTouchStartY,
int aTouchEndY,
bool expectIgnoredPan = false,
bool hasTouchListeners = false,
nsTArray<uint32_t>* aAllowedTouchBehaviors = nullptr) {
const int TIME_BETWEEN_TOUCH_EVENT = 100;
const int OVERCOME_TOUCH_TOLERANCE = 100;
@ -198,6 +205,11 @@ void ApzcPan(AsyncPanZoomController* apzc, TestAPZCTreeManager* aTreeManager, in
EXPECT_EQ(status, touchStartStatus);
// APZC should be in TOUCHING state
// Allowed touch behaviours must be set after sending touch-start.
if (aAllowedTouchBehaviors) {
apzc->SetAllowedTouchBehavior(*aAllowedTouchBehaviors);
}
nsEventStatus touchMoveStatus;
if (expectIgnoredPan) {
// APZC should ignore panning, be in TOUCHING state and therefore return eIgnore.
@ -254,12 +266,11 @@ void DoPanTest(bool aShouldTriggerScroll, bool aShouldUseTouchAction, uint32_t a
ScreenPoint pointOut;
ViewTransform viewTransformOut;
nsTArray<uint32_t> values;
values.AppendElement(aBehavior);
nsTArray<uint32_t> allowedTouchBehaviors;
allowedTouchBehaviors.AppendElement(aBehavior);
// Pan down
apzc->SetAllowedTouchBehavior(values);
ApzcPan(apzc, tm, time, touchStart, touchEnd, !aShouldTriggerScroll);
ApzcPan(apzc, tm, time, touchStart, touchEnd, !aShouldTriggerScroll, false, &allowedTouchBehaviors);
apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut);
if (aShouldTriggerScroll) {
@ -271,8 +282,7 @@ void DoPanTest(bool aShouldTriggerScroll, bool aShouldUseTouchAction, uint32_t a
}
// Pan back
apzc->SetAllowedTouchBehavior(values);
ApzcPan(apzc, tm, time, touchEnd, touchStart, !aShouldTriggerScroll);
ApzcPan(apzc, tm, time, touchEnd, touchStart, !aShouldTriggerScroll, false, &allowedTouchBehaviors);
apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut);
EXPECT_EQ(pointOut, ScreenPoint());
@ -613,11 +623,10 @@ TEST_F(AsyncPanZoomControllerTester, PanWithPreventDefault) {
ViewTransform viewTransformOut;
// Pan down
nsTArray<uint32_t> values;
values.AppendElement(mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
nsTArray<uint32_t> allowedTouchBehaviors;
allowedTouchBehaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
apzc->SetTouchActionEnabled(true);
apzc->SetAllowedTouchBehavior(values);
ApzcPan(apzc, tm, time, touchStart, touchEnd, true, true);
ApzcPan(apzc, tm, time, touchStart, touchEnd, true, true, &allowedTouchBehaviors);
// Send the signal that content has handled and preventDefaulted the touch
// events. This flushes the event queue.
@ -746,16 +755,18 @@ DoLongPressTest(bool aShouldUseTouchAction, uint32_t aBehavior) {
apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
apzc->UpdateZoomConstraints(ZoomConstraints(false, false, CSSToScreenScale(1.0), CSSToScreenScale(1.0)));
nsTArray<uint32_t> values;
values.AppendElement(aBehavior);
apzc->SetTouchActionEnabled(aShouldUseTouchAction);
apzc->SetAllowedTouchBehavior(values);
int time = 0;
nsEventStatus status = ApzcDown(apzc, 10, 10, time);
EXPECT_EQ(nsEventStatus_eConsumeNoDefault, status);
// SetAllowedTouchBehavior() must be called after sending touch-start.
nsTArray<uint32_t> allowedTouchBehaviors;
allowedTouchBehaviors.AppendElement(aBehavior);
apzc->SetAllowedTouchBehavior(allowedTouchBehaviors);
MockFunction<void(std::string checkPointName)> check;
{

View File

@ -73,12 +73,14 @@
#include "TexturePoolOGL.h"
#endif
#ifdef USE_SKIA
#include "mozilla/Hal.h"
#ifdef USE_SKIA
#include "skia/SkGraphics.h"
#include "SkiaGLGlue.h"
#else
class mozilla::gl::SkiaGLGlue : public GenericAtomicRefCounted {
};
#endif
#include "mozilla/Preferences.h"
@ -491,6 +493,12 @@ gfxPlatform::Shutdown()
mozilla::gl::GLContextProviderEGL::Shutdown();
#endif
// This will block this thread untill the ImageBridge protocol is completely
// deleted.
ImageBridgeChild::ShutDown();
CompositorParent::ShutDown();
delete gGfxPlatformPrefsLock;
gfxPrefs::DestroySingleton();
@ -922,7 +930,9 @@ gfxPlatform::InitializeSkiaCacheLimits()
printf_stderr("Determined SkiaGL cache limits: Size %i, Items: %i\n", cacheSizeLimit, cacheItemLimit);
#endif
#ifdef USE_SKIA_GPU
mSkiaGlue->GetGrContext()->setTextureCacheLimits(cacheItemLimit, cacheSizeLimit);
#endif
}
}

View File

@ -12,7 +12,7 @@
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIPropertyBag2.h"
#include "nsObserverService.h"
#include "nsIObserverService.h"
using namespace mozilla;
using namespace mozilla::hal;

View File

@ -12,7 +12,8 @@
#include <mozilla/dom/battery/Constants.h>
#include <mozilla/Services.h>
#include <nsObserverService.h>
#include <nsIObserverService.h>
#include <nsIObserver.h>
#include <dlfcn.h>

View File

@ -294,11 +294,11 @@ public:
} // anonymous namespace
class BatteryObserver : public IUeventObserver,
public RefCounted<BatteryObserver>
class BatteryObserver : public IUeventObserver
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(BatteryObserver)
NS_INLINE_DECL_REFCOUNTING(BatteryObserver)
BatteryObserver()
:mUpdater(new BatteryUpdater())
{

View File

@ -51,10 +51,11 @@ namespace hal_impl {
* SWITCH_STATE=0
* SEQNUM=5038
*/
class SwitchHandler : public RefCounted<SwitchHandler>
class SwitchHandler
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SwitchHandler)
NS_INLINE_DECL_REFCOUNTING(SwitchHandler)
SwitchHandler(const char* aDevPath, SwitchDevice aDevice)
: mDevPath(aDevPath),
mState(SWITCH_STATE_UNKNOWN),
@ -230,21 +231,20 @@ private:
SwitchEvent mEvent;
};
class SwitchEventObserver : public IUeventObserver,
public RefCounted<SwitchEventObserver>
class SwitchEventObserver MOZ_FINAL : public IUeventObserver
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SwitchEventObserver)
SwitchEventObserver() : mEnableCount(0)
{
Init();
}
~SwitchEventObserver()
{
mHandler.Clear();
}
public:
NS_INLINE_DECL_REFCOUNTING(SwitchEventObserver)
SwitchEventObserver() : mEnableCount(0)
{
Init();
}
int GetEnableCount()
{
return mEnableCount;

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