Browse Source

Remove MOZ_WIDGET_GONK [1/2]

Tag #288
pull/1/head
wolfbeast 4 years ago committed by Roy Tam
parent
commit
b586913598
  1. 3
      config/system-headers
  2. 3
      dom/apps/AppsUtils.jsm
  3. 32
      dom/audiochannel/AudioChannelService.cpp
  4. 22
      dom/audiochannel/AudioChannelService.h
  5. 6
      dom/base/Navigator.cpp
  6. 2
      dom/base/ScreenOrientation.cpp
  7. 3
      dom/base/nsContentPermissionHelper.cpp
  8. 10
      dom/base/nsGlobalWindow.cpp
  9. 8
      dom/base/nsGlobalWindow.h
  10. 2
      dom/base/nsPIDOMWindow.h
  11. 4
      dom/canvas/CanvasRenderingContext2D.cpp
  12. 28
      dom/canvas/WebGLContext.cpp
  13. 8
      dom/events/EventListenerManager.cpp
  14. 2
      dom/events/EventNameList.h
  15. 13
      dom/geolocation/nsGeolocation.cpp
  16. 4
      dom/html/nsIFormControl.h
  17. 2
      dom/indexedDB/ActorsParent.cpp
  18. 52
      dom/ipc/ContentChild.cpp
  19. 137
      dom/ipc/ContentParent.cpp
  20. 72
      dom/network/TCPSocket.cpp
  21. 17
      dom/network/TCPSocket.h
  22. 6
      dom/plugins/base/PluginPRLibrary.cpp
  23. 2
      dom/plugins/base/PluginPRLibrary.h
  24. 1
      dom/plugins/base/nsNPAPIPlugin.cpp
  25. 2
      dom/plugins/ipc/PluginLibrary.h
  26. 4
      dom/plugins/ipc/PluginModuleParent.cpp
  27. 4
      dom/plugins/ipc/PluginModuleParent.h
  28. 49
      dom/presentation/PresentationSessionInfo.cpp
  29. 5
      dom/presentation/provider/PresentationDeviceProviderModule.cpp
  30. 11
      dom/system/OSFileConstants.cpp
  31. 2
      dom/webidl/Window.webidl
  32. 6
      hal/Hal.cpp
  33. 31
      hal/linux/LinuxPower.cpp
  34. 2
      layout/base/nsCSSFrameConstructor.cpp
  35. 85
      layout/build/nsLayoutModule.cpp
  36. 9
      layout/build/nsLayoutStatics.cpp
  37. 6
      security/manager/pki/nsNSSDialogHelper.cpp
  38. 8
      tools/profiler/core/GeckoSampler.cpp
  39. 21
      tools/profiler/core/platform.cpp
  40. 5
      tools/profiler/core/platform.h
  41. 18
      tools/profiler/core/shared-libraries-linux.cc
  42. 2
      tools/profiler/gecko/SaveProfileTask.cpp
  43. 6
      tools/profiler/lul/AutoObjectMapper.cpp
  44. 4
      tools/profiler/lul/AutoObjectMapper.h
  45. 2
      tools/profiler/lul/platform-linux-lul.cpp
  46. 7
      tools/profiler/public/GeckoProfilerImpl.h
  47. 4
      xpcom/base/nsMemoryReporterManager.cpp
  48. 44
      xpcom/base/nsSystemInfo.cpp
  49. 5
      xpcom/build/BinaryPath.h
  50. 11
      xpcom/build/XPCOMInit.cpp
  51. 2
      xpcom/build/XREChildData.h
  52. 11
      xpcom/glue/FileUtils.h
  53. 5
      xpcom/threads/ThreadStackHelper.cpp

3
config/system-headers

@ -391,9 +391,6 @@ DiskInit.h
dlfcn.h
dlgs.h
dl.h
#ifdef MOZ_WIDGET_GONK
dns_sd.h
#endif
docobj.h
dos/dosextens.h
dos.h

3
dom/apps/AppsUtils.jsm

@ -312,9 +312,6 @@ this.AppsUtils = {
// Instead, we check if the app is installed under /system/b2g
let isCoreApp = false;
#ifdef MOZ_WIDGET_GONK
isCoreApp = app.basePath == this.getCoreAppsBasePath();
#endif
debug(app.basePath + " isCoreApp: " + isCoreApp);
return { "path": app.basePath + "/" + app.id,

32
dom/audiochannel/AudioChannelService.cpp

@ -27,11 +27,6 @@
#include "nsServiceManagerUtils.h"
#include "mozilla/dom/SettingChangeNotificationBinding.h"
#ifdef MOZ_WIDGET_GONK
#include "nsJSUtils.h"
#include "SpeakerManagerService.h"
#endif
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -237,20 +232,12 @@ AudioChannelService::Shutdown()
if (IsParentProcess()) {
obs->RemoveObserver(gAudioChannelService, "ipc:content-shutdown");
#ifdef MOZ_WIDGET_GONK
// To monitor the volume settings based on audio channel.
obs->RemoveObserver(gAudioChannelService, "mozsettings-changed");
#endif
}
}
gAudioChannelService->mWindows.Clear();
gAudioChannelService->mPlayingChildren.Clear();
gAudioChannelService->mTabParents.Clear();
#ifdef MOZ_WIDGET_GONK
gAudioChannelService->mSpeakerManager.Clear();
#endif
gAudioChannelService = nullptr;
}
@ -284,11 +271,6 @@ AudioChannelService::AudioChannelService()
obs->AddObserver(this, "outer-window-destroyed", false);
if (IsParentProcess()) {
obs->AddObserver(this, "ipc:content-shutdown", false);
#ifdef MOZ_WIDGET_GONK
// To monitor the volume settings based on audio channel.
obs->AddObserver(this, "mozsettings-changed", false);
#endif
}
}
@ -342,13 +324,6 @@ AudioChannelService::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent)
RefPtr<AudioChannelAgent> kungFuDeathGrip(aAgent);
winData->RemoveAgent(aAgent);
#ifdef MOZ_WIDGET_GONK
bool active = AnyAudioChannelIsActive();
for (uint32_t i = 0; i < mSpeakerManager.Length(); i++) {
mSpeakerManager[i]->SetAudioChannelActive(active);
}
#endif
MaybeSendStatusUpdate();
}
@ -573,13 +548,6 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic,
iter.GetNext()->WindowVolumeChanged();
}
}
#ifdef MOZ_WIDGET_GONK
bool active = AnyAudioChannelIsActive();
for (uint32_t i = 0; i < mSpeakerManager.Length(); i++) {
mSpeakerManager[i]->SetAudioChannelActive(active);
}
#endif
} else if (!strcmp(aTopic, "ipc:content-shutdown")) {
nsCOMPtr<nsIPropertyBag2> props = do_QueryInterface(aSubject);
if (!props) {

22
dom/audiochannel/AudioChannelService.h

@ -25,10 +25,6 @@ struct PRLogModuleInfo;
namespace mozilla {
namespace dom {
#ifdef MOZ_WIDGET_GONK
class SpeakerManagerService;
#endif
class TabParent;
#define NUMBER_OF_AUDIO_CHANNELS (uint32_t)AudioChannel::EndGuard_
@ -189,20 +185,6 @@ public:
uint64_t aInnerWindowID,
bool aCapture);
#ifdef MOZ_WIDGET_GONK
void RegisterSpeakerManager(SpeakerManagerService* aSpeakerManager)
{
if (!mSpeakerManager.Contains(aSpeakerManager)) {
mSpeakerManager.AppendElement(aSpeakerManager);
}
}
void UnregisterSpeakerManager(SpeakerManagerService* aSpeakerManager)
{
mSpeakerManager.RemoveElement(aSpeakerManager);
}
#endif
static const nsAttrValue::EnumTable* GetAudioChannelTable();
static AudioChannel GetAudioChannel(const nsAString& aString);
static AudioChannel GetDefaultAudioChannel();
@ -347,10 +329,6 @@ private:
nsTObserverArray<nsAutoPtr<AudioChannelChildStatus>> mPlayingChildren;
#ifdef MOZ_WIDGET_GONK
nsTArray<SpeakerManagerService*> mSpeakerManager;
#endif
// Raw pointers because TabParents must unregister themselves.
nsTArray<TabParent*> mTabParents;

6
dom/base/Navigator.cpp

@ -767,12 +767,6 @@ StaticRefPtr<VibrateWindowListener> gVibrateWindowListener;
static bool
MayVibrate(nsIDocument* doc) {
#if MOZ_WIDGET_GONK
if (XRE_IsParentProcess()) {
return true; // The system app can always vibrate
}
#endif // MOZ_WIDGET_GONK
// Hidden documents cannot start or stop a vibration.
return (doc && !doc->Hidden());
}

2
dom/base/ScreenOrientation.cpp

@ -309,7 +309,7 @@ ScreenOrientation::LockInternal(ScreenOrientationInternal aOrientation, ErrorRes
return nullptr;
}
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK)
#if !defined(MOZ_WIDGET_ANDROID)
// User agent does not support locking the screen orientation.
p->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
return p.forget();

3
dom/base/nsContentPermissionHelper.cpp

@ -5,9 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <map>
#ifdef MOZ_WIDGET_GONK
#include "GonkPermission.h"
#endif // MOZ_WIDGET_GONK
#include "nsCOMPtr.h"
#include "nsIDOMElement.h"
#include "nsIPrincipal.h"

10
dom/base/nsGlobalWindow.cpp

@ -25,7 +25,7 @@
#include "mozilla/dom/Timeout.h"
#include "mozilla/dom/TimeoutHandler.h"
#include "mozilla/IntegerPrintfMacros.h"
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
#include "mozilla/dom/WindowOrientationObserver.h"
#endif
#include "nsDOMOfflineResourceList.h"
@ -1948,7 +1948,7 @@ nsGlobalWindow::CleanUp()
mSpeechSynthesis = nullptr;
#endif
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
mOrientationChangeObserver = nullptr;
#endif
@ -2076,7 +2076,7 @@ nsGlobalWindow::FreeInnerObjects()
mScreen = nullptr;
}
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
mOrientationChangeObserver = nullptr;
#endif
@ -14009,7 +14009,7 @@ nsGlobalWindow::DisableDeviceSensor(uint32_t aType)
}
}
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
void
nsGlobalWindow::EnableOrientationChangeListener()
{
@ -14902,7 +14902,7 @@ nsGlobalWindow::IsModalContentWindow(JSContext* aCx, JSObject* aGlobal)
return xpc::WindowOrNull(aGlobal)->IsModalContentWindow();
}
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
int16_t
nsGlobalWindow::Orientation(CallerType aCallerType) const
{

8
dom/base/nsGlobalWindow.h

@ -138,7 +138,7 @@ class U2F;
class VRDisplay;
class VREventObserver;
class WakeLock;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
class WindowOrientationObserver;
#endif
class Worklet;
@ -631,7 +631,7 @@ public:
virtual void EnableDeviceSensor(uint32_t aType) override;
virtual void DisableDeviceSensor(uint32_t aType) override;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
virtual void EnableOrientationChangeListener() override;
virtual void DisableOrientationChangeListener() override;
#endif
@ -905,7 +905,7 @@ public:
nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
already_AddRefed<nsIDOMOfflineResourceList> GetApplicationCache() override;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
#endif
@ -1971,7 +1971,7 @@ protected:
nsTArray<uint32_t> mEnabledSensors;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
nsAutoPtr<mozilla::dom::WindowOrientationObserver> mOrientationChangeObserver;
#endif

2
dom/base/nsPIDOMWindow.h

@ -444,7 +444,7 @@ public:
*/
virtual void DisableDeviceSensor(uint32_t aType) = 0;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
virtual void EnableOrientationChangeListener() = 0;
virtual void DisableOrientationChangeListener() = 0;
#endif

4
dom/canvas/CanvasRenderingContext2D.cpp

@ -141,10 +141,6 @@ using mozilla::gl::GLContextProvider;
#include "gfxWindowsPlatform.h"
#endif
#ifdef MOZ_WIDGET_GONK
#include "mozilla/layers/ShadowLayers.h"
#endif
// windows.h (included by chromium code) defines this, in its infinite wisdom
#undef DrawText

28
dom/canvas/WebGLContext.cpp

@ -51,10 +51,6 @@
#include "VRManagerChild.h"
#include "mozilla/layers/TextureClientSharedSurface.h"
#ifdef MOZ_WIDGET_GONK
#include "mozilla/layers/ShadowLayers.h"
#endif
// Local
#include "CanvasUtils.h"
#include "WebGL1Context.h"
@ -545,30 +541,6 @@ BaseCaps(const WebGLContextOptions& options, WebGLContext* webgl)
// for now it's just behind a pref for testing/evaluation.
baseCaps.bpp16 = gfxPrefs::WebGLPrefer16bpp();
#ifdef MOZ_WIDGET_GONK
do {
auto canvasElement = webgl->GetCanvas();
if (!canvasElement)
break;
auto ownerDoc = canvasElement->OwnerDoc();
nsIWidget* docWidget = nsContentUtils::WidgetForDocument(ownerDoc);
if (!docWidget)
break;
layers::LayerManager* layerManager = docWidget->GetLayerManager();
if (!layerManager)
break;
// XXX we really want "AsSurfaceAllocator" here for generality
layers::ShadowLayerForwarder* forwarder = layerManager->AsShadowForwarder();
if (!forwarder)
break;
baseCaps.surfaceAllocator = forwarder->GetTextureForwarder();
} while (false);
#endif
// Done with baseCaps construction.
if (!gfxPrefs::WebGLForceMSAA()) {

8
dom/events/EventListenerManager.cpp

@ -352,7 +352,7 @@ EventListenerManager::AddEventListenerInternal(
EnableDevice(eDeviceLight);
} else if (aTypeAtom == nsGkAtoms::ondevicemotion) {
EnableDevice(eDeviceMotion);
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
} else if (aTypeAtom == nsGkAtoms::onorientationchange) {
EnableDevice(eOrientationChange);
#endif
@ -481,7 +481,7 @@ EventListenerManager::IsDeviceType(EventMessage aEventMessage)
case eDeviceLight:
case eDeviceProximity:
case eUserProximity:
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
case eOrientationChange:
#endif
return true;
@ -529,7 +529,7 @@ EventListenerManager::EnableDevice(EventMessage aEventMessage)
window->EnableDeviceSensor(SENSOR_LINEAR_ACCELERATION);
window->EnableDeviceSensor(SENSOR_GYROSCOPE);
break;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
case eOrientationChange:
window->EnableOrientationChangeListener();
break;
@ -575,7 +575,7 @@ EventListenerManager::DisableDevice(EventMessage aEventMessage)
case eDeviceLight:
window->DisableDeviceSensor(SENSOR_LIGHT);
break;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
case eOrientationChange:
window->DisableOrientationChangeListener();
break;

2
dom/events/EventNameList.h

@ -563,7 +563,7 @@ WINDOW_EVENT(online,
eOnline,
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
eBasicEventClass)
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
WINDOW_EVENT(orientationchange,
eOrientationChange,
EventNameType_HTMLBodyOrFramesetOnly,

13
dom/geolocation/nsGeolocation.cpp

@ -33,10 +33,6 @@ class nsIPrincipal;
#include "AndroidLocationProvider.h"
#endif
#ifdef MOZ_WIDGET_GONK
#include "GonkGPSGeolocationProvider.h"
#endif
#ifdef MOZ_GPSD
#include "GpsdLocationProvider.h"
#endif
@ -688,15 +684,6 @@ nsresult nsGeolocationService::Init()
mProvider = new AndroidLocationProvider();
#endif
#ifdef MOZ_WIDGET_GONK
// GonkGPSGeolocationProvider can be started at boot up time for initialization reasons.
// do_getService gets hold of the already initialized component and starts
// processing location requests immediately.
// do_Createinstance will create multiple instances of the provider which is not right.
// bug 993041
mProvider = do_GetService(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID);
#endif
#ifdef MOZ_WIDGET_GTK
#ifdef MOZ_GPSD
if (Preferences::GetBool("geo.provider.use_gpsd", false)) {

4
dom/html/nsIFormControl.h

@ -267,8 +267,8 @@ nsIFormControl::IsSingleLineTextControl(bool aExcludePassword, uint32_t aType)
aType == NS_FORM_INPUT_TEL ||
aType == NS_FORM_INPUT_URL ||
// TODO: those are temporary until bug 773205 is fixed.
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
// On Android/B2G, date/time input appears as a normal text box.
#if defined(MOZ_WIDGET_ANDROID)
// On Android, date/time input appears as a normal text box.
aType == NS_FORM_INPUT_TIME ||
aType == NS_FORM_INPUT_DATE ||
#endif

2
dom/indexedDB/ActorsParent.cpp

@ -121,7 +121,7 @@
LogLevel::Debug, \
_args )
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
#define IDB_MOBILE
#endif

52
dom/ipc/ContentChild.cpp

@ -137,12 +137,6 @@
#include "APKOpen.h"
#endif
#if defined(MOZ_WIDGET_GONK)
#include "nsVolume.h"
#include "nsVolumeService.h"
#include "SpeakerManagerService.h"
#endif
#ifdef XP_WIN
#include <process.h>
#define getpid _getpid
@ -196,9 +190,6 @@ using namespace mozilla::net;
using namespace mozilla::jsipc;
using namespace mozilla::psm;
using namespace mozilla::widget;
#if defined(MOZ_WIDGET_GONK)
using namespace mozilla::system;
#endif
using namespace mozilla::widget;
namespace mozilla {
@ -585,15 +576,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
void
ContentChild::InitProcessAttributes()
{
#ifdef MOZ_WIDGET_GONK
if (mIsForApp && !mIsForBrowser) {
SetProcessName(NS_LITERAL_STRING("(Preallocated app)"), false);
} else {
SetProcessName(NS_LITERAL_STRING("Browser"), false);
}
#else
SetProcessName(NS_LITERAL_STRING("Web Content"), true);
#endif
}
void
@ -1257,15 +1240,6 @@ ContentChild::RecvNotifyLayerAllocated(const dom::TabId& aTabId, const uint64_t&
bool
ContentChild::RecvSpeakerManagerNotify()
{
#ifdef MOZ_WIDGET_GONK
// Only notify the process which has the SpeakerManager instance.
RefPtr<SpeakerManagerService> service =
SpeakerManagerService::GetSpeakerManagerService();
if (service) {
service->Notify();
}
return true;
#endif
return false;
}
@ -2284,12 +2258,6 @@ ContentChild::RecvLastPrivateDocShellDestroyed()
bool
ContentChild::RecvVolumes(nsTArray<VolumeInfo>&& aVolumes)
{
#ifdef MOZ_WIDGET_GONK
RefPtr<nsVolumeService> vs = nsVolumeService::GetSingleton();
if (vs) {
vs->RecvVolumesFromParent(aVolumes);
}
#endif
return true;
}
@ -2306,17 +2274,6 @@ ContentChild::RecvFileSystemUpdate(const nsString& aFsName,
const bool& aIsRemovable,
const bool& aIsHotSwappable)
{
#ifdef MOZ_WIDGET_GONK
RefPtr<nsVolume> volume = new nsVolume(aFsName, aVolumeName, aState,
aMountGeneration, aIsMediaPresent,
aIsSharing, aIsFormatting, aIsFake,
aIsUnmounting, aIsRemovable, aIsHotSwappable);
RefPtr<nsVolumeService> vs = nsVolumeService::GetSingleton();
if (vs) {
vs->UpdateVolume(volume);
}
#else
// Remove warnings about unused arguments
Unused << aFsName;
Unused << aVolumeName;
@ -2329,22 +2286,15 @@ ContentChild::RecvFileSystemUpdate(const nsString& aFsName,
Unused << aIsUnmounting;
Unused << aIsRemovable;
Unused << aIsHotSwappable;
#endif
return true;
}
bool
ContentChild::RecvVolumeRemoved(const nsString& aFsName)
{
#ifdef MOZ_WIDGET_GONK
RefPtr<nsVolumeService> vs = nsVolumeService::GetSingleton();
if (vs) {
vs->RemoveVolumeByName(aFsName);
}
#else
// Remove warnings about unused arguments
Unused << aFsName;
#endif
return true;
}

137
dom/ipc/ContentParent.cpp

@ -16,11 +16,6 @@
# include <sys/resource.h>
#endif
#ifdef MOZ_WIDGET_GONK
#include <sys/types.h>
#include <sys/wait.h>
#endif
#include "chrome/common/process_watcher.h"
#include "mozilla/a11y/PDocAccessible.h"
@ -210,14 +205,6 @@
# include "AndroidBridge.h"
#endif
#ifdef MOZ_WIDGET_GONK
#include "nsIVolume.h"
#include "nsVolumeService.h"
#include "nsIVolumeService.h"
#include "SpeakerManagerService.h"
using namespace mozilla::system;
#endif
#ifdef MOZ_WIDGET_GTK
#include <gdk/gdk.h>
#endif
@ -526,11 +513,6 @@ static const char* sObserverTopics[] = {
"child-mmu-request",
"last-pb-context-exited",
"file-watcher-update",
#ifdef MOZ_WIDGET_GONK
NS_VOLUME_STATE_CHANGED,
NS_VOLUME_REMOVED,
"phone-state-changed",
#endif
#ifdef ACCESSIBILITY
"a11y-init-or-shutdown",
#endif
@ -1355,14 +1337,6 @@ ContentParent::ForwardKnownInfo()
if (!mMetamorphosed) {
return;
}
#ifdef MOZ_WIDGET_GONK
InfallibleTArray<VolumeInfo> volumeInfo;
RefPtr<nsVolumeService> vs = nsVolumeService::GetSingleton();
if (vs) {
vs->GetVolumesForIPC(&volumeInfo);
Unused << SendVolumes(volumeInfo);
}
#endif /* MOZ_WIDGET_GONK */
}
namespace {
@ -1410,23 +1384,6 @@ bool
ContentParent::SetPriorityAndCheckIsAlive(ProcessPriority aPriority)
{
ProcessPriorityManager::SetProcessPriority(this, aPriority);
// Now that we've set this process's priority, check whether the process is
// still alive. Hopefully we've set the priority to FOREGROUND*, so the
// process won't unexpectedly crash after this point!
//
// Bug 943174: use waitid() with WNOWAIT so that, if the process
// did exit, we won't consume its zombie and confuse the
// GeckoChildProcessHost dtor.
#ifdef MOZ_WIDGET_GONK
siginfo_t info;
info.si_pid = 0;
if (waitid(P_PID, Pid(), &info, WNOWAIT | WNOHANG | WEXITED) == 0
&& info.si_pid != 0) {
return false;
}
#endif
return true;
}
@ -2686,50 +2643,6 @@ ContentParent::Observe(nsISupports* aSubject,
else if (!strcmp(aTopic, "last-pb-context-exited")) {
Unused << SendLastPrivateDocShellDestroyed();
}
#ifdef MOZ_WIDGET_GONK
else if(!strcmp(aTopic, NS_VOLUME_STATE_CHANGED)) {
nsCOMPtr<nsIVolume> vol = do_QueryInterface(aSubject);
if (!vol) {
return NS_ERROR_NOT_AVAILABLE;
}
nsString volName;
nsString mountPoint;
int32_t state;
int32_t mountGeneration;
bool isMediaPresent;
bool isSharing;
bool isFormatting;
bool isFake;
bool isUnmounting;
bool isRemovable;
bool isHotSwappable;
vol->GetName(volName);
vol->GetMountPoint(mountPoint);
vol->GetState(&state);
vol->GetMountGeneration(&mountGeneration);
vol->GetIsMediaPresent(&isMediaPresent);
vol->GetIsSharing(&isSharing);
vol->GetIsFormatting(&isFormatting);
vol->GetIsFake(&isFake);
vol->GetIsUnmounting(&isUnmounting);
vol->GetIsRemovable(&isRemovable);
vol->GetIsHotSwappable(&isHotSwappable);
Unused << SendFileSystemUpdate(volName, mountPoint, state,
mountGeneration, isMediaPresent,
isSharing, isFormatting, isFake,
isUnmounting, isRemovable, isHotSwappable);
} else if (!strcmp(aTopic, "phone-state-changed")) {
nsString state(aData);
Unused << SendNotifyPhoneStateChange(state);
}
else if(!strcmp(aTopic, NS_VOLUME_REMOVED)) {
nsString volName(aData);
Unused << SendVolumeRemoved(volName);
}
#endif
#ifdef ACCESSIBILITY
else if (aData && !strcmp(aTopic, "a11y-init-or-shutdown")) {
if (*aData == '1') {
@ -3398,29 +3311,12 @@ ContentParent::RecvPSpeechSynthesisConstructor(PSpeechSynthesisParent* aActor)
bool
ContentParent::RecvSpeakerManagerGetSpeakerStatus(bool* aValue)
{
#ifdef MOZ_WIDGET_GONK
*aValue = false;
RefPtr<SpeakerManagerService> service =
SpeakerManagerService::GetOrCreateSpeakerManagerService();
MOZ_ASSERT(service);
*aValue = service->GetSpeakerStatus();
return true;
#endif
return false;
}
bool
ContentParent::RecvSpeakerManagerForceSpeaker(const bool& aEnable)
{
#ifdef MOZ_WIDGET_GONK
RefPtr<SpeakerManagerService> service =
SpeakerManagerService::GetOrCreateSpeakerManagerService();
MOZ_ASSERT(service);
service->ForceSpeaker(aEnable, mChildID);
return true;
#endif
return false;
}
@ -3976,49 +3872,22 @@ bool
ContentParent::RecvCreateFakeVolume(const nsString& fsName,
const nsString& mountPoint)
{
#ifdef MOZ_WIDGET_GONK
nsresult rv;
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv);
if (vs) {
vs->CreateFakeVolume(fsName, mountPoint);
}
return true;
#else
NS_WARNING("ContentParent::RecvCreateFakeVolume shouldn't be called when MOZ_WIDGET_GONK is not defined");
NS_WARNING("ContentParent::RecvCreateFakeVolume shouldn't be called");
return false;
#endif
}
bool
ContentParent::RecvSetFakeVolumeState(const nsString& fsName, const int32_t& fsState)
{
#ifdef MOZ_WIDGET_GONK
nsresult rv;
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv);
if (vs) {
vs->SetFakeVolumeState(fsName, fsState);
}
return true;
#else
NS_WARNING("ContentParent::RecvSetFakeVolumeState shouldn't be called when MOZ_WIDGET_GONK is not defined");
NS_WARNING("ContentParent::RecvSetFakeVolumeState shouldn't be called");
return false;
#endif
}
bool
ContentParent::RecvRemoveFakeVolume(const nsString& fsName)
{
#ifdef MOZ_WIDGET_GONK
nsresult rv;
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv);
if (vs) {
vs->RemoveFakeVolume(fsName);
}
return true;
#else
NS_WARNING("ContentParent::RecvRemoveFakeVolume shouldn't be called when MOZ_WIDGET_GONK is not defined");
NS_WARNING("ContentParent::RecvRemoveFakeVolume shouldn't be called");
return false;
#endif
}
bool

72
dom/network/TCPSocket.cpp

@ -33,11 +33,6 @@
#include "nsStringStream.h"
#include "secerr.h"
#include "sslerr.h"
#ifdef MOZ_WIDGET_GONK
#include "nsINetworkStatsServiceProxy.h"
#include "nsINetworkManager.h"
#include "nsINetworkInterface.h"
#endif
#define BUFFER_SIZE 65536
#define NETWORK_STATS_THRESHOLD 65536
@ -163,12 +158,6 @@ TCPSocket::TCPSocket(nsIGlobalObject* aGlobal, const nsAString& aHost, uint16_t
, mTrackingNumber(0)
, mWaitingForStartTLS(false)
, mObserversActive(false)
#ifdef MOZ_WIDGET_GONK
, mTxBytes(0)
, mRxBytes(0)
, mAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID)
, mInIsolatedMozBrowser(false)
#endif
{
if (aGlobal) {
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
@ -323,13 +312,6 @@ TCPSocket::InitWithTransport(nsISocketTransport* aTransport)
mTransport->GetPort(&port);
mPort = port;
#ifdef MOZ_WIDGET_GONK
nsCOMPtr<nsINetworkManager> networkManager = do_GetService("@mozilla.org/network/manager;1");
if (networkManager) {
networkManager->GetActiveNetworkInfo(getter_AddRefs(mActiveNetworkInfo));
}
#endif
return NS_OK;
}
@ -651,12 +633,6 @@ TCPSocket::Resume(mozilla::ErrorResult& aRv)
nsresult
TCPSocket::MaybeReportErrorAndCloseIfOpen(nsresult status) {
#ifdef MOZ_WIDGET_GONK
// Save network statistics once the connection is closed.
// For now this function is Gonk-specific.
SaveNetworkStats(true);
#endif
// If we're closed, we've already reported the error or just don't need to
// report the error.
if (mReadyState == TCPReadyState::Closed) {
@ -941,12 +917,6 @@ TCPSocket::Send(nsIInputStream* aStream, uint32_t aByteLength)
EnsureCopying();
#ifdef MOZ_WIDGET_GONK
// Collect transmitted amount for network statistics.
mTxBytes += aByteLength;
SaveNetworkStats(false);
#endif
return !bufferFull;
}
@ -1069,12 +1039,6 @@ NS_IMETHODIMP
TCPSocket::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext, nsIInputStream* aStream,
uint64_t aOffset, uint32_t aCount)
{
#ifdef MOZ_WIDGET_GONK
// Collect received amount for network statistics.
mRxBytes += aCount;
SaveNetworkStats(false);
#endif
if (mUseArrayBuffers) {
nsTArray<uint8_t> buffer;
buffer.SetCapacity(aCount);
@ -1160,10 +1124,7 @@ TCPSocket::SetSocketBridgeParent(TCPSocketParent* aBridgeParent)
void
TCPSocket::SetAppIdAndBrowser(uint32_t aAppId, bool aInIsolatedMozBrowser)
{
#ifdef MOZ_WIDGET_GONK
mAppId = aAppId;
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
#endif
/*** STUB ***/
}
NS_IMETHODIMP
@ -1190,37 +1151,6 @@ TCPSocket::UpdateBufferedAmount(uint32_t aBufferedAmount, uint32_t aTrackingNumb
return NS_OK;
}
#ifdef MOZ_WIDGET_GONK
void
TCPSocket::SaveNetworkStats(bool aEnforce)
{
if (!mTxBytes && !mRxBytes) {
// There is no traffic at all. No need to save statistics.
return;
}
// If "enforce" is false, the traffic amount is saved to NetworkStatsServiceProxy
// only when the total amount exceeds the predefined threshold value.
// The purpose is to avoid too much overhead for collecting statistics.
uint32_t totalBytes = mTxBytes + mRxBytes;
if (!aEnforce && totalBytes < NETWORK_STATS_THRESHOLD) {
return;
}
nsCOMPtr<nsINetworkStatsServiceProxy> nssProxy =
do_GetService("@mozilla.org/networkstatsServiceProxy;1");
if (!nssProxy) {
return;
}
nssProxy->SaveAppStats(mAppId, mInIsolatedMozBrowser, mActiveNetworkInfo,
PR_Now(), mRxBytes, mTxBytes, false, nullptr);
// Reset the counters once the statistics is saved to NetworkStatsServiceProxy.
mTxBytes = mRxBytes = 0;
}
#endif
NS_IMETHODIMP
TCPSocket::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
{

17
dom/network/TCPSocket.h

@ -179,10 +179,6 @@ private:
void ActivateTLS();
// Dispatch an error event if necessary, then dispatch a "close" event.
nsresult MaybeReportErrorAndCloseIfOpen(nsresult status);
#ifdef MOZ_WIDGET_GONK
// Store and reset any saved network stats for this socket.
void SaveNetworkStats(bool aEnforce);
#endif
// Helper for FireDataStringEvent/FireDataArrayEvent.
nsresult FireDataEvent(JSContext* aCx, const nsAString& aType,
@ -246,19 +242,6 @@ private:
nsTArray<nsCOMPtr<nsIInputStream>> mPendingDataWhileCopierActive;
bool mObserversActive;
#ifdef MOZ_WIDGET_GONK
// Number of bytes sent.
uint32_t mTxBytes;
// Number of bytes received.
uint32_t mRxBytes;
// The app that owns this socket.
uint32_t mAppId;
// Was this socket created inside of an isolated browser frame?
bool mInIsolatedMozBrowser;
// The name of the active network used by this socket.
nsCOMPtr<nsINetworkInfo> mActiveNetworkInfo;
#endif
};
} // namespace dom

6
dom/plugins/base/PluginPRLibrary.cpp

@ -57,12 +57,6 @@ PluginPRLibrary::NP_Initialize(NPNetscapeFuncs* bFuncs,
mNPP_GetSitesWithData = pFuncs->getsiteswithdata;
return NS_OK;
}
#elif defined(MOZ_WIDGET_GONK)
nsresult
PluginPRLibrary::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
{
return NS_OK;
}
#elif defined(XP_UNIX) && !defined(XP_MACOSX)
nsresult
PluginPRLibrary::NP_Initialize(NPNetscapeFuncs* bFuncs,

2
dom/plugins/base/PluginPRLibrary.h

@ -81,7 +81,7 @@ public:
return true;
}
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
#if defined(XP_UNIX) && !defined(XP_MACOSX)
virtual nsresult NP_Initialize(NPNetscapeFuncs* aNetscapeFuncs,
NPPluginFuncs* aFuncs, NPError* aError) override;
#else

1
dom/plugins/base/nsNPAPIPlugin.cpp

@ -320,7 +320,6 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
return NS_ERROR_FAILURE;
}
#elif defined(MOZ_WIDGET_GONK)
#else
NPError pluginCallError;
nsresult rv = pluginLib->NP_Initialize(&sBrowserFuncs, &plugin->mPluginFuncs, &pluginCallError);

2
dom/plugins/ipc/PluginLibrary.h

@ -57,7 +57,7 @@ public:
virtual bool HasRequiredFunctions() = 0;
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
#if defined(XP_UNIX) && !defined(XP_MACOSX)
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) = 0;
#else
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) = 0;

4
dom/plugins/ipc/PluginModuleParent.cpp

@ -529,7 +529,7 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
if (NS_SUCCEEDED(mAsyncInitRv))
#endif
{
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
#if defined(XP_UNIX) && !defined(XP_MACOSX)
mAsyncInitRv = NP_Initialize(mNPNIface,
mNPPIface,
&mAsyncInitError);
@ -1745,7 +1745,7 @@ PluginModuleChromeParent::CachedSettingChanged(const char* aPref, void* aModule)
module->CachedSettingChanged();
}
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
#if defined(XP_UNIX) && !defined(XP_MACOSX)
nsresult
PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error)
{

4
dom/plugins/ipc/PluginModuleParent.h

@ -267,7 +267,7 @@ protected:
const mozilla::NativeEventData& aNativeKeyData,
bool aIsConsumed) override;
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
#if defined(XP_UNIX) && !defined(XP_MACOSX)
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) override;
#else
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) override;
@ -517,7 +517,7 @@ private:
PluginProcessParent* Process() const { return mSubprocess; }
base::ProcessHandle ChildProcessHandle() { return mSubprocess->GetChildProcessHandle(); }
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
#if defined(XP_UNIX) && !defined(XP_MACOSX)
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) override;
#else
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) override;

49
dom/presentation/PresentationSessionInfo.cpp

@ -31,11 +31,6 @@
#include "nsIPresentationNetworkHelper.h"
#endif // MOZ_WIDGET_ANDROID
#ifdef MOZ_WIDGET_GONK
#include "nsINetworkInterface.h"
#include "nsINetworkManager.h"
#endif
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::services;
@ -647,49 +642,7 @@ PresentationControllingInfo::Shutdown(nsresult aReason)
nsresult
PresentationControllingInfo::GetAddress()
{
#if defined(MOZ_WIDGET_GONK)
nsCOMPtr<nsINetworkManager> networkManager =
do_GetService("@mozilla.org/network/manager;1");
if (NS_WARN_IF(!networkManager)) {
return NS_ERROR_NOT_AVAILABLE;
}
nsCOMPtr<nsINetworkInfo> activeNetworkInfo;
networkManager->GetActiveNetworkInfo(getter_AddRefs(activeNetworkInfo));
if (NS_WARN_IF(!activeNetworkInfo)) {
return NS_ERROR_FAILURE;
}
char16_t** ips = nullptr;
uint32_t* prefixes = nullptr;
uint32_t count = 0;
activeNetworkInfo->GetAddresses(&ips, &prefixes, &count);
if (NS_WARN_IF(!count)) {
NS_Free(prefixes);
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, ips);
return NS_ERROR_FAILURE;
}
// TODO bug 1228504 Take all IP addresses in PresentationChannelDescription
// into account. And at the first stage Presentation API is only exposed on
// Firefox OS where the first IP appears enough for most scenarios.
nsAutoString ip;
ip.Assign(ips[0]);
// On Android platform, the IP address is retrieved from a callback function.
// To make consistent code sequence, following function call is dispatched
// into main thread instead of calling it directly.
NS_DispatchToMainThread(
NewRunnableMethod<nsCString>(
this,
&PresentationControllingInfo::OnGetAddress,
NS_ConvertUTF16toUTF8(ip)));
NS_Free(prefixes);
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, ips);
#elif defined(MOZ_WIDGET_ANDROID)
#if defined(MOZ_WIDGET_ANDROID)
RefPtr<PresentationNetworkHelper> networkHelper =
new PresentationNetworkHelper(this,
&PresentationControllingInfo::OnGetAddress);

5
dom/presentation/provider/PresentationDeviceProviderModule.cpp

@ -68,12 +68,9 @@ static const mozilla::Module::ContractIDEntry kPresentationDeviceProviderContrac
};
static const mozilla::Module::CategoryEntry kPresentationDeviceProviderCategories[] = {
#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID) || (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16)
#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID)
{ PRESENTATION_DEVICE_PROVIDER_CATEGORY, "MulticastDNSDeviceProvider", MULTICAST_DNS_PROVIDER_CONTRACT_ID },
#endif
#if defined(MOZ_WIDGET_GONK)
{ PRESENTATION_DEVICE_PROVIDER_CATEGORY, "DisplayDeviceProvider", DISPLAY_DEVICE_PROVIDER_CONTRACT_ID },
#endif
#ifdef MOZ_WIDGET_ANDROID
{ PRESENTATION_DEVICE_PROVIDER_CATEGORY, "LegacyMDNSDeviceProvider", LEGACY_MDNS_PROVIDER_CONTRACT_ID },
#endif //MOZ_WIDGET_ANDROID

11
dom/system/OSFileConstants.cpp

@ -924,16 +924,6 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle<JSObject*> global)
return false;
}
#if defined(MOZ_WIDGET_GONK)
JSString* strVersion = JS_NewStringCopyZ(cx, "Gonk");
if (!strVersion){
return false;
}
JS::Rooted<JS::Value> valVersion(cx, JS::StringValue(strVersion));
if (!JS_SetProperty(cx, objSys, "Name", valVersion)) {
return false;
}
#else
nsCOMPtr<nsIXULRuntime> runtime = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
if (runtime) {
nsAutoCString os;
@ -950,7 +940,6 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle<JSObject*> global)
return false;
}
}
#endif // defined(MOZ_WIDGET_GONK)
#if defined(DEBUG)
JS::Rooted<JS::Value> valDebug(cx, JS::TrueValue());

2
dom/webidl/Window.webidl

@ -379,7 +379,7 @@ Window implements TouchEventHandlers;
Window implements OnErrorEventHandlerForWindow;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#if defined(MOZ_WIDGET_ANDROID)
// https://compat.spec.whatwg.org/#windoworientation-interface
partial interface Window {
[NeedsCallerType]

6
hal/Hal.cpp

@ -89,8 +89,6 @@ AssertMainProcess()
MOZ_ASSERT(GeckoProcessType_Default == XRE_GetProcessType());
}
#if !defined(MOZ_WIDGET_GONK)
bool
WindowIsActive(nsPIDOMWindowInner* aWindow)
{
@ -100,8 +98,6 @@ WindowIsActive(nsPIDOMWindowInner* aWindow)
return !document->Hidden();
}
#endif // !defined(MOZ_WIDGET_GONK)
StaticAutoPtr<WindowIdentifier::IDArrayType> gLastIDToVibrate;
void InitLastIDToVibrate()
@ -123,7 +119,6 @@ Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id)
{
AssertMainThread();
#if !defined(MOZ_WIDGET_GONK)
// Only active windows may start vibrations. If |id| hasn't gone
// through the IPC layer -- that is, if our caller is the outside
// world, not hal_proxy -- check whether the window is active. If
@ -134,7 +129,6 @@ Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id)
HAL_LOG("Vibrate: Window is inactive, dropping vibrate.");
return;
}
#endif // !defined(MOZ_WIDGET_GONK)
if (!InSandbox()) {
if (!gLastIDToVibrate) {

31
hal/linux/LinuxPower.cpp

@ -12,28 +12,9 @@
#include "mozilla/Services.h"
#include "MainThreadUtils.h"
#if defined(MOZ_WIDGET_GONK)
#include "cutils/android_reboot.h"
#include "cutils/properties.h"
#endif
namespace mozilla {
namespace hal_impl {
#if (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 19)
static void
PowerCtl(const char* aValue, int aCmd)
{
// this invokes init's powerctl builtin via /init.rc
property_set("sys.powerctl", aValue);
// device should reboot in few moments, but if it doesn't - call
// android_reboot() to make sure that init isn't stuck somewhere
sleep(10);
HAL_LOG("Powerctl call takes too long, forcing %s.", aValue);
android_reboot(aCmd, 0, nullptr);
}
#endif