1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

Remove MOZ_WIDGET_GONK [2/2]

Tag #288
This commit is contained in:
wolfbeast
2018-05-13 00:08:52 +02:00
committed by Roy Tam
parent b586913598
commit 2531de02eb
85 changed files with 68 additions and 1357 deletions
+2 -100
View File
@@ -1505,20 +1505,6 @@ DOMAudioNodeMediaStream::CreateTrackUnionStreamAsInput(nsPIDOMWindowInner* aWind
DOMHwMediaStream::DOMHwMediaStream(nsPIDOMWindowInner* aWindow)
: DOMLocalMediaStream(aWindow, nullptr)
{
#ifdef MOZ_WIDGET_GONK
if (!mWindow) {
NS_ERROR("Expected window here.");
mPrincipalHandle = PRINCIPAL_HANDLE_NONE;
return;
}
nsIDocument* doc = mWindow->GetExtantDoc();
if (!doc) {
NS_ERROR("Expected document here.");
mPrincipalHandle = PRINCIPAL_HANDLE_NONE;
return;
}
mPrincipalHandle = MakePrincipalHandle(doc->NodePrincipal());
#endif
}
DOMHwMediaStream::~DOMHwMediaStream()
@@ -1545,31 +1531,8 @@ DOMHwMediaStream::Init(MediaStream* stream, OverlayImage* aImage)
{
SourceMediaStream* srcStream = stream->AsSourceStream();
#ifdef MOZ_WIDGET_GONK
if (aImage) {
mOverlayImage = aImage;
} else {
Data imageData;
imageData.mOverlayId = DEFAULT_IMAGE_ID;
imageData.mSize.width = DEFAULT_IMAGE_WIDTH;
imageData.mSize.height = DEFAULT_IMAGE_HEIGHT;
mOverlayImage = new OverlayImage();
mOverlayImage->SetData(imageData);
}
#endif
if (srcStream) {
VideoSegment segment;
#ifdef MOZ_WIDGET_GONK
const StreamTime delta = STREAM_TIME_MAX; // Because MediaStreamGraph will run out frames in non-autoplay mode,
// we must give it bigger frame length to cover this situation.
RefPtr<Image> image = static_cast<Image*>(mOverlayImage.get());
mozilla::gfx::IntSize size = image->GetSize();
segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle);
#endif
srcStream->AddTrack(TRACK_VIDEO_PRIMARY, 0, new VideoSegment());
srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment);
srcStream->AdvanceKnownTracksTime(STREAM_TIME_MAX);
@@ -1579,30 +1542,13 @@ DOMHwMediaStream::Init(MediaStream* stream, OverlayImage* aImage)
int32_t
DOMHwMediaStream::RequestOverlayId()
{
#ifdef MOZ_WIDGET_GONK
return mOverlayImage->GetOverlayId();
#else
/*** STUB ***/
return -1;
#endif
}
void
DOMHwMediaStream::SetImageSize(uint32_t width, uint32_t height)
{
#ifdef MOZ_WIDGET_GONK
if (mOverlayImage->GetSidebandStream().IsValid()) {
OverlayImage::SidebandStreamData imgData;
imgData.mStream = mOverlayImage->GetSidebandStream();
imgData.mSize = IntSize(width, height);
mOverlayImage->SetData(imgData);
} else {
OverlayImage::Data imgData;
imgData.mOverlayId = mOverlayImage->GetOverlayId();
imgData.mSize = IntSize(width, height);
mOverlayImage->SetData(imgData);
}
#endif
SourceMediaStream* srcStream = GetInputStream()->AsSourceStream();
StreamTracks::Track* track = srcStream->FindTrack(TRACK_VIDEO_PRIMARY);
@@ -1610,23 +1556,6 @@ DOMHwMediaStream::SetImageSize(uint32_t width, uint32_t height)
return;
}
#ifdef MOZ_WIDGET_GONK
// Clear the old segment.
// Changing the existing content of segment is a Very BAD thing, and this way will
// confuse consumers of MediaStreams.
// It is only acceptable for DOMHwMediaStream
// because DOMHwMediaStream doesn't have consumers of TV streams currently.
track->GetSegment()->Clear();
// Change the image size.
const StreamTime delta = STREAM_TIME_MAX;
RefPtr<Image> image = static_cast<Image*>(mOverlayImage.get());
mozilla::gfx::IntSize size = image->GetSize();
VideoSegment segment;
segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle);
srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment);
#endif
}
void
@@ -1635,9 +1564,6 @@ DOMHwMediaStream::SetOverlayImage(OverlayImage* aImage)
if (!aImage) {
return;
}
#ifdef MOZ_WIDGET_GONK
mOverlayImage = aImage;
#endif
SourceMediaStream* srcStream = GetInputStream()->AsSourceStream();
StreamTracks::Track* track = srcStream->FindTrack(TRACK_VIDEO_PRIMARY);
@@ -1646,34 +1572,10 @@ DOMHwMediaStream::SetOverlayImage(OverlayImage* aImage)
return;
}
#ifdef MOZ_WIDGET_GONK
// Clear the old segment.
// Changing the existing content of segment is a Very BAD thing, and this way will
// confuse consumers of MediaStreams.
// It is only acceptable for DOMHwMediaStream
// because DOMHwMediaStream doesn't have consumers of TV streams currently.
track->GetSegment()->Clear();
// Change the image size.
const StreamTime delta = STREAM_TIME_MAX;
RefPtr<Image> image = static_cast<Image*>(mOverlayImage.get());
mozilla::gfx::IntSize size = image->GetSize();
VideoSegment segment;
segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle);
srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment);
#endif
}
void
DOMHwMediaStream::SetOverlayId(int32_t aOverlayId)
{
#ifdef MOZ_WIDGET_GONK
OverlayImage::Data imgData;
imgData.mOverlayId = aOverlayId;
imgData.mSize = mOverlayImage->GetSize();
mOverlayImage->SetData(imgData);
#endif
/*** STUB ***/
}
-11
View File
@@ -833,9 +833,6 @@ class DOMHwMediaStream : public DOMLocalMediaStream
{
typedef mozilla::gfx::IntSize IntSize;
typedef layers::OverlayImage OverlayImage;
#ifdef MOZ_WIDGET_GONK
typedef layers::OverlayImage::Data Data;
#endif
public:
explicit DOMHwMediaStream(nsPIDOMWindowInner* aWindow);
@@ -853,14 +850,6 @@ protected:
private:
void Init(MediaStream* aStream, OverlayImage* aImage);
#ifdef MOZ_WIDGET_GONK
const int DEFAULT_IMAGE_ID = 0x01;
const int DEFAULT_IMAGE_WIDTH = 400;
const int DEFAULT_IMAGE_HEIGHT = 300;
RefPtr<OverlayImage> mOverlayImage;
PrincipalHandle mPrincipalHandle;
#endif
};
} // namespace mozilla
-53
View File
@@ -9,9 +9,6 @@
#include "VideoUtils.h"
#include "ImageContainer.h"
#ifdef MOZ_WIDGET_GONK
#include <cutils/properties.h>
#endif
#include <stdint.h>
namespace mozilla {
@@ -93,31 +90,6 @@ ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane)
aPlane.mStride > 0 && aPlane.mWidth <= aPlane.mStride;
}
#ifdef MOZ_WIDGET_GONK
static bool
IsYV12Format(const VideoData::YCbCrBuffer::Plane& aYPlane,
const VideoData::YCbCrBuffer::Plane& aCbPlane,
const VideoData::YCbCrBuffer::Plane& aCrPlane)
{
return
aYPlane.mWidth % 2 == 0 &&
aYPlane.mHeight % 2 == 0 &&
aYPlane.mWidth / 2 == aCbPlane.mWidth &&
aYPlane.mHeight / 2 == aCbPlane.mHeight &&
aCbPlane.mWidth == aCrPlane.mWidth &&
aCbPlane.mHeight == aCrPlane.mHeight;
}
static bool
IsInEmulator()
{
char propQemu[PROPERTY_VALUE_MAX];
property_get("ro.kernel.qemu", propQemu, "");
return !strncmp(propQemu, "1", 1);
}
#endif
VideoData::VideoData(int64_t aOffset,
int64_t aTime,
int64_t aDuration,
@@ -310,19 +282,8 @@ VideoData::CreateAndCopyData(const VideoInfo& aInfo,
aTimecode,
aInfo.mDisplay,
0));
#ifdef MOZ_WIDGET_GONK
const YCbCrBuffer::Plane &Y = aBuffer.mPlanes[0];
const YCbCrBuffer::Plane &Cb = aBuffer.mPlanes[1];
const YCbCrBuffer::Plane &Cr = aBuffer.mPlanes[2];
#endif
// Currently our decoder only knows how to output to ImageFormat::PLANAR_YCBCR
// format.
#ifdef MOZ_WIDGET_GONK
if (IsYV12Format(Y, Cb, Cr) && !IsInEmulator()) {
v->mImage = new layers::GrallocImage();
}
#endif
if (!v->mImage) {
v->mImage = aContainer->CreatePlanarYCbCrImage();
}
@@ -341,20 +302,6 @@ VideoData::CreateAndCopyData(const VideoInfo& aInfo,
return nullptr;
}
#ifdef MOZ_WIDGET_GONK
if (!videoImage->IsValid() && IsYV12Format(Y, Cb, Cr)) {
// Failed to allocate gralloc. Try fallback.
v->mImage = aContainer->CreatePlanarYCbCrImage();
if (!v->mImage) {
return nullptr;
}
videoImage = v->mImage->AsPlanarYCbCrImage();
if (!VideoData::SetVideoDataToImage(videoImage, aInfo, aBuffer, aPicture,
true /* aCopyData */)) {
return nullptr;
}
}
#endif
return v.forget();
}
+1 -16
View File
@@ -13,9 +13,6 @@
#include "nsArray.h"
#include "nsContentUtils.h"
#include "nsHashPropertyBag.h"
#ifdef MOZ_WIDGET_GONK
#include "nsIAudioManager.h"
#endif
#include "nsIEventTarget.h"
#include "nsIUUIDGenerator.h"
#include "nsIScriptGlobalObject.h"
@@ -1569,7 +1566,7 @@ private:
RefPtr<MediaManager> mManager; // get ref to this when creating the runnable
};
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
#if defined(ANDROID)
class GetUserMediaRunnableWrapper : public Runnable
{
public:
@@ -3052,18 +3049,6 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
}
return NS_OK;
}
#ifdef MOZ_WIDGET_GONK
else if (!strcmp(aTopic, "phone-state-changed")) {
nsString state(aData);
nsresult rv;
uint32_t phoneState = state.ToInteger(&rv);
if (NS_SUCCEEDED(rv) && phoneState == nsIAudioManager::PHONE_STATE_IN_CALL) {
StopMediaStreams();
}
return NS_OK;
}
#endif
return NS_OK;
}
+3 -5
View File
@@ -22,7 +22,7 @@
#include "nsIPropertyBag2.h"
#if defined(ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(ANDROID)
#include "android/log.h"
#define ALOG(args...) __android_log_print(ANDROID_LOG_INFO, "AndroidMediaPluginHost" , ## args)
#else
@@ -134,7 +134,7 @@ static bool IsOmxSupported()
// nullptr is returned if Omx decoding is not supported on the device,
static const char* GetOmxLibraryName()
{
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
#if defined(ANDROID)
nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
NS_ASSERTION(infoService, "Could not find a system info service");
@@ -172,7 +172,7 @@ static const char* GetOmxLibraryName()
if (!IsOmxSupported())
return nullptr;
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
#if defined(ANDROID)
if (version >= 17) {
return "libomxpluginkk.so";
}
@@ -180,8 +180,6 @@ static const char* GetOmxLibraryName()
// Ice Cream Sandwich and Jellybean
return "libomxplugin.so";
#elif defined(ANDROID) && defined(MOZ_WIDGET_GONK)
return "libomxplugin.so";
#else
return nullptr;
#endif
-5
View File
@@ -9,12 +9,7 @@
#include <opus/opus.h>
#undef LOG
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
#else
#define LOG(args, ...)
#endif
namespace mozilla {
-5
View File
@@ -10,12 +10,7 @@
#include "VideoUtils.h"
#undef LOG
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
#else
#define LOG(args, ...)
#endif
namespace mozilla {
@@ -13,12 +13,7 @@
#include "GeckoProfiler.h"
#undef LOG
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
#else
#define LOG(args, ...)
#endif
namespace mozilla {
-4
View File
@@ -270,11 +270,7 @@ GeckoMediaPluginServiceParent::InitStorage()
// Directory service is main thread only, so cache the profile dir here
// so that we can use it off main thread.
#ifdef MOZ_WIDGET_GONK
nsresult rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/b2g/mozilla"), false, getter_AddRefs(mStorageBaseDir));
#else
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mStorageBaseDir));
#endif
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
-12
View File
@@ -18,18 +18,6 @@
#include <opus/opus.h>
#include "opus/opus_multistream.h"
// On Android JellyBean, the hardware.h header redefines version_major and
// version_minor, which breaks our build. See:
// https://bugzilla.mozilla.org/show_bug.cgi?id=912702#c6
#ifdef MOZ_WIDGET_GONK
#ifdef version_major
#undef version_major
#endif
#ifdef version_minor
#undef version_minor
#endif
#endif
namespace mozilla {
extern LazyLogModule gMediaDecoderLog;
-5
View File
@@ -7,12 +7,7 @@
#include "GeckoProfiler.h"
#undef LOG
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
#else
#define LOG(args, ...)
#endif
namespace mozilla {
@@ -8,11 +8,6 @@
#include "OMX_VideoExt.h" // For VP8.
#if defined(MOZ_WIDGET_GONK) && (ANDROID_VERSION == 20 || ANDROID_VERSION == 19)
#define OMX_PLATFORM_GONK
#include "GonkOmxPlatformLayer.h"
#endif
#include "VPXDecoder.h"
#ifdef LOG
@@ -47,23 +47,6 @@ MediaSystemResourceService::MediaSystemResourceService()
: mDestroyed(false)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
#ifdef MOZ_WIDGET_GONK
// The maximum number of hardware resoureces available.
// XXX need to hange to a dynamic way.
enum
{
VIDEO_DECODER_COUNT = 1,
VIDEO_ENCODER_COUNT = 1
};
MediaSystemResource* resource;
resource = new MediaSystemResource(VIDEO_DECODER_COUNT);
mResources.Put(static_cast<uint32_t>(MediaSystemResourceType::VIDEO_DECODER), resource);
resource = new MediaSystemResource(VIDEO_ENCODER_COUNT);
mResources.Put(static_cast<uint32_t>(MediaSystemResourceType::VIDEO_ENCODER), resource);
#endif
}
MediaSystemResourceService::~MediaSystemResourceService()
@@ -325,7 +325,7 @@ MediaEngineCameraVideoSource::SetName(nsString aName)
VideoFacingModeEnum facingMode = VideoFacingModeEnum::User;
// Set facing mode based on device name.
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
#if defined(ANDROID)
// Names are generated. Example: "Camera 0, Facing back, Orientation 90"
//
// See media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/
+1 -1
View File
@@ -192,7 +192,7 @@ MediaEngineDefaultVideoSource::Start(SourceMediaStream* aStream, TrackID aID,
mTrackID = aID;
// Start timer for subsequent frames
#if (defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID)) && defined(DEBUG)
#if defined(MOZ_WIDGET_ANDROID) && defined(DEBUG)
// emulator debug is very, very slow and has problems dealing with realtime audio inputs
mTimer->InitWithCallback(this, (1000 / mOpts.mFPS)*10, nsITimer::TYPE_REPEATING_SLACK);
#else
+1 -1
View File
@@ -339,7 +339,7 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource,
int nDevices = 0;
mAudioInput->GetNumOfRecordingDevices(nDevices);
int i;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
i = 0; // Bug 1037025 - let the OS handle defaulting for now on android/b2g
#else
// -1 is "default communications device" depending on OS in webrtc.org code
@@ -494,13 +494,6 @@ nsWindowWatcher::CreateChromeWindow(const nsACString& aFeatures,
return NS_ERROR_UNEXPECTED;
}
// B2G multi-screen support. mozDisplayId is returned from the
// "display-changed" event, it is also platform-dependent.
#ifdef MOZ_WIDGET_GONK
int retval = WinHasOption(aFeatures, "mozDisplayId", 0, nullptr);
windowCreator2->SetScreenId(retval);
#endif
bool cancel = false;
nsCOMPtr<nsIWebBrowserChrome> newWindowChrome;
nsresult rv =
@@ -48,11 +48,7 @@ PlatformThreadId PlatformThread::CurrentId() {
mach_port_deallocate(mach_task_self(), port);
return port;
#elif defined(OS_LINUX)
#ifdef MOZ_WIDGET_GONK
return (intptr_t) (pthread_self());
#else
return syscall(__NR_gettid);
#endif
#elif defined(OS_OPENBSD) || defined(__GLIBC__)
return (intptr_t) (pthread_self());
#elif defined(OS_NETBSD)
+2 -43
View File
@@ -24,24 +24,13 @@
#include "prenv.h"
#include "prmem.h"
#ifdef MOZ_WIDGET_GONK
/*
* AID_APP is the first application UID used by Android. We're using
* it as our unprivilegied UID. This ensure the UID used is not
* shared with any other processes than our own childs.
*/
# include <private/android_filesystem_config.h>
# define CHILD_UNPRIVILEGED_UID AID_APP
# define CHILD_UNPRIVILEGED_GID AID_APP
#else
/*
* On platforms that are not gonk based, we fall back to an arbitrary
* UID. This is generally the UID for user `nobody', albeit it is not
* On our platforms we use an arbitrary UID.
* This is generally the UID for user `nobody', albeit it is not
* always the case.
*/
# define CHILD_UNPRIVILEGED_UID 65534
# define CHILD_UNPRIVILEGED_GID 65534
#endif
namespace {
@@ -229,36 +218,6 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) {
gid_t gid = CHILD_UNPRIVILEGED_GID;
uid_t uid = CHILD_UNPRIVILEGED_UID;
#ifdef MOZ_WIDGET_GONK
{
static bool checked_pix_max, pix_max_ok;
if (!checked_pix_max) {
checked_pix_max = true;
int fd = open("/proc/sys/kernel/pid_max", O_CLOEXEC | O_RDONLY);
if (fd < 0) {
DLOG(ERROR) << "Failed to open pid_max";
_exit(127);
}
char buf[PATH_MAX];
ssize_t len = read(fd, buf, sizeof(buf) - 1);
close(fd);
if (len < 0) {
DLOG(ERROR) << "Failed to read pid_max";
_exit(127);
}
buf[len] = '\0';
int pid_max = atoi(buf);
pix_max_ok =
(pid_max + CHILD_UNPRIVILEGED_UID > CHILD_UNPRIVILEGED_UID);
}
if (!pix_max_ok) {
DLOG(ERROR) << "Can't safely get unique uid/gid";
_exit(127);
}
gid += getpid();
uid += getpid();
}
#endif
if (setgid(gid) != 0) {
DLOG(ERROR) << "FAILED TO setgid() CHILD PROCESS";
_exit(127);
+1 -45
View File
@@ -22,41 +22,6 @@
#include "GMPLoader.h"
#ifdef MOZ_WIDGET_GONK
# include <sys/time.h>
# include <sys/resource.h>
# include <binder/ProcessState.h>
# ifdef LOGE_IF
# undef LOGE_IF
# endif
# include <android/log.h>
# define LOGE_IF(cond, ...) \
( (CONDITION(cond)) \
? ((void)__android_log_print(ANDROID_LOG_ERROR, \
"Gecko:MozillaRntimeMain", __VA_ARGS__)) \
: (void)0 )
#endif // MOZ_WIDGET_GONK
#ifdef MOZ_WIDGET_GONK
static void
InitializeBinder(void *aDummy) {
// Change thread priority to 0 only during calling ProcessState::self().
// The priority is registered to binder driver and used for default Binder
// Thread's priority.
// To change the process's priority to small value need's root permission.
int curPrio = getpriority(PRIO_PROCESS, 0);
int err = setpriority(PRIO_PROCESS, 0, 0);
MOZ_ASSERT(!err);
LOGE_IF(err, "setpriority failed. Current process needs root permission.");
android::ProcessState::self()->startThreadPool();
setpriority(PRIO_PROCESS, 0, curPrio);
}
#endif
mozilla::gmp::SandboxStarter*
MakeSandboxStarter()
{
@@ -76,15 +41,6 @@ content_process_main(int argc, char* argv[])
XRE_SetProcessType(argv[--argc]);
#ifdef MOZ_WIDGET_GONK
// This creates a ThreadPool for binder ipc. A ThreadPool is necessary to
// receive binder calls, though not necessary to send binder calls.
// ProcessState::Self() also needs to be called once on the main thread to
// register the main thread with the binder driver.
InitializeBinder(nullptr);
#endif
#ifdef XP_WIN
// For plugins, this is done in PluginProcessChild::Init, as we need to
// avoid it for unsupported plugins. See PluginProcessChild::Init for
@@ -94,7 +50,7 @@ content_process_main(int argc, char* argv[])
SetDllDirectoryW(L"");
}
#endif
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK) && defined(MOZ_PLUGIN_CONTAINER)
#if !defined(MOZ_WIDGET_ANDROID) && defined(MOZ_PLUGIN_CONTAINER)
// On desktop, the GMPLoader lives in plugin-container, so that its
// code can be covered by an EME/GMP vendor's voucher.
nsAutoPtr<mozilla::gmp::SandboxStarter> starter(MakeSandboxStarter());
-5
View File
@@ -14,12 +14,7 @@
#include "nsThreadUtils.h"
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args);
#else
#define CHROMIUM_LOG(args...) printf(args);
#endif
namespace mozilla {
namespace ipc {
-5
View File
@@ -20,12 +20,7 @@
#include "DBusUtils.h"
#undef CHROMIUM_LOG
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args);
#else
#define CHROMIUM_LOG(args...) printf(args);
#endif
namespace mozilla {
namespace ipc {
+2 -12
View File
@@ -62,13 +62,9 @@ static const int kMagicAndroidSystemPropFd = 5;
#endif
static const bool kLowRightsSubprocesses =
// We currently only attempt to drop privileges on gonk, because we
// have no plugins or extensions to worry about breaking.
#ifdef MOZ_WIDGET_GONK
true
#else
// We only attempted to drop privileges on gonk, because it
// had no plugins or extensions to worry about breaking.
false
#endif
;
static bool
@@ -699,12 +695,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
}
#endif // ANDROID
#ifdef MOZ_WIDGET_GONK
if (const char *ldPreloadPath = getenv("LD_PRELOAD")) {
newEnvVars["LD_PRELOAD"] = ldPreloadPath;
}
#endif // MOZ_WIDGET_GONK
// remap the IPC socket fd to a well-known int, as the OS does for
// STDOUT_FILENO, for example
int srcChannelFd, dstChannelFd;
-5
View File
@@ -14,14 +14,9 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args);
#endif
namespace mozilla {
namespace ipc {
-5
View File
@@ -18,14 +18,9 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args);
#endif
namespace mozilla {
namespace ipc {
-5
View File
@@ -12,14 +12,9 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args);
#endif
namespace mozilla {
namespace ipc {
-14
View File
@@ -15,26 +15,12 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) \
__android_log_print(ANDROID_LOG_INFO, "HAL-IPC", args);
#define CHROMIUM_LOG_VA(fmt, ap) \
__android_log_vprint(ANDROID_LOG_INFO, "HAL-IPC", fmt, ap);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) { printf(args); }
#define CHROMIUM_LOG_VA(fmt, ap) if (IODEBUG) { vprintf(fmt, ap); }
#endif
namespace mozilla {
namespace ipc {
namespace DaemonSocketPDUHelpers {
-5
View File
@@ -10,12 +10,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define KEYSTORE_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define KEYSTORE_LOG(args...) printf(args);
#endif
#include "KeyStore.h"
#include "jsfriendapi.h"
-5
View File
@@ -13,12 +13,7 @@
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#define KEYSTORE_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define KEYSTORE_LOG(args...) printf(args);
#endif
namespace mozilla {
namespace ipc {
-5
View File
@@ -21,12 +21,7 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
#else
#define CHROMIUM_LOG(args...) printf(args);
#endif
namespace mozilla {
namespace ipc {
-4
View File
@@ -181,11 +181,7 @@ RilConnector::CreateStreamSocket(struct sockaddr* aAddress,
socklen_t* aAddressLength,
int& aStreamFd)
{
#ifdef MOZ_WIDGET_GONK
static const int sDomain = AF_UNIX;
#else
static const int sDomain = AF_INET;
#endif
ScopedClose fd;
-5
View File
@@ -11,14 +11,9 @@
#undef CHROMIUM_LOG
#endif
#if defined(MOZ_WIDGET_GONK)
#include <android/log.h>
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "I/O", args);
#else
#include <stdio.h>
#define IODEBUG true
#define CHROMIUM_LOG(args...) if (IODEBUG) printf(args);
#endif
namespace mozilla {
namespace ipc {
-5
View File
@@ -187,10 +187,6 @@ static void opensl_destroy(cubeb * ctx);
#if defined(__ANDROID__)
// The bionic header file on B2G contains the required
// declarations on all releases.
#ifndef MOZ_WIDGET_GONK
#if (__ANDROID_API__ >= ANDROID_VERSION_LOLLIPOP)
typedef int (system_property_get)(const char*, char*);
@@ -212,7 +208,6 @@ __system_property_get(const char* name, char* value)
return ret;
}
#endif
#endif
static int
get_android_version(void)
-13
View File
@@ -95,19 +95,6 @@
#define PNG_SEQUENTIAL_READ_SUPPORTED
#endif
/* necessary for boot animation code (Gonk) */
#ifdef MOZ_WIDGET_GONK
#define PNG_bKGD_SUPPORTED
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_EASY_ACCESS_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_BGR_SUPPORTED
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#endif
#define PNG_WRITE_SUPPORTED
#define PNG_WRITE_APNG_SUPPORTED
#define PNG_WRITE_tRNS_SUPPORTED
-26
View File
@@ -10,11 +10,7 @@
#include <stagefright/MetaData.h>
#include <stagefright/OMXCodec.h>
#include <media/stagefright/MediaErrors.h>
#ifdef MOZ_WIDGET_GONK
#include <OMX.h>
#else
#include <stagefright/OMXClient.h>
#endif
#include <algorithm>
#include "mozilla/Assertions.h"
@@ -125,7 +121,6 @@ public:
bool ReadAudio(AudioFrame *aFrame, int64_t aSeekTimeUs);
};
#if !defined(MOZ_WIDGET_GONK)
static class OmxClientInstance {
public:
OmxClientInstance()
@@ -156,7 +151,6 @@ private:
OMXClient *mClient;
status_t mStatus;
} sClientInstance;
#endif
OmxDecoder::OmxDecoder(PluginHost *aPluginHost, Decoder *aDecoder) :
mPluginHost(aPluginHost),
@@ -210,16 +204,6 @@ public:
}
};
#ifdef MOZ_WIDGET_GONK
static sp<IOMX> sOMX = nullptr;
static sp<IOMX> GetOMX() {
if(sOMX.get() == nullptr) {
sOMX = reinterpret_cast<IOMX*>(new OMX);
}
return sOMX;
}
#endif
static uint32_t
GetDefaultStagefrightFlags(PluginHost *aPluginHost)
{
@@ -246,11 +230,6 @@ GetDefaultStagefrightFlags(PluginHost *aPluginHost)
static uint32_t GetVideoCreationFlags(PluginHost* aPluginHost)
{
#ifdef MOZ_WIDGET_GONK
// Flag value of zero means return a hardware or software decoder
// depending on what the device supports.
return 0;
#else
// Check whether the user has set a pref to override our default OMXCodec
// CreationFlags flags. This is useful for A/B testing hardware and software
// decoders for performance and bugs. The interesting flag values are:
@@ -271,7 +250,6 @@ static uint32_t GetVideoCreationFlags(PluginHost* aPluginHost)
flags |= GetDefaultStagefrightFlags(aPluginHost);
return static_cast<uint32_t>(flags);
#endif
}
enum ColorFormatSupport {
@@ -481,11 +459,7 @@ bool OmxDecoder::Init()
int64_t totalDurationUs = 0;
#ifdef MOZ_WIDGET_GONK
sp<IOMX> omx = GetOMX();
#else
sp<IOMX> omx = sClientInstance.get()->interface();
#endif
sp<MediaSource> videoTrack;
sp<MediaSource> videoSource;
@@ -26,9 +26,6 @@ using namespace android;
#include "runnable_utils.h"
// Gecko
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
#include "GonkBufferQueueProducer.h"
#endif
#include "GonkNativeWindow.h"
#include "GrallocImages.h"
#include "mozilla/Atomics.h"
@@ -326,30 +323,16 @@ public:
mHeight = aHeight;
sp<Surface> surface = nullptr;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
sp<IGraphicBufferProducer> producer;
sp<IGonkGraphicBufferConsumer> consumer;
GonkBufferQueue::createBufferQueue(&producer, &consumer);
mNativeWindow = new GonkNativeWindow(consumer);
#else
mNativeWindow = new GonkNativeWindow();
#endif
if (mNativeWindow.get()) {
// listen to buffers queued by MediaCodec::RenderOutputBufferAndRelease().
mNativeWindow->setNewFrameCallback(this);
// XXX remove buffer changes after a better solution lands - bug 1009420
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
static_cast<GonkBufferQueueProducer*>(producer.get())->setSynchronousMode(false);
// More spare buffers to avoid OMX decoder waiting for native window
consumer->setMaxAcquiredBufferCount(WEBRTC_OMX_H264_MIN_DECODE_BUFFERS);
surface = new Surface(producer);
#else
sp<GonkBufferQueue> bq = mNativeWindow->getBufferQueue();
bq->setSynchronousMode(false);
// More spare buffers to avoid OMX decoder waiting for native window
bq->setMaxAcquiredBufferCount(WEBRTC_OMX_H264_MIN_DECODE_BUFFERS);
surface = new Surface(bq);
#endif
}
status_t result = mCodec->configure(config, surface, nullptr, 0);
if (result == OK) {
@@ -2217,11 +2217,7 @@ public:
#if defined(MOZILLA_INTERNAL_API)
if (buffer) {
// Create a video frame using |buffer|.
#ifdef MOZ_WIDGET_GONK
RefPtr<PlanarYCbCrImage> yuvImage = new GrallocImage();
#else
RefPtr<PlanarYCbCrImage> yuvImage = image_container_->CreatePlanarYCbCrImage();
#endif
uint8_t* frame = const_cast<uint8_t*>(static_cast<const uint8_t*> (buffer));
PlanarYCbCrData yuvData;
@@ -15,9 +15,7 @@
#ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_UTILITY_ANDROID_H
#define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_UTILITY_ANDROID_H
#if !defined(MOZ_WIDGET_GONK)
#include <jni.h>
#endif
#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_device/audio_device_utility.h"
@@ -9,18 +9,14 @@
*/
#include "webrtc/modules/audio_device/android/audio_manager.h"
#if !defined(MOZ_WIDGET_GONK)
#include "AndroidJNIWrapper.h"
#endif
#include <android/log.h>
#include "webrtc/base/arraysize.h"
#include "webrtc/base/checks.h"
#include "webrtc/modules/audio_device/android/audio_common.h"
#if !defined(MOZ_WIDGET_GONK)
#include "webrtc/modules/utility/interface/helpers_android.h"
#endif
#define TAG "AudioManager"
#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
@@ -31,14 +27,11 @@
namespace webrtc {
#if !defined(MOZ_WIDGET_GONK)
static JavaVM* g_jvm = NULL;
static jobject g_context = NULL;
static jclass g_audio_manager_class = NULL;
#endif
void AudioManager::SetAndroidAudioDeviceObjects(void* jvm, void* context) {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("SetAndroidAudioDeviceObjects%s", GetThreadInfo().c_str());
CHECK(jvm);
@@ -65,11 +58,9 @@ void AudioManager::SetAndroidAudioDeviceObjects(void* jvm, void* context) {
jni->RegisterNatives(g_audio_manager_class,
native_methods, arraysize(native_methods));
CHECK_EXCEPTION(jni) << "Error during RegisterNatives";
#endif
}
void AudioManager::ClearAndroidAudioDeviceObjects() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("ClearAndroidAudioDeviceObjects%s", GetThreadInfo().c_str());
JNIEnv* jni = GetEnv(g_jvm);
CHECK(jni) << "AttachCurrentThread must be called on this tread";
@@ -80,36 +71,28 @@ void AudioManager::ClearAndroidAudioDeviceObjects() {
DeleteGlobalRef(jni, g_context);
g_context = NULL;
g_jvm = NULL;
#endif
}
AudioManager::AudioManager()
: initialized_(false) {
#if !defined(MOZ_WIDGET_GONK)
j_audio_manager_ = NULL;
ALOGD("ctor%s", GetThreadInfo().c_str());
#endif
CHECK(HasDeviceObjects());
CreateJavaInstance();
}
AudioManager::~AudioManager() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("~dtor%s", GetThreadInfo().c_str());
#endif
DCHECK(thread_checker_.CalledOnValidThread());
Close();
#if !defined(MOZ_WIDGET_GONK)
AttachThreadScoped ats(g_jvm);
JNIEnv* jni = ats.env();
jni->DeleteGlobalRef(j_audio_manager_);
j_audio_manager_ = NULL;
#endif
DCHECK(!initialized_);
}
bool AudioManager::Init() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("Init%s", GetThreadInfo().c_str());
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!initialized_);
@@ -122,13 +105,11 @@ bool AudioManager::Init() {
ALOGE("init failed!");
return false;
}
#endif
initialized_ = true;
return true;
}
bool AudioManager::Close() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("Close%s", GetThreadInfo().c_str());
DCHECK(thread_checker_.CalledOnValidThread());
if (!initialized_)
@@ -139,12 +120,10 @@ bool AudioManager::Close() {
jni, g_audio_manager_class, "dispose", "()V");
jni->CallVoidMethod(j_audio_manager_, disposeID);
CHECK_EXCEPTION(jni);
#endif
initialized_ = false;
return true;
}
#if !defined(MOZ_WIDGET_GONK)
void JNICALL AudioManager::CacheAudioParameters(JNIEnv* env, jobject obj,
jint sample_rate, jint channels, jlong nativeAudioManager) {
webrtc::AudioManager* this_object =
@@ -162,7 +141,6 @@ void AudioManager::OnCacheAudioParameters(
playout_parameters_.reset(sample_rate, channels);
record_parameters_.reset(sample_rate, channels);
}
#endif
AudioParameters AudioManager::GetPlayoutAudioParameters() const {
CHECK(playout_parameters_.is_valid());
@@ -175,15 +153,10 @@ AudioParameters AudioManager::GetRecordAudioParameters() const {
}
bool AudioManager::HasDeviceObjects() {
#if !defined(MOZ_WIDGET_GONK)
return (g_jvm && g_context && g_audio_manager_class);
#else
return true;
#endif
}
void AudioManager::CreateJavaInstance() {
#if !defined(MOZ_WIDGET_GONK)
ALOGD("CreateJavaInstance");
AttachThreadScoped ats(g_jvm);
JNIEnv* jni = ats.env();
@@ -198,7 +171,6 @@ void AudioManager::CreateJavaInstance() {
j_audio_manager_ = jni->NewGlobalRef(j_audio_manager_);
CHECK_EXCEPTION(jni) << "Error during NewGlobalRef";
CHECK(j_audio_manager_);
#endif
}
} // namespace webrtc
@@ -11,17 +11,13 @@
#ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_
#define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_
#if !defined(MOZ_WIDGET_GONK)
#include <jni.h>
#endif
#include "webrtc/base/thread_checker.h"
#include "webrtc/modules/audio_device/android/audio_common.h"
#include "webrtc/modules/audio_device/include/audio_device_defines.h"
#include "webrtc/modules/audio_device/audio_device_generic.h"
#if !defined(MOZ_WIDGET_GONK)
#include "webrtc/modules/utility/interface/helpers_android.h"
#endif
namespace webrtc {
@@ -100,14 +96,12 @@ class AudioManager {
bool initialized() const { return initialized_; }
private:
#if !defined(MOZ_WIDGET_GONK)
// Called from Java side so we can cache the native audio parameters.
// This method will be called by the WebRtcAudioManager constructor, i.e.
// on the same thread that this object is created on.
static void JNICALL CacheAudioParameters(JNIEnv* env, jobject obj,
jint sample_rate, jint channels, jlong nativeAudioManager);
void OnCacheAudioParameters(JNIEnv* env, jint sample_rate, jint channels);
#endif
// Returns true if SetAndroidAudioDeviceObjects() has been called
// successfully.
@@ -121,10 +115,8 @@ class AudioManager {
// other methods are called from the same thread.
rtc::ThreadChecker thread_checker_;
#if !defined(MOZ_WIDGET_GONK)
// The Java WebRtcAudioManager instance.
jobject j_audio_manager_;
#endif
// Set to true by Init() and false by Close().
bool initialized_;
@@ -21,7 +21,7 @@
#include "webrtc/common_types.h"
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) && !defined(MOZ_WIDGET_GONK)
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
#include <jni.h>
#endif
@@ -156,7 +156,7 @@ class WEBRTC_DLLEXPORT VideoEngine {
// user receives callbacks for generated trace messages.
static int SetTraceCallback(TraceCallback* callback);
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) && !defined(MOZ_WIDGET_GONK)
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
// Android specific.
static int SetAndroidObjects(JavaVM* java_vm);
#endif
+1 -1
View File
@@ -133,7 +133,7 @@
# endif
# else
# define MOZ_MEMORY_API MFBT_API
# if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
# if defined(MOZ_WIDGET_ANDROID)
# define MOZ_WRAP_NEW_DELETE
# endif
# endif
-5
View File
@@ -149,12 +149,7 @@
* the options passed via the MALLOC_OPTIONS environment variable but is
* applied in addition to them.
*/
#ifdef MOZ_WIDGET_GONK
/* Reduce the amount of unused dirty pages to 1MiB on B2G */
# define MOZ_MALLOC_OPTIONS "ff"
#else
# define MOZ_MALLOC_OPTIONS ""
#endif
/*
* MALLOC_STATS enables statistics calculation, and is required for
+1 -8
View File
@@ -68,14 +68,7 @@ TEST(VolatileBufferTest, RealVolatileBuffersWork)
}
// Test purging if we know how to
#if defined(MOZ_WIDGET_GONK)
// This also works on Android, but we need root.
int fd = open("/" ASHMEM_NAME_DEF, O_RDWR);
ASSERT_GE(fd, 0) << "Failed to open ashmem device";
ASSERT_GE(ioctl(fd, ASHMEM_PURGE_ALL_CACHES, NULL), 0)
<< "Failed to purge ashmem caches";
#elif defined(XP_DARWIN)
#if defined(XP_DARWIN)
int state;
vm_purgable_control(mach_task_self(), (vm_address_t)NULL,
VM_PURGABLE_PURGE_ALL, &state);
+8 -46
View File
@@ -451,20 +451,6 @@ pref("media.webrtc.debug.aec_log_dir", "");
pref("media.webrtc.debug.log_file", "");
pref("media.webrtc.debug.aec_dump_max_size", 4194304); // 4MB
#ifdef MOZ_WIDGET_GONK
pref("media.navigator.video.default_width", 320);
pref("media.navigator.video.default_height", 240);
pref("media.peerconnection.enabled", true);
pref("media.peerconnection.video.enabled", true);
pref("media.navigator.video.max_fs", 1200); // 640x480 == 1200mb
pref("media.navigator.video.max_fr", 30);
pref("media.navigator.video.h264.level", 12); // 0x42E00C - level 1.2
pref("media.navigator.video.h264.max_br", 700); // 8x10
pref("media.navigator.video.h264.max_mbps", 11880); // CIF@30fps
pref("media.peerconnection.video.h264_enabled", false);
pref("media.peerconnection.video.vp9_enabled", false);
pref("media.getusermedia.aec", 4);
#else
pref("media.navigator.video.default_width",0); // adaptive default
pref("media.navigator.video.default_height",0); // adaptive default
pref("media.peerconnection.enabled", true);
@@ -478,9 +464,7 @@ pref("media.peerconnection.video.h264_enabled", false);
pref("media.peerconnection.video.vp9_enabled", true);
pref("media.getusermedia.aec", 1);
pref("media.getusermedia.browser.enabled", true);
#endif
// Gonk typically captures at QVGA, and so min resolution is QQVGA or
// 160x120; 100Kbps is plenty for that.
// Desktop is typically VGA capture or more; and qm_select will not drop resolution
// below 1/2 in each dimension (or so), so QVGA (320x200) is the lowest here usually.
pref("media.peerconnection.video.min_bitrate", 0);
@@ -580,7 +564,7 @@ pref("media.mediasource.enabled", true);
pref("media.mediasource.mp4.enabled", true);
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID)
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID)
pref("media.mediasource.webm.enabled", false);
#else
pref("media.mediasource.webm.enabled", true);
@@ -700,7 +684,7 @@ pref("apz.y_stationary_size_multiplier", "3.5");
pref("apz.zoom_animation_duration_ms", 250);
pref("apz.scale_repaint_delay_ms", 500);
#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID)
#if defined(MOZ_WIDGET_ANDROID)
// Mobile prefs
pref("apz.allow_zooming", true);
pref("apz.enlarge_displayport_when_clipped", true);
@@ -716,7 +700,7 @@ pref("apz.y_stationary_size_multiplier", "1.5");
pref("gfx.hidpi.enabled", 2);
#endif
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
// Use containerless scrolling for now on desktop.
pref("layout.scroll.root-frame-containers", false);
#endif
@@ -4477,10 +4461,6 @@ pref("webgl.dxgl.needs-finish", false);
pref("gfx.offscreencanvas.enabled", false);
#ifdef MOZ_WIDGET_GONK
pref("gfx.gralloc.fence-with-readpixels", false);
#endif
// Stagefright prefs
pref("stagefright.force-enabled", false);
pref("stagefright.disabled", false);
@@ -4532,7 +4512,7 @@ pref("layers.acceleration.force-enabled", false);
pref("layers.acceleration.draw-fps", false);
// Enable DEAA antialiasing for transformed layers in the compositor
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
// Desktop prefs
pref("layers.deaa.enabled", true);
#else
@@ -4836,7 +4816,7 @@ pref("layout.css.expensive-style-struct-assertions.enabled", false);
// enable JS dump() function.
pref("browser.dom.window.dump.enabled", false);
#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID)
#if defined(MOZ_WIDGET_ANDROID)
// Network Information API
pref("dom.netinfo.enabled", true);
#else
@@ -5200,15 +5180,6 @@ pref("camera.control.face_detection.enabled", true);
// SW Cache API
pref("dom.caches.enabled", true);
#ifdef MOZ_WIDGET_GONK
// Empirically, this is the value returned by hal::GetTotalSystemMemory()
// when Flame's memory is limited to 512MiB. If the camera stack determines
// it is running on a low memory platform, features that can be reliably
// supported will be disabled. This threshold can be adjusted to suit other
// platforms; and set to 0 to disable the low-memory check altogether.
pref("camera.control.low_memory_thresholdMB", 404);
#endif
// SystemUpdate API
pref("dom.system_update.enabled", false);
pref("dom.system_update.debug", false);
@@ -5288,7 +5259,6 @@ pref("browser.search.geoip.timeout", 3000);
pref("browser.search.official", true);
#endif
#ifndef MOZ_WIDGET_GONK
// GMPInstallManager prefs
// User-settable override to media.gmp-manager.url for testing purposes.
@@ -5324,7 +5294,6 @@ pref("media.gmp-manager.certs.1.issuerName", "CN=DigiCert SHA2 Secure Server CA,
pref("media.gmp-manager.certs.1.commonName", "aus5.mozilla.org");
pref("media.gmp-manager.certs.2.issuerName", "CN=thawte SSL CA - G2,O=\"thawte, Inc.\",C=US");
pref("media.gmp-manager.certs.2.commonName", "aus5.mozilla.org");
#endif
// Whether or not to perform reader mode article parsing on page load.
// If this pref is disabled, we will never show a reader mode icon in the toolbar.
@@ -5398,15 +5367,8 @@ pref("dom.secureelement.enabled", false);
// and compositionend events.
pref("dom.compositionevent.allow_control_characters", false);
#ifdef MOZ_WIDGET_GONK
// Bug 1154053: Serialize B2G memory reports; smaller devices are
// usually overcommitted on memory by using zRAM, so memory reporting
// causes memory pressure from uncompressing cold heap memory.
pref("memory.report_concurrency", 1);
#else
// Desktop probably doesn't have swapped-out children like that.
// Desktop probably doesn't have swapped-out children.
pref("memory.report_concurrency", 10);
#endif
// Add Mozilla AudioChannel APIs.
pref("media.useAudioChannelAPI", false);
@@ -5475,7 +5437,7 @@ pref("dom.maxHardwareConcurrency", 16);
pref("osfile.reset_worker_delay", 30000);
#endif
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
pref("dom.webkitBlink.dirPicker.enabled", true);
pref("dom.webkitBlink.filesystem.enabled", true);
#endif
-17
View File
@@ -64,22 +64,7 @@ private:
static std::vector<AtForkFuncs, SpecialAllocator<AtForkFuncs> > atfork;
#endif
#ifdef MOZ_WIDGET_GONK
#include "cpuacct.h"
#if ANDROID_VERSION < 17 || defined(MOZ_WIDGET_ANDROID)
extern "C" NS_EXPORT int
timer_create(clockid_t, struct sigevent*, timer_t*)
{
__android_log_print(ANDROID_LOG_ERROR, "BionicGlue", "timer_create not supported!");
abort();
return -1;
}
#endif
#else
#define cpuacct_add(x)
#endif
#if ANDROID_VERSION < 17 || defined(MOZ_WIDGET_ANDROID)
extern "C" NS_EXPORT int
@@ -140,7 +125,6 @@ raise(int sig)
}
/* Flash plugin uses symbols that are not present in Android >= 4.4 */
#ifndef MOZ_WIDGET_GONK
namespace android {
namespace VectorImpl {
NS_EXPORT void reservedVectorImpl1(void) { }
@@ -153,5 +137,4 @@ namespace android {
NS_EXPORT void reservedVectorImpl8(void) { }
}
}
#endif
+2 -2
View File
@@ -400,11 +400,11 @@ public:
* retrieved by mozilla::TimeStamp. Since we need this for
* vsync timestamps, we enable the creation of mozilla::TimeStamps
* on platforms that support vsync aligned refresh drivers / compositors
* Verified true as of Jan 31, 2015: B2G and OS X
* Verified true as of Jan 31, 2015: OS X
* False on Windows 7
* UNTESTED ON OTHER PLATFORMS
*/
#if defined(MOZ_WIDGET_GONK) || defined(XP_DARWIN)
#if defined(XP_DARWIN)
static TimeStamp FromSystemTime(int64_t aSystemTime)
{
static_assert(sizeof(aSystemTime) == sizeof(TimeStampValue),
-5
View File
@@ -59,11 +59,6 @@
#include "nsContentUtils.h"
#include "xpcpublic.h"
#ifdef MOZ_WIDGET_GONK
#include "nsINetworkManager.h"
#include "nsINetworkInterface.h"
#endif
namespace mozilla {
namespace net {
-21
View File
@@ -49,27 +49,6 @@ WriteToFile(nsIFile *lf, const char *data, uint32_t len, int32_t flags)
PRFileDesc *fd;
int32_t mode = 0600;
nsresult rv;
#if defined(MOZ_WIDGET_GONK)
// The sdcard on a B2G phone looks like:
// d---rwx--- system sdcard_rw 1970-01-01 01:00:00 sdcard
// On the emulator, xpcshell fails when using 0600 mode to open the file,
// and 0660 works.
nsCOMPtr<nsIFile> parent;
rv = lf->GetParent(getter_AddRefs(parent));
if (NS_FAILED(rv)) {
return rv;
}
uint32_t parentPerm;
rv = parent->GetPermissions(&parentPerm);
if (NS_FAILED(rv)) {
return rv;
}
if ((parentPerm & 0700) == 0) {
// Parent directory has no owner-write, so try to use group permissions
// instead of owner permissions.
mode = 0660;
}
#endif
rv = lf->OpenNSPRFileDesc(flags, mode, &fd);
if (NS_FAILED(rv))
return rv;
-5
View File
@@ -71,11 +71,6 @@
#include "nsHttpHandler.h"
#include "nsNSSComponent.h"
#ifdef MOZ_WIDGET_GONK
#include "nsINetworkManager.h"
#include "nsThreadUtils.h" // for NS_IsMainThread
#endif
#include <limits>
using namespace mozilla;
+1 -36
View File
@@ -31,10 +31,6 @@
#include "nsIDNSService.h"
#include "nsICancelable.h"
#ifdef MOZ_WIDGET_GONK
#include "NetStatistics.h"
#endif
namespace mozilla {
namespace net {
@@ -626,15 +622,6 @@ nsUDPSocket::InitWithAddress(const NetAddr *aAddr, nsIPrincipal *aPrincipal,
aPrincipal->GetIsInIsolatedMozBrowserElement();
}
#ifdef MOZ_WIDGET_GONK
if (mAppId != NECKO_UNKNOWN_APP_ID) {
nsCOMPtr<nsINetworkInfo> activeNetworkInfo;
GetActiveNetworkInfo(activeNetworkInfo);
mActiveNetworkInfo =
new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo);
}
#endif
uint16_t port;
if (NS_FAILED(net::GetPort(aAddr, &port))) {
NS_WARNING("invalid bind address");
@@ -770,29 +757,7 @@ nsUDPSocket::GetLocalAddr(nsINetAddr * *aResult)
void
nsUDPSocket::SaveNetworkStats(bool aEnforce)
{
#ifdef MOZ_WIDGET_GONK
if (!mActiveNetworkInfo || mAppId == NECKO_UNKNOWN_APP_ID) {
return;
}
if (mByteReadCount == 0 && mByteWriteCount == 0) {
return;
}
uint64_t total = mByteReadCount + mByteWriteCount;
if (aEnforce || total > NETWORK_STATS_THRESHOLD) {
// Create the event to save the network statistics.
// the event is then dispathed to the main thread.
RefPtr<Runnable> event =
new SaveNetworkStatsEvent(mAppId, mIsInIsolatedMozBrowserElement, mActiveNetworkInfo,
mByteReadCount, mByteWriteCount, false);
NS_DispatchToMainThread(event);
// Reset the counters after saving.
mByteReadCount = 0;
mByteWriteCount = 0;
}
#endif
/*** STUB ***/
}
void
-8
View File
@@ -12,11 +12,6 @@
#include "nsAutoPtr.h"
#include "nsCycleCollectionParticipant.h"
#ifdef MOZ_WIDGET_GONK
#include "nsINetworkInterface.h"
#include "nsProxyRelease.h"
#endif
//-----------------------------------------------------------------------------
namespace mozilla {
@@ -76,9 +71,6 @@ private:
uint64_t mByteReadCount;
uint64_t mByteWriteCount;
#ifdef MOZ_WIDGET_GONK
nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
#endif
};
//-----------------------------------------------------------------------------
@@ -9,10 +9,6 @@
#include "nsXULAppAPI.h"
#include "private/pprio.h"
#ifdef MOZ_WIDGET_GONK
#include <cutils/properties.h>
#endif // MOZ_WIDGET_GONK
namespace mozilla {
namespace net {
@@ -21,29 +17,13 @@ namespace {
inline void
StartService()
{
#ifdef MOZ_WIDGET_GONK
char value[PROPERTY_VALUE_MAX] = { '\0' };
property_get("init.svc.mdnsd", value, "");
if (strcmp(value, "running") == 0) {
return;
}
property_set("ctl.start", "mdnsd");
#endif // MOZ_WIDGET_GONK
/*** STUB ***/
}
inline void
StopService()
{
#ifdef MOZ_WIDGET_GONK
char value[PROPERTY_VALUE_MAX] = { '\0' };
property_get("init.svc.mdnsd", value, "");
if (strcmp(value, "stopped") == 0) {
return;
}
property_set("ctl.stop", "mdnsd");
#endif // MOZ_WIDGET_GONK
/*** STUB ***/
}
class ServiceCounter
@@ -157,9 +137,6 @@ NS_IMPL_ISUPPORTS(nsDNSServiceDiscovery, nsIDNSServiceDiscovery)
nsDNSServiceDiscovery::~nsDNSServiceDiscovery()
{
#ifdef MOZ_WIDGET_GONK
StopService();
#endif
}
nsresult
@@ -3,7 +3,7 @@
* 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/. */
#if defined(MOZ_WIDGET_COCOA) || (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16)
#if defined(MOZ_WIDGET_COCOA)
#define ENABLE_DNS_SERVICE_DISCOVERY
#endif
@@ -45,10 +45,6 @@
#include "nsIAuthPrompt2.h"
#include "nsIFTPChannelParentInternal.h"
#ifdef MOZ_WIDGET_GONK
#include "NetStatistics.h"
#endif
using namespace mozilla;
using namespace mozilla::net;
@@ -1619,13 +1615,6 @@ nsFtpState::Init(nsFtpChannel *channel)
// initialize counter for network metering
mCountRecv = 0;
#ifdef MOZ_WIDGET_GONK
nsCOMPtr<nsINetworkInfo> activeNetworkInfo;
GetActiveNetworkInfo(activeNetworkInfo);
mActiveNetworkInfo =
new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo);
#endif
mKeepRunning = true;
mSuppliedEntityID = channel->EntityID();
@@ -2104,43 +2093,7 @@ nsFtpState::ReadSegments(nsWriteSegmentFun writer, void *closure,
nsresult
nsFtpState::SaveNetworkStats(bool enforce)
{
#ifdef MOZ_WIDGET_GONK
// Obtain app id
uint32_t appId;
bool isInBrowser;
NS_GetAppInfo(mChannel, &appId, &isInBrowser);
// Check if active network and appid are valid.
if (!mActiveNetworkInfo || appId == NECKO_NO_APP_ID) {
return NS_OK;
}
if (mCountRecv <= 0) {
// There is no traffic, no need to save.
return NS_OK;
}
// If |enforce| is false, the traffic amount is saved
// only when the total amount exceeds the predefined
// threshold.
if (!enforce && mCountRecv < NETWORK_STATS_THRESHOLD) {
return NS_OK;
}
// Create the event to save the network statistics.
// the event is then dispathed to the main thread.
RefPtr<Runnable> event =
new SaveNetworkStatsEvent(appId, isInBrowser, mActiveNetworkInfo,
mCountRecv, 0, false);
NS_DispatchToMainThread(event);
// Reset the counters after saving.
mCountRecv = 0;
return NS_OK;
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
NS_IMETHODIMP
@@ -17,11 +17,6 @@
#include "nsFtpControlConnection.h"
#include "nsIProtocolProxyCallback.h"
#ifdef MOZ_WIDGET_GONK
#include "nsINetworkInterface.h"
#include "nsProxyRelease.h"
#endif
// ftp server types
#define FTP_GENERIC_TYPE 0
#define FTP_UNIX_TYPE 1
@@ -215,11 +210,7 @@ private:
bool mDeferredCallbackPending;
// These members are used for network per-app metering (bug 855948)
// Currently, they are only available on gonk.
uint64_t mCountRecv;
#ifdef MOZ_WIDGET_GONK
nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
#endif
nsresult SaveNetworkStats(bool);
void CountRecvBytes(uint64_t recvBytes)
{
-25
View File
@@ -848,31 +848,6 @@ nsHttpHandler::InitUserAgentComponents()
}
#endif // MOZ_MULET
#if defined(MOZ_WIDGET_GONK)
// Device model identifier should be a simple token, which can be composed
// of letters, numbers, hyphen ("-") and dot (".").
// Any other characters means the identifier is invalid and ignored.
nsCString deviceId;
rv = Preferences::GetCString("general.useragent.device_id", &deviceId);
if (NS_SUCCEEDED(rv)) {
bool valid = true;
deviceId.Trim(" ", true, true);
for (size_t i = 0; i < deviceId.Length(); i++) {
char c = deviceId.CharAt(i);
if (!(isalnum(c) || c == '-' || c == '.')) {
valid = false;
break;
}
}
if (valid) {
mDeviceModelId = deviceId;
} else {
LOG(("nsHttpHandler: Ignore invalid device ID: [%s]\n",
deviceId.get()));
}
}
#endif
#ifndef MOZ_UA_OS_AGNOSTIC
// Gather OS/CPU.
#if defined(XP_WIN)
@@ -43,10 +43,6 @@
#include "sslerr.h"
#include <algorithm>
#ifdef MOZ_WIDGET_GONK
#include "NetStatistics.h"
#endif
//-----------------------------------------------------------------------------
static NS_DEFINE_CID(kMultiplexInputStream, NS_MULTIPLEXINPUTSTREAM_CID);
@@ -266,15 +262,6 @@ nsHttpTransaction::Init(uint32_t caps,
NS_GetAppInfo(channel, &mAppId, &mIsInIsolatedMozBrowser);
}
#ifdef MOZ_WIDGET_GONK
if (mAppId != NECKO_NO_APP_ID) {
nsCOMPtr<nsINetworkInfo> activeNetworkInfo;
GetActiveNetworkInfo(activeNetworkInfo);
mActiveNetworkInfo =
new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo);
}
#endif
nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal =
do_QueryInterface(eventsink);
if (httpChannelInternal) {
@@ -937,40 +924,7 @@ nsHttpTransaction::WriteSegments(nsAHttpSegmentWriter *writer,
nsresult
nsHttpTransaction::SaveNetworkStats(bool enforce)
{
#ifdef MOZ_WIDGET_GONK
// Check if active network and appid are valid.
if (!mActiveNetworkInfo || mAppId == NECKO_NO_APP_ID) {
return NS_OK;
}
if (mCountRecv <= 0 && mCountSent <= 0) {
// There is no traffic, no need to save.
return NS_OK;
}
// If |enforce| is false, the traffic amount is saved
// only when the total amount exceeds the predefined
// threshold.
uint64_t totalBytes = mCountRecv + mCountSent;
if (!enforce && totalBytes < NETWORK_STATS_THRESHOLD) {
return NS_OK;
}
// Create the event to save the network statistics.
// the event is then dispatched to the main thread.
RefPtr<Runnable> event =
new SaveNetworkStatsEvent(mAppId, mIsInIsolatedMozBrowser, mActiveNetworkInfo,
mCountRecv, mCountSent, false);
NS_DispatchToMainThread(event);
// Reset the counters after saving.
mCountSent = 0;
mCountRecv = 0;
return NS_OK;
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
void
@@ -19,11 +19,6 @@
#include "ARefBase.h"
#include "AlternateServices.h"
#ifdef MOZ_WIDGET_GONK
#include "nsINetworkInterface.h"
#include "nsProxyRelease.h"
#endif
//-----------------------------------------------------------------------------
class nsIHttpActivityObserver;
@@ -435,9 +430,6 @@ private:
uint64_t mCountSent;
uint32_t mAppId;
bool mIsInIsolatedMozBrowser;
#ifdef MOZ_WIDGET_GONK
nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
#endif
nsresult SaveNetworkStats(bool);
void CountRecvBytes(uint64_t recvBytes)
{
@@ -65,10 +65,6 @@
#include "zlib.h"
#include <algorithm>
#ifdef MOZ_WIDGET_GONK
#include "NetStatistics.h"
#endif
// rather than slurp up all of nsIWebSocket.idl, which lives outside necko, just
// dupe one constant we need from it
#define CLOSE_GOING_AWAY 1001
@@ -1396,15 +1392,6 @@ WebSocketChannel::BeginOpenInternal()
NS_GetAppInfo(localChannel, &mAppId, &mIsInIsolatedMozBrowser);
}
#ifdef MOZ_WIDGET_GONK
if (mAppId != NECKO_NO_APP_ID) {
nsCOMPtr<nsINetworkInfo> activeNetworkInfo;
GetActiveNetworkInfo(activeNetworkInfo);
mActiveNetworkInfo =
new nsMainThreadPtrHolder<nsINetworkInfo>(activeNetworkInfo);
}
#endif
rv = NS_MaybeOpenChannelUsingAsyncOpen2(localChannel, this);
if (NS_FAILED(rv)) {
@@ -4063,42 +4050,7 @@ WebSocketChannel::OnDataAvailable(nsIRequest *aRequest,
nsresult
WebSocketChannel::SaveNetworkStats(bool enforce)
{
#ifdef MOZ_WIDGET_GONK
// Check if the active network and app id are valid.
if(!mActiveNetworkInfo || mAppId == NECKO_NO_APP_ID) {
return NS_OK;
}
uint64_t countRecv = 0;
uint64_t countSent = 0;
mCountRecv.exchange(countRecv);
mCountSent.exchange(countSent);
if (countRecv == 0 && countSent == 0) {
// There is no traffic, no need to save.
return NS_OK;
}
// If |enforce| is false, the traffic amount is saved
// only when the total amount exceeds the predefined
// threshold.
uint64_t totalBytes = countRecv + countSent;
if (!enforce && totalBytes < NETWORK_STATS_THRESHOLD) {
return NS_OK;
}
// Create the event to save the network statistics.
// the event is then dispatched to the main thread.
RefPtr<Runnable> event =
new SaveNetworkStatsEvent(mAppId, mIsInIsolatedMozBrowser, mActiveNetworkInfo,
countRecv, countSent, false);
NS_DispatchToMainThread(event);
return NS_OK;
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
} // namespace net
@@ -21,11 +21,6 @@
#include "nsIStringStream.h"
#include "BaseWebSocketChannel.h"
#ifdef MOZ_WIDGET_GONK
#include "nsINetworkInterface.h"
#include "nsProxyRelease.h"
#endif
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsDeque.h"
@@ -307,9 +302,6 @@ private:
Atomic<uint64_t, Relaxed> mCountSent;
uint32_t mAppId;
bool mIsInIsolatedMozBrowser;
#ifdef MOZ_WIDGET_GONK
nsMainThreadPtrHandle<nsINetworkInfo> mActiveNetworkInfo;
#endif
nsresult SaveNetworkStats(bool);
void CountRecvBytes(uint64_t recvBytes)
{
@@ -8,10 +8,6 @@
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
#ifndef MOZ_WIDGET_GONK
#include <ifaddrs.h>
#include <net/if.h>
#endif
#include "nsThreadUtils.h"
#include "nsIObserverService.h"
@@ -28,10 +24,6 @@
#include "mozilla/Sprintf.h"
#include "mozilla/Telemetry.h"
#ifdef MOZ_WIDGET_GONK
#include <cutils/properties.h>
#endif
/* a shorter name that better explains what it does */
#define EINTR_RETRY(x) MOZ_TEMP_FAILURE_RETRY(x)
@@ -210,9 +202,6 @@ void nsNotifyAddrListener::calculateNetworkId(void)
//
void nsNotifyAddrListener::checkLink(void)
{
#ifdef MOZ_WIDGET_GONK
// b2g instead has NetworkManager.js which handles UP/DOWN
#else
struct ifaddrs *list;
struct ifaddrs *ifa;
bool link = false;
@@ -247,7 +236,6 @@ void nsNotifyAddrListener::checkLink(void)
SendEvent(mLinkUp ?
NS_NETWORK_LINK_DATA_UP : NS_NETWORK_LINK_DATA_DOWN);
}
#endif
}
void nsNotifyAddrListener::OnNetlinkMessage(int aNetlinkSocket)
+1 -29
View File
@@ -48,7 +48,6 @@ class nsWifiListener
bool mHasSentData;
};
#ifndef MOZ_WIDGET_GONK
class nsWifiMonitor final : nsIRunnable, nsIWifiMonitor, nsIObserver
{
public:
@@ -79,32 +78,5 @@ class nsWifiMonitor final : nsIRunnable, nsIWifiMonitor, nsIObserver
nsAutoPtr<WindowsWifiScannerInterface> mWinWifiScanner;
#endif
};
#else
#include "nsIWifi.h"
class nsWifiMonitor final : nsIWifiMonitor, nsIWifiScanResultsReady, nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWIFIMONITOR
NS_DECL_NSIOBSERVER
NS_DECL_NSIWIFISCANRESULTSREADY
nsWifiMonitor();
private:
~nsWifiMonitor();
void ClearTimer() {
if (mTimer) {
mTimer->Cancel();
mTimer = nullptr;
}
}
void StartScan();
nsCOMArray<nsWifiAccessPoint> mLastAccessPoints;
nsTArray<nsWifiListener> mListeners;
nsCOMPtr<nsITimer> mTimer;
};
#endif
#endif
#endif // __nsWifiMonitor__
@@ -46,7 +46,7 @@
#include "NativeFileWatcherNotSupported.h"
#endif // (XP_WIN)
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
#define MOZ_HAS_TERMINATOR
#endif
@@ -145,9 +145,6 @@ static const mozilla::Module::ContractIDEntry kDiskSpaceWatcherContracts[] = {
};
static const mozilla::Module::CategoryEntry kDiskSpaceWatcherCategories[] = {
#ifdef MOZ_WIDGET_GONK
{ "profile-after-change", "Disk Space Watcher Service", DISKSPACEWATCHER_CONTRACTID },
#endif
{ nullptr }
};
@@ -410,8 +410,6 @@ this.DownloadIntegration = {
directoryPath = yield this.getPreferredDownloadsDirectory();
#elifdef MOZ_WIDGET_ANDROID
directoryPath = yield this.getSystemDownloadsDirectory();
#elifdef MOZ_WIDGET_GONK
directoryPath = yield this.getSystemDownloadsDirectory();
#else
directoryPath = this._getDirectory("TmpD");
#endif
@@ -102,7 +102,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIURI* aReferrer, nsIF
const nsACString& aContentType, bool aIsPrivate)
{
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) \
|| defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GONK)
|| defined(MOZ_WIDGET_GTK)
nsAutoString path;
if (aTarget && NS_SUCCEEDED(aTarget->GetPath(path))) {
+2 -2
View File
@@ -237,7 +237,7 @@ NS_IMPL_ISUPPORTS(nsAppStartup,
NS_IMETHODIMP
nsAppStartup::CreateHiddenWindow()
{
#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_UIKIT)
#if defined(MOZ_WIDGET_UIKIT)
return NS_OK;
#else
nsCOMPtr<nsIAppShellService> appShellService
@@ -252,7 +252,7 @@ nsAppStartup::CreateHiddenWindow()
NS_IMETHODIMP
nsAppStartup::DestroyHiddenWindow()
{
#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_UIKIT)
#if defined(MOZ_WIDGET_UIKIT)
return NS_OK;
#else
nsCOMPtr<nsIAppShellService> appShellService
+1 -1
View File
@@ -1127,7 +1127,7 @@ TelemetryImpl::SnapshotSubsessionHistograms(bool clearSubsession,
JSContext *cx,
JS::MutableHandle<JS::Value> ret)
{
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
return TelemetryHistogram::CreateHistogramSnapshots(cx, ret, true,
clearSubsession);
#else
@@ -583,7 +583,7 @@ internal_GetHistogramByName(const nsACString &name, Histogram **ret)
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
/**
* This clones a histogram |existing| with the id |existingId| to a
@@ -684,7 +684,7 @@ internal_HistogramAdd(Histogram& histogram, int32_t value, uint32_t dataset)
return NS_OK;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (Histogram* subsession = internal_GetSubsessionHistogram(histogram)) {
subsession->Add(value);
}
@@ -729,7 +729,7 @@ internal_HistogramClear(Histogram& aHistogram, bool onlySubsession)
aHistogram.Clear();
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (Histogram* subsession = internal_GetSubsessionHistogram(aHistogram)) {
subsession->Clear();
}
@@ -926,7 +926,7 @@ private:
typedef nsBaseHashtableET<nsCStringHashKey, Histogram*> KeyedHistogramEntry;
typedef AutoHashtable<KeyedHistogramEntry> KeyedHistogramMapType;
KeyedHistogramMapType mHistogramMap;
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType mSubsessionMap;
#endif
@@ -950,7 +950,7 @@ KeyedHistogram::KeyedHistogram(const nsACString &name,
uint32_t min, uint32_t max,
uint32_t bucketCount, uint32_t dataset)
: mHistogramMap()
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
, mSubsessionMap()
#endif
, mName(name)
@@ -968,7 +968,7 @@ nsresult
KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram,
bool subsession)
{
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType& map = subsession ? mSubsessionMap : mHistogramMap;
#else
KeyedHistogramMapType& map = mHistogramMap;
@@ -980,7 +980,7 @@ KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram,
}
nsCString histogramName;
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {
histogramName.AppendLiteral(SUBSESSION_HISTOGRAM_PREFIX);
}
@@ -1042,7 +1042,7 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample)
if (!histogram) {
return NS_ERROR_FAILURE;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
Histogram* subsession = GetHistogram(key, true);
MOZ_ASSERT(subsession);
if (!subsession) {
@@ -1055,7 +1055,7 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample)
}
histogram->Add(sample);
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
subsession->Add(sample);
#endif
return NS_OK;
@@ -1068,7 +1068,7 @@ KeyedHistogram::Clear(bool onlySubsession)
if (!XRE_IsParentProcess()) {
return;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
for (auto iter = mSubsessionMap.Iter(); !iter.Done(); iter.Next()) {
iter.Get()->mData->Clear();
}
@@ -1137,7 +1137,7 @@ nsresult
KeyedHistogram::GetJSSnapshot(JSContext* cx, JS::Handle<JSObject*> obj,
bool subsession, bool clearSubsession)
{
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType& map = subsession ? mSubsessionMap : mHistogramMap;
#else
KeyedHistogramMapType& map = mHistogramMap;
@@ -1146,7 +1146,7 @@ KeyedHistogram::GetJSSnapshot(JSContext* cx, JS::Handle<JSObject*> obj,
return NS_ERROR_FAILURE;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession && clearSubsession) {
Clear(true);
}
@@ -1637,7 +1637,7 @@ internal_JSHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
}
bool onlySubsession = false;
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (args.length() >= 1) {
@@ -1874,7 +1874,7 @@ internal_JSKeyedHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
return internal_KeyedHistogram_SnapshotImpl(cx, argc, vp, false, false);
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
bool
internal_JSKeyedHistogram_SubsessionSnapshot(JSContext *cx,
unsigned argc, JS::Value *vp)
@@ -1883,7 +1883,7 @@ internal_JSKeyedHistogram_SubsessionSnapshot(JSContext *cx,
}
#endif
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
bool
internal_JSKeyedHistogram_SnapshotSubsessionAndClear(JSContext *cx,
unsigned argc,
@@ -1911,7 +1911,7 @@ internal_JSKeyedHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
return false;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
bool onlySubsession = false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@@ -1974,7 +1974,7 @@ internal_WrapAndReturnKeyedHistogram(KeyedHistogram *h, JSContext *cx,
if (!(JS_DefineFunction(cx, obj, "add", internal_JSKeyedHistogram_Add, 2, 0)
&& JS_DefineFunction(cx, obj, "snapshot",
internal_JSKeyedHistogram_Snapshot, 1, 0)
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
&& JS_DefineFunction(cx, obj, "subsessionSnapshot",
internal_JSKeyedHistogram_SubsessionSnapshot, 1, 0)
&& JS_DefineFunction(cx, obj, "snapshotSubsessionAndClear",
@@ -2425,7 +2425,7 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
}
Histogram* original = h;
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {
h = internal_GetSubsessionHistogram(*h);
if (!h) {
@@ -2453,7 +2453,7 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
}
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession && clearSubsession) {
h->Clear();
}
+2 -7
View File
@@ -1527,11 +1527,9 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
if (gExceptionHandler)
return NS_ERROR_ALREADY_INITIALIZED;
#if !defined(DEBUG) || defined(MOZ_WIDGET_GONK)
#if !defined(DEBUG)
// In non-debug builds, enable the crash reporter by default, and allow
// disabling it with the MOZ_CRASHREPORTER_DISABLE environment variable.
// Also enable it by default in debug gonk builds as it is difficult to
// set environment on startup.
const char *envvar = PR_GetEnv("MOZ_CRASHREPORTER_DISABLE");
if (envvar && *envvar && !force)
return NS_OK;
@@ -1543,10 +1541,7 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
return NS_OK;
#endif
#if defined(MOZ_WIDGET_GONK)
doReport = false;
headlessClient = true;
#elif defined(XP_WIN)
#if defined(XP_WIN)
doReport = ShouldReport();
#else
// this environment variable prevents us from launching
-2
View File
@@ -148,8 +148,6 @@ this.AppConstants = Object.freeze({
"macosx",
#elif MOZ_WIDGET_ANDROID
"android",
#elif MOZ_WIDGET_GONK
"gonk",
#elif XP_LINUX
"linux",
#else
@@ -1,7 +1,6 @@
component {66354bc9-7ed1-4692-ae1d-8da97d6b205e} nsBlocklistService.js
contract @mozilla.org/extensions/blocklist;1 {66354bc9-7ed1-4692-ae1d-8da97d6b205e}
category profile-after-change nsBlocklistService @mozilla.org/extensions/blocklist;1
#ifndef MOZ_WIDGET_GONK
category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400
component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js
contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa}
@@ -17,4 +16,3 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr
category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm
#endif
category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm
#endif
+3 -134
View File
@@ -110,33 +110,10 @@ struct UpdateServerThreadArgs
#define USE_EXECV
#endif
#if defined(MOZ_WIDGET_GONK)
# include "automounter_gonk.h"
# include <unistd.h>
# include <android/log.h>
# include <linux/ioprio.h>
# include <sys/resource.h>
#if ANDROID_VERSION < 21
// The only header file in bionic which has a function prototype for ioprio_set
// is libc/include/sys/linux-unistd.h. However, linux-unistd.h conflicts
// badly with unistd.h, so we declare the prototype for ioprio_set directly.
extern "C" MOZ_EXPORT int ioprio_set(int which, int who, int ioprio);
#else
# include <sys/syscall.h>
static int ioprio_set(int which, int who, int ioprio) {
return syscall(__NR_ioprio_set, which, who, ioprio);
}
#endif
# define MAYBE_USE_HARD_LINKS 1
static bool sUseHardLinks = true;
#else
# define MAYBE_USE_HARD_LINKS 0
#endif
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
#include "nss.h"
#include "prerror.h"
#endif
@@ -2495,44 +2472,9 @@ ReadMARChannelIDs(const NS_tchar *path, MARChannelStringTable *results)
static int
GetUpdateFileName(NS_tchar *fileName, int maxChars)
{
#if defined(MOZ_WIDGET_GONK)
// If an update.link file exists, then it will contain the name
// of the update file (terminated by a newline).
NS_tchar linkFileName[MAXPATHLEN];
NS_tsnprintf(linkFileName, sizeof(linkFileName)/sizeof(linkFileName[0]),
NS_T("%s/update.link"), gPatchDirPath);
AutoFile linkFile(NS_tfopen(linkFileName, NS_T("rb")));
if (linkFile == nullptr) {
NS_tsnprintf(fileName, maxChars,
NS_T("%s/update.mar"), gPatchDirPath);
return OK;
}
char dataFileName[MAXPATHLEN];
size_t bytesRead;
if ((bytesRead = fread(dataFileName, 1, sizeof(dataFileName)-1, linkFile)) <= 0) {
*fileName = NS_T('\0');
return READ_ERROR;
}
if (dataFileName[bytesRead-1] == '\n') {
// Strip trailing newline (for \n and \r\n)
bytesRead--;
}
if (dataFileName[bytesRead-1] == '\r') {
// Strip trailing CR (for \r, \r\n)
bytesRead--;
}
dataFileName[bytesRead] = '\0';
strncpy(fileName, dataFileName, maxChars-1);
fileName[maxChars-1] = '\0';
#else
// We currently only support update.link files under GONK
// We currently don't support update.link files
NS_tsnprintf(fileName, maxChars,
NS_T("%s/update.mar"), gPatchDirPath);
#endif
return OK;
}
@@ -2776,26 +2718,8 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
#if defined(MOZ_WIDGET_GONK)
if (EnvHasValue("LD_PRELOAD")) {
// If the updater is launched with LD_PRELOAD set, then we wind up
// preloading libmozglue.so. Under some circumstances, this can cause
// the remount of /system to fail when going from rw to ro, so if we
// detect LD_PRELOAD we unsetenv it and relaunch ourselves without it.
// This will cause the offending preloaded library to be closed.
//
// For a variety of reasons, this is really hard to do in a safe manner
// in the parent process, so we do it here.
unsetenv("LD_PRELOAD");
execv(argv[0], argv);
__android_log_print(ANDROID_LOG_INFO, "updater",
"execve failed: errno: %d. Exiting...", errno);
_exit(1);
}
#endif
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
// On Windows and Mac we rely on native APIs to do verifications so we don't
// need to initialize NSS at all there.
// Otherwise, minimize the amount of NSS we depend on by avoiding all the NSS
@@ -3085,36 +3009,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
#ifdef MOZ_WIDGET_GONK
const char *prioEnv = getenv("MOZ_UPDATER_PRIO");
if (prioEnv) {
int32_t prioVal;
int32_t oomScoreAdj;
int32_t ioprioClass;
int32_t ioprioLevel;
if (sscanf(prioEnv, "%d/%d/%d/%d",
&prioVal, &oomScoreAdj, &ioprioClass, &ioprioLevel) == 4) {
LOG(("MOZ_UPDATER_PRIO=%s", prioEnv));
if (setpriority(PRIO_PROCESS, 0, prioVal)) {
LOG(("setpriority(%d) failed, errno = %d", prioVal, errno));
}
if (ioprio_set(IOPRIO_WHO_PROCESS, 0,
IOPRIO_PRIO_VALUE(ioprioClass, ioprioLevel))) {
LOG(("ioprio_set(%d,%d) failed: errno = %d",
ioprioClass, ioprioLevel, errno));
}
FILE *fs = fopen("/proc/self/oom_score_adj", "w");
if (fs) {
fprintf(fs, "%d", oomScoreAdj);
fclose(fs);
} else {
LOG(("Unable to open /proc/self/oom_score_adj for writing, errno = %d",
errno));
}
}
}
#endif
#ifdef XP_WIN
if (pid > 0) {
HANDLE parent = OpenProcess(SYNCHRONIZE, false, (DWORD) pid);
@@ -3439,27 +3333,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif
#if defined(MOZ_WIDGET_GONK)
// In gonk, the master b2g process sets its umask to 0027 because
// there's no reason for it to ever create world-readable files.
// The updater binary, however, needs to do this, and it inherits
// the master process's cautious umask. So we drop down a bit here.
umask(0022);
// Remount the /system partition as read-write for gonk. The destructor will
// remount /system as read-only. We add an extra level of scope here to avoid
// calling LogFinish() before the GonkAutoMounter destructor has a chance
// to be called
{
#if !defined(TEST_UPDATER)
GonkAutoMounter mounter;
if (mounter.GetAccess() != MountAccess::ReadWrite) {
WriteStatusFile(FILESYSTEM_MOUNT_READWRITE_ERROR);
return 1;
}
#endif
#endif
if (sStagedUpdate) {
// When staging updates, blow away the old installation directory and create
// it from scratch.
@@ -3759,10 +3632,6 @@ int NS_main(int argc, NS_tchar **argv)
}
#endif /* XP_WIN */
#if defined(MOZ_WIDGET_GONK)
} // end the extra level of scope for the GonkAutoMounter
#endif
#ifdef XP_MACOSX
// When the update is successful remove the precomplete file in the root of
// the application bundle and move the distribution directory from
@@ -5,7 +5,6 @@ component {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} nsBlocklistServiceContent.js pr
contract @mozilla.org/extensions/blocklist;1 {e0a106ed-6ad4-47a4-b6af-2f1c8aa4712d} process=content
category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400
#ifndef MOZ_WIDGET_GONK
component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js
contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa}
#ifndef MOZ_WIDGET_ANDROID
@@ -22,6 +21,5 @@ category JavaScript-global-property InstallTrigger @mozilla.org/addons/installtr
category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm
#endif
category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm
#endif
component {8866d8e3-4ea5-48b7-a891-13ba0ac15235} amWebAPI.js
contract @mozilla.org/addon-web-api/manager;1 {8866d8e3-4ea5-48b7-a891-13ba0ac15235}
-23
View File
@@ -30,10 +30,6 @@
#include "prenv.h"
#endif
#if defined(MOZ_WIDGET_GONK)
#include <sys/syscall.h>
#endif
// **********************************************************************
// class nsProfileLock
//
@@ -192,25 +188,6 @@ void nsProfileLock::FatalSignalHandler(int signo
}
}
#ifdef MOZ_WIDGET_GONK
switch (signo) {
case SIGQUIT:
case SIGILL:
case SIGABRT:
case SIGSEGV:
// Retrigger the signal for those that can generate a core dump
signal(signo, SIG_DFL);
if (info->si_code <= 0) {
if (syscall(__NR_tgkill, getpid(), syscall(__NR_gettid), signo) < 0) {
break;
}
}
return;
default:
break;
}
#endif
// Backstop exit call, just in case.
_exit(signo);
}
-35
View File
@@ -65,12 +65,6 @@
#include <prthread.h>
#include <prtime.h>
#ifdef MOZ_WIDGET_GONK
#include "nsThreadUtils.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
#endif
using mozilla::TimeDuration;
using mozilla::TimeStamp;
using mozilla::FireAndWaitForTracerEvent;
@@ -85,31 +79,6 @@ struct TracerStartClosure {
int32_t mThresholdInterval;
};
#ifdef MOZ_WIDGET_GONK
class EventLoopLagDispatcher : public Runnable
{
public:
explicit EventLoopLagDispatcher(int aLag)
: mLag(aLag) {}
NS_IMETHOD Run() override
{
nsCOMPtr<nsIObserverService> obsService =
mozilla::services::GetObserverService();
if (!obsService) {
return NS_ERROR_FAILURE;
}
nsAutoString value;
value.AppendInt(mLag);
return obsService->NotifyObservers(nullptr, "event-loop-lag", value.get());
}
private:
int mLag;
};
#endif
/*
* The tracer thread fires events at the native event loop roughly
* every kMeasureInterval. It will sleep to attempt not to send them
@@ -180,10 +149,6 @@ void TracerThread(void *arg)
fprintf(log, "MOZ_EVENT_TRACE sample %llu %lf\n",
now,
duration.ToMilliseconds());
#ifdef MOZ_WIDGET_GONK
NS_DispatchToMainThread(
new EventLoopLagDispatcher(int(duration.ToSecondsSigDigits() * 1000)));
#endif
}
if (next_sleep > duration.ToMilliseconds()) {
+1 -1
View File
@@ -275,7 +275,7 @@ XRE_InitChildProcess(int aArgc,
setupProfilingStuff();
#endif
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK)
#if !defined(MOZ_WIDGET_ANDROID)
// On non-Fennec Gecko, the GMPLoader code resides in plugin-container,
// and we must forward it through to the GMP code here.
GMPProcessChild::SetGMPLoader(aChildData->gmpLoader.get());
+4 -140
View File
@@ -74,23 +74,6 @@ GetUpdateLog()
#define UPDATER_PNG "updater.png"
#endif
#if defined(MOZ_WIDGET_GONK)
#include <linux/ioprio.h>
static const int kB2GServiceArgc = 2;
static const char *kB2GServiceArgv[] = { "/system/bin/start", "b2g" };
static const char kAppUpdaterPrio[] = "app.update.updater.prio";
static const char kAppUpdaterOomScoreAdj[] = "app.update.updater.oom_score_adj";
static const char kAppUpdaterIOPrioClass[] = "app.update.updater.ioprio.class";
static const char kAppUpdaterIOPrioLevel[] = "app.update.updater.ioprio.level";
static const int kAppUpdaterPrioDefault = 19; // -20..19 where 19 = lowest priority
static const int kAppUpdaterOomScoreAdjDefault = -1000; // -1000 = Never kill
static const int kAppUpdaterIOPrioClassDefault = IOPRIO_CLASS_IDLE;
static const int kAppUpdaterIOPrioLevelDefault = 0; // Doesn't matter for CLASS IDLE
#endif
static nsresult
GetCurrentWorkingDir(char *buf, size_t size)
{
@@ -387,7 +370,7 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
* @param pathToAppend A new library path to prepend to LD_LIBRARY_PATH
*/
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
#include "prprf.h"
#define PATH_SEPARATOR ":"
#define LD_LIBRARY_PATH_ENVVAR_NAME "LD_LIBRARY_PATH"
@@ -503,15 +486,9 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
#else
nsAutoCString appFilePath;
#if defined(MOZ_WIDGET_GONK)
appFilePath.Assign(kB2GServiceArgv[0]);
appArgc = kB2GServiceArgc;
appArgv = const_cast<char**>(kB2GServiceArgv);
#else
rv = appFile->GetNativePath(appFilePath);
if (NS_FAILED(rv))
return;
#endif
nsAutoCString updaterPath;
rv = updater->GetNativePath(updaterPath);
@@ -617,19 +594,13 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
PR_SetEnv("MOZ_SAFE_MODE_RESTART=1");
}
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
AppendToLibPath(installDirPath.get());
#endif
LOG(("spawning updater process for replacing [%s]\n", updaterPath.get()));
#if defined(XP_UNIX) & !defined(XP_MACOSX)
# if defined(MOZ_WIDGET_GONK)
// In Gonk, we preload libmozglue, which the updater process doesn't need.
// Since the updater will move and delete libmozglue.so, this can actually
// stop the /system mount from correctly being remounted as read-only.
unsetenv("LD_PRELOAD");
# endif
exit(execv(updaterPath.get(), argv));
#elif defined(XP_WIN)
// Switch the application using updater.exe
@@ -647,46 +618,6 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
#endif
}
#if defined(MOZ_WIDGET_GONK)
static nsresult
GetOSApplyToDir(nsACString& applyToDir)
{
nsCOMPtr<nsIProperties> ds =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
NS_ASSERTION(ds, "Can't get directory service");
nsCOMPtr<nsIFile> osApplyToDir;
nsresult rv = ds->Get(XRE_OS_UPDATE_APPLY_TO_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(osApplyToDir));
if (NS_FAILED(rv)) {
LOG(("Can't get the OS applyTo dir"));
return rv;
}
return osApplyToDir->GetNativePath(applyToDir);
}
static void
SetOSApplyToDir(nsIUpdate* update, const nsACString& osApplyToDir)
{
nsresult rv;
nsCOMPtr<nsIWritablePropertyBag> updateProperties =
do_QueryInterface(update, &rv);
if (NS_FAILED(rv)) {
return;
}
RefPtr<nsVariant> variant = new nsVariant();
rv = variant->SetAsACString(osApplyToDir);
if (NS_FAILED(rv)) {
return;
}
updateProperties->SetProperty(NS_LITERAL_STRING("osApplyToDir"), variant);
}
#endif
/**
* Apply an update. This applies to both normal and staged updates.
*
@@ -780,13 +711,9 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
if (NS_FAILED(rv))
return;
// Get the directory where the update was staged for replace and GONK OS
// Updates or where it will be applied.
#ifndef MOZ_WIDGET_GONK
// OS Updates are only supported on GONK so force it to false on everything
// OS Updates were only supported on GONK so force it to false on everything
// but GONK to simplify the following logic.
isOSUpdate = false;
#endif
nsAutoCString applyToDir;
nsCOMPtr<nsIFile> updatedDir;
if (restart && !isOSUpdate) {
@@ -806,15 +733,6 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
return;
}
applyToDir = NS_ConvertUTF16toUTF8(applyToDirW);
#elif MOZ_WIDGET_GONK
if (isOSUpdate) {
if (!osApplyToDir) {
return;
}
rv = osApplyToDir->GetNativePath(applyToDir);
} else {
rv = updatedDir->GetNativePath(applyToDir);
}
#else
rv = updatedDir->GetNativePath(applyToDir);
#endif
@@ -900,33 +818,13 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
PR_SetEnv("MOZ_SAFE_MODE_RESTART=1");
}
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && \
!defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
!defined(XP_MACOSX)
AppendToLibPath(installDirPath.get());
#endif
if (isOSUpdate) {
PR_SetEnv("MOZ_OS_UPDATE=1");
}
#if defined(MOZ_WIDGET_GONK)
// We want the updater to be CPU friendly and not subject to being killed by
// the low memory killer, so we pass in some preferences to allow it to
// adjust its priority.
int32_t prioVal = Preferences::GetInt(kAppUpdaterPrio,
kAppUpdaterPrioDefault);
int32_t oomScoreAdj = Preferences::GetInt(kAppUpdaterOomScoreAdj,
kAppUpdaterOomScoreAdjDefault);
int32_t ioprioClass = Preferences::GetInt(kAppUpdaterIOPrioClass,
kAppUpdaterIOPrioClassDefault);
int32_t ioprioLevel = Preferences::GetInt(kAppUpdaterIOPrioLevel,
kAppUpdaterIOPrioLevelDefault);
nsPrintfCString prioEnv("MOZ_UPDATER_PRIO=%d/%d/%d/%d",
prioVal, oomScoreAdj, ioprioClass, ioprioLevel);
// Note: we allocate a new string on heap and pass that to PR_SetEnv, since
// the string can be used after this function returns. This means that we
// will intentionally leak this buffer.
PR_SetEnv(ToNewCString(prioEnv));
#endif
LOG(("spawning updater process [%s]\n", updaterPath.get()));
@@ -1122,12 +1020,6 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
// Check for and process any available updates
bool persistent;
nsresult rv = NS_ERROR_FAILURE; // Take the NS_FAILED path when non-GONK
#ifdef MOZ_WIDGET_GONK
// Check in the sdcard for updates first, since that's our preferred
// download location.
rv = dirProvider->GetFile(XRE_UPDATE_ARCHIVE_DIR, &persistent,
getter_AddRefs(updRoot));
#endif
if (NS_FAILED(rv)) {
rv = dirProvider->GetFile(XRE_UPDATE_ROOT_DIR, &persistent,
getter_AddRefs(updRoot));
@@ -1217,34 +1109,6 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
}
mInfo.mAppVersion = appVersion;
#if defined(MOZ_WIDGET_GONK)
NS_ENSURE_ARG_POINTER(aUpdate);
bool isOSUpdate;
if (NS_SUCCEEDED(aUpdate->GetIsOSUpdate(&isOSUpdate)) &&
isOSUpdate) {
nsAutoCString osApplyToDir;
// This needs to be done on the main thread, so we pass it along in
// BackgroundThreadInfo
nsresult rv = GetOSApplyToDir(osApplyToDir);
if (NS_FAILED(rv)) {
LOG(("Can't get the OS apply to dir"));
return rv;
}
SetOSApplyToDir(aUpdate, osApplyToDir);
mInfo.mIsOSUpdate = true;
rv = NS_NewNativeLocalFile(osApplyToDir, false,
getter_AddRefs(mInfo.mOSApplyToDir));
if (NS_FAILED(rv)) {
LOG(("Can't create nsIFile for OS apply to dir"));
return rv;
}
}
#endif
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
nsCOMPtr<nsIRunnable> r = NewRunnableMethod(this, &nsUpdateProcessor::StartStagedUpdate);
return NS_NewThread(getter_AddRefs(mProcessWatcher), r);
-12
View File
@@ -1122,14 +1122,6 @@ nsresult
nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
{
nsCOMPtr<nsIFile> updRoot;
#if defined(MOZ_WIDGET_GONK)
nsresult rv = NS_NewNativeLocalFile(nsDependentCString("/data/local"),
true,
getter_AddRefs(updRoot));
NS_ENSURE_SUCCESS(rv, rv);
#else
nsCOMPtr<nsIFile> appFile;
bool per = false;
nsresult rv = GetFile(XRE_EXECUTABLE_FILE, &per, getter_AddRefs(appFile));
@@ -1261,7 +1253,6 @@ nsXREDirProvider::GetUpdateRootDir(nsIFile* *aResult)
NS_ENSURE_SUCCESS(rv, rv);
#endif // XP_WIN
#endif
updRoot.forget(aResult);
return NS_OK;
}
@@ -1365,9 +1356,6 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal)
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewLocalFile(path, true, getter_AddRefs(localDir));
#elif defined(MOZ_WIDGET_GONK)
rv = NS_NewNativeLocalFile(NS_LITERAL_CSTRING("/data/b2g"), true,
getter_AddRefs(localDir));
#elif defined(XP_UNIX)
const char* homeDir = getenv("HOME");
if (!homeDir || !*homeDir)
@@ -552,16 +552,6 @@ static const nsExtraMimeTypeEntry extraMimeEntries[] =
{ APPLICATION_OGG, "ogg", "Ogg Video"},
{ AUDIO_OGG, "oga", "Ogg Audio" },
{ AUDIO_OGG, "opus", "Opus Audio" },
#ifdef MOZ_WIDGET_GONK
{ AUDIO_AMR, "amr", "Adaptive Multi-Rate Audio" },
{ AUDIO_FLAC, "flac", "FLAC Audio" },
{ VIDEO_AVI, "avi", "Audio Video Interleave" },
{ VIDEO_AVI, "divx", "Audio Video Interleave" },
{ VIDEO_MPEG_TS, "ts", "MPEG Transport Stream" },
{ VIDEO_MPEG_TS, "m2ts", "MPEG-2 Transport Stream" },
{ VIDEO_MATROSKA, "mkv", "MATROSKA VIDEO" },
{ AUDIO_MATROSKA, "mka", "MATROSKA AUDIO" },
#endif
{ VIDEO_WEBM, "webm", "Web Media Video" },
{ AUDIO_WEBM, "webm", "Web Media Audio" },
{ AUDIO_MP3, "mp3", "MPEG Audio" },
@@ -571,13 +561,6 @@ static const nsExtraMimeTypeEntry extraMimeEntries[] =
{ AUDIO_WAV, "wav", "Waveform Audio" },
{ VIDEO_3GPP, "3gpp,3gp", "3GPP Video" },
{ VIDEO_3GPP2,"3g2", "3GPP2 Video" },
#ifdef MOZ_WIDGET_GONK
// The AUDIO_3GPP has to come after the VIDEO_3GPP entry because the Gallery
// app on Firefox OS depends on the "3gp" extension mapping to the
// "video/3gpp" MIME type.
{ AUDIO_3GPP, "3gpp,3gp", "3GPP Audio" },
{ AUDIO_3GPP2, "3g2", "3GPP2 Audio" },
#endif
{ AUDIO_MIDI, "mid", "Standard MIDI Audio" }
};
+1 -1
View File
@@ -379,7 +379,7 @@ NS_EVENT_MESSAGE(eDeviceMotion)
NS_EVENT_MESSAGE(eDeviceProximity)
NS_EVENT_MESSAGE(eUserProximity)
NS_EVENT_MESSAGE(eDeviceLight)
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
NS_EVENT_MESSAGE(eOrientationChange)
#endif
-5
View File
@@ -541,10 +541,6 @@ PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
DoCommandCallback aCallback,
void* aCallbackData)
{
// B2G doesn't have native key bindings.
#ifdef MOZ_WIDGET_GONK
return false;
#else // #ifdef MOZ_WIDGET_GONK
AutoCacheNativeKeyCommands autoCache(this);
if (!aEvent.mWidget && !mNativeKeyCommandsValid) {
MOZ_ASSERT(!aEvent.mFlags.mIsSynthesizedForTests);
@@ -581,7 +577,6 @@ PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
aCallback(static_cast<mozilla::Command>((*commands)[i]), aCallbackData);
}
return true;
#endif
}
LayerManager*
-3
View File
@@ -17,8 +17,6 @@
using namespace mozilla;
using namespace mozilla::widget;
#ifndef MOZ_WIDGET_GONK
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragServiceProxy)
@@ -68,4 +66,3 @@ static const mozilla::Module kWidgetModule = {
NSMODULE_DEFN(nsContentProcessWidgetModule) = &kWidgetModule;
#endif /* MOZ_WIDGET_GONK */
-7
View File
@@ -732,13 +732,6 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
widgetInitData.mRTL = isRTL;
}
#ifdef MOZ_WIDGET_GONK
// B2G multi-screen support. Screen ID is for differentiating screens of
// windows, and due to the hardware limitation, it is platform-specific for
// now, which align with the value of display type defined in HWC.
widgetInitData.mScreenId = mScreenId;
#endif
nsresult rv = window->Initialize(parent, center ? aParent : nullptr,
aUrl, aInitialWidth, aInitialHeight,
aIsHiddenWindow, aOpeningTab,