Back out revisions 042d50591265:69f4af72765c (bug 909645) due to Windows bustage causing a CLOSED TREE.

This commit is contained in:
Boris Zbarsky 2013-08-28 01:46:00 -04:00
Родитель 05087a4653
Коммит 169d28c38a
19 изменённых файлов: 151 добавлений и 173 удалений

Просмотреть файл

@ -10,16 +10,12 @@
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/SpeechRecognitionBinding.h"
#include "mozilla/MediaManager.h"
#include "mozilla/Services.h"
#include "AudioSegment.h"
#include "endpointer.h"
#include "GeneratedEvents.h"
#include "nsIDOMSpeechRecognitionEvent.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include <algorithm>
@ -628,7 +624,8 @@ SpeechRecognition::GetGrammars(ErrorResult& aRv) const
}
void
SpeechRecognition::SetGrammars(SpeechGrammarList& aArg, ErrorResult& aRv)
SpeechRecognition::SetGrammars(mozilla::dom::SpeechGrammarList& aArg,
ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return;

Просмотреть файл

@ -13,8 +13,7 @@
#include "nsWrapperCache.h"
#include "nsTArray.h"
#include "nsIDOMNavigatorUserMedia.h"
#include "nsITimer.h"
#include "MediaManager.h"
#include "MediaEngine.h"
#include "MediaStreamGraph.h"
#include "AudioSegment.h"

Просмотреть файл

@ -12,8 +12,6 @@
#include "SpeechRecognitionAlternative.h"
#include "SpeechRecognitionResult.h"
#include "SpeechRecognitionResultList.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
namespace mozilla {

Просмотреть файл

@ -31,7 +31,6 @@
#include "nsDOMWindowList.h"
#include "nsIDOMWakeLock.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIPermissionManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptTimeoutHandler.h"

Просмотреть файл

@ -15,7 +15,6 @@
#include "nsIDocument.h"
#include "nsISupportsPrimitives.h"
#include "nsIInterfaceRequestorUtils.h"
#include "mozilla/dom/ContentChild.h"
// For PR_snprintf
#include "prprf.h"
@ -1294,7 +1293,7 @@ MediaManager::RemoveFromWindowList(uint64_t aWindowID,
nsAutoString data;
data.Append(NS_ConvertUTF8toUTF16(windowBuffer));
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
obs->NotifyObservers(nullptr, "recording-window-ended", data.get());
LOG(("Sent recording-window-ended for window %llu (outer %llu)",
aWindowID, outerID));
@ -1333,7 +1332,7 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData)
{
NS_ASSERTION(NS_IsMainThread(), "Observer invoked off the main thread");
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
nsCOMPtr<nsIPrefBranch> branch( do_QueryInterface(aSubject) );
@ -1603,43 +1602,4 @@ GetUserMediaCallbackMediaStreamListener::NotifyRemoved(MediaStreamGraph* aGraph)
}
}
NS_IMETHODIMP
GetUserMediaNotificationEvent::Run()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
// Make sure mStream is cleared and our reference to the DOMMediaStream
// is dropped on the main thread, no matter what happens in this method.
// Otherwise this object might be destroyed off the main thread,
// releasing DOMMediaStream off the main thread, which is not allowed.
nsRefPtr<DOMMediaStream> stream = mStream.forget();
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (!obs) {
NS_WARNING("Could not get the Observer service for GetUserMedia recording notification.");
return NS_ERROR_FAILURE;
}
nsString msg;
switch (mStatus) {
case STARTING:
msg = NS_LITERAL_STRING("starting");
stream->OnTracksAvailable(mOnTracksAvailableCallback.forget());
break;
case STOPPING:
msg = NS_LITERAL_STRING("shutdown");
if (mListener) {
mListener->SetStopped();
}
break;
}
obs->NotifyObservers(nullptr,
"recording-device-events",
msg.get());
// Forward recording events to parent process.
// The events are gathered in chrome process and used for recording indicator
if (XRE_GetProcessType() != GeckoProcessType_Default) {
unused << dom::ContentChild::GetSingleton()->SendRecordingDeviceEvents(msg);
}
return NS_OK;
}
} // namespace mozilla

Просмотреть файл

@ -3,6 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaEngine.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/Services.h"
#include "mozilla/unused.h"
#include "nsIMediaManager.h"
@ -211,7 +212,44 @@ class GetUserMediaNotificationEvent: public nsRunnable
}
NS_IMETHOD Run() MOZ_OVERRIDE;
NS_IMETHOD
Run() MOZ_OVERRIDE
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
// Make sure mStream is cleared and our reference to the DOMMediaStream
// is dropped on the main thread, no matter what happens in this method.
// Otherwise this object might be destroyed off the main thread,
// releasing DOMMediaStream off the main thread, which is not allowed.
nsRefPtr<DOMMediaStream> stream = mStream.forget();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs) {
NS_WARNING("Could not get the Observer service for GetUserMedia recording notification.");
return NS_ERROR_FAILURE;
}
nsString msg;
switch (mStatus) {
case STARTING:
msg = NS_LITERAL_STRING("starting");
stream->OnTracksAvailable(mOnTracksAvailableCallback.forget());
break;
case STOPPING:
msg = NS_LITERAL_STRING("shutdown");
if (mListener) {
mListener->SetStopped();
}
break;
}
obs->NotifyObservers(nullptr,
"recording-device-events",
msg.get());
// Forward recording events to parent process.
// The events are gathered in chrome process and used for recording indicator
if (XRE_GetProcessType() != GeckoProcessType_Default) {
unused << mozilla::dom::ContentChild::GetSingleton()->SendRecordingDeviceEvents(msg);
}
return NS_OK;
}
protected:
nsRefPtr<GetUserMediaCallbackMediaStreamListener> mListener; // threadsafe

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsIDOMWakeLockListener.h"
#include "nsIDOMWindow.h"
#include "nsWeakReference.h"
#include "nsCycleCollectionParticipant.h"
class nsPIDOMWindow;

Просмотреть файл

@ -23,7 +23,6 @@
#include "mozilla/unused.h"
#include "mozilla/Preferences.h"
#include "mozilla/ClearOnShutdown.h"
#include "PCOMContentPermissionRequestChild.h"
class nsIPrincipal;
@ -58,59 +57,11 @@ using mozilla::unused; // <snicker>
using namespace mozilla;
using namespace mozilla::dom;
class nsGeolocationRequest
: public nsIContentPermissionRequest
, public nsITimerCallback
, public nsIGeolocationUpdate
, public PCOMContentPermissionRequestChild
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
NS_DECL_NSITIMERCALLBACK
NS_DECL_NSIGEOLOCATIONUPDATE
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsGeolocationRequest, nsIContentPermissionRequest)
nsGeolocationRequest(Geolocation* aLocator,
const GeoPositionCallback& aCallback,
const GeoPositionErrorCallback& aErrorCallback,
idl::GeoPositionOptions* aOptions,
bool aWatchPositionRequest = false,
int32_t aWatchId = 0);
void Shutdown();
void SendLocation(nsIDOMGeoPosition* location);
bool WantsHighAccuracy() {return mOptions && mOptions->enableHighAccuracy;}
void SetTimeoutTimer();
nsIPrincipal* GetPrincipal();
~nsGeolocationRequest();
virtual bool Recv__delete__(const bool& allow) MOZ_OVERRIDE;
virtual void IPDLRelease() MOZ_OVERRIDE { Release(); }
bool IsWatch() { return mIsWatchPositionRequest; }
int32_t WatchId() { return mWatchId; }
private:
bool mIsWatchPositionRequest;
nsCOMPtr<nsITimer> mTimeoutTimer;
GeoPositionCallback mCallback;
GeoPositionErrorCallback mErrorCallback;
nsAutoPtr<idl::GeoPositionOptions> mOptions;
nsRefPtr<Geolocation> mLocator;
int32_t mWatchId;
bool mShutdown;
};
static idl::GeoPositionOptions*
static mozilla::idl::GeoPositionOptions*
GeoPositionOptionsFromPositionOptions(const PositionOptions& aOptions)
{
nsAutoPtr<idl::GeoPositionOptions> geoOptions(
new idl::GeoPositionOptions());
nsAutoPtr<mozilla::idl::GeoPositionOptions> geoOptions(
new mozilla::idl::GeoPositionOptions());
geoOptions->enableHighAccuracy = aOptions.mEnableHighAccuracy;
geoOptions->maximumAge = aOptions.mMaximumAge;
@ -340,7 +291,7 @@ PositionError::NotifyCallback(const GeoPositionErrorCallback& aCallback)
nsGeolocationRequest::nsGeolocationRequest(Geolocation* aLocator,
const GeoPositionCallback& aCallback,
const GeoPositionErrorCallback& aErrorCallback,
idl::GeoPositionOptions* aOptions,
mozilla::idl::GeoPositionOptions* aOptions,
bool aWatchPositionRequest,
int32_t aWatchId)
: mIsWatchPositionRequest(aWatchPositionRequest),
@ -673,7 +624,7 @@ nsresult nsGeolocationService::Init()
}
// geolocation service can be enabled -> now register observer
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs) {
return NS_ERROR_FAILURE;
}
@ -782,7 +733,7 @@ nsGeolocationService::Observe(nsISupports* aSubject,
const PRUnichar* aData)
{
if (!strcmp("quit-application", aTopic)) {
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->RemoveObserver(this, "quit-application");
obs->RemoveObserver(this, "mozsettings-changed");
@ -871,7 +822,7 @@ nsGeolocationService::StartDevice(nsIPrincipal *aPrincipal)
}
// Start them up!
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs) {
return NS_ERROR_FAILURE;
}
@ -957,7 +908,7 @@ nsGeolocationService::StopDevice()
return; // bail early
}
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs) {
return;
}
@ -1222,7 +1173,7 @@ Geolocation::GetCurrentPosition(PositionCallback& aCallback,
NS_IMETHODIMP
Geolocation::GetCurrentPosition(nsIDOMGeoPositionCallback* aCallback,
nsIDOMGeoPositionErrorCallback* aErrorCallback,
idl::GeoPositionOptions* aOptions)
mozilla::idl::GeoPositionOptions* aOptions)
{
NS_ENSURE_ARG_POINTER(aCallback);
@ -1235,7 +1186,7 @@ Geolocation::GetCurrentPosition(nsIDOMGeoPositionCallback* aCallback,
nsresult
Geolocation::GetCurrentPosition(GeoPositionCallback& callback,
GeoPositionErrorCallback& errorCallback,
idl::GeoPositionOptions *options)
mozilla::idl::GeoPositionOptions *options)
{
if (mPendingCallbacks.Length() > MAX_GEO_REQUESTS_PER_WINDOW) {
return NS_ERROR_NOT_AVAILABLE;
@ -1311,7 +1262,7 @@ Geolocation::WatchPosition(PositionCallback& aCallback,
NS_IMETHODIMP
Geolocation::WatchPosition(nsIDOMGeoPositionCallback *aCallback,
nsIDOMGeoPositionErrorCallback *aErrorCallback,
idl::GeoPositionOptions *aOptions,
mozilla::idl::GeoPositionOptions *aOptions,
int32_t* aRv)
{
NS_ENSURE_ARG_POINTER(aCallback);
@ -1325,7 +1276,7 @@ Geolocation::WatchPosition(nsIDOMGeoPositionCallback *aCallback,
nsresult
Geolocation::WatchPosition(GeoPositionCallback& aCallback,
GeoPositionErrorCallback& aErrorCallback,
idl::GeoPositionOptions* aOptions,
mozilla::idl::GeoPositionOptions* aOptions,
int32_t* aRv)
{
if (mWatchingCallbacks.Length() > MAX_GEO_REQUESTS_PER_WINDOW) {
@ -1509,5 +1460,5 @@ Geolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
JSObject*
Geolocation::WrapObject(JSContext *aCtx, JS::Handle<JSObject*> aScope)
{
return GeolocationBinding::Wrap(aCtx, aScope, this);
return mozilla::dom::GeolocationBinding::Wrap(aCtx, aScope, this);
}

Просмотреть файл

@ -33,10 +33,10 @@
#include "nsIContentPermissionPrompt.h"
#include "nsIDOMWindow.h"
#include "DictionaryHelpers.h"
#include "PCOMContentPermissionRequestChild.h"
#include "mozilla/Attributes.h"
class nsGeolocationService;
class nsGeolocationRequest;
namespace mozilla {
namespace dom {
@ -46,6 +46,54 @@ typedef CallbackObjectHolder<PositionErrorCallback, nsIDOMGeoPositionErrorCallba
}
}
class nsGeolocationRequest
: public nsIContentPermissionRequest
, public nsITimerCallback
, public nsIGeolocationUpdate
, public PCOMContentPermissionRequestChild
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
NS_DECL_NSITIMERCALLBACK
NS_DECL_NSIGEOLOCATIONUPDATE
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsGeolocationRequest, nsIContentPermissionRequest)
nsGeolocationRequest(mozilla::dom::Geolocation* locator,
const mozilla::dom::GeoPositionCallback& callback,
const mozilla::dom::GeoPositionErrorCallback& errorCallback,
mozilla::idl::GeoPositionOptions* aOptions,
bool watchPositionRequest = false,
int32_t watchId = 0);
void Shutdown();
void SendLocation(nsIDOMGeoPosition* location);
bool WantsHighAccuracy() {return mOptions && mOptions->enableHighAccuracy;}
void SetTimeoutTimer();
nsIPrincipal* GetPrincipal();
~nsGeolocationRequest();
virtual bool Recv__delete__(const bool& allow) MOZ_OVERRIDE;
virtual void IPDLRelease() MOZ_OVERRIDE { Release(); }
bool IsWatch() { return mIsWatchPositionRequest; }
int32_t WatchId() { return mWatchId; }
private:
bool mIsWatchPositionRequest;
nsCOMPtr<nsITimer> mTimeoutTimer;
mozilla::dom::GeoPositionCallback mCallback;
mozilla::dom::GeoPositionErrorCallback mErrorCallback;
nsAutoPtr<mozilla::idl::GeoPositionOptions> mOptions;
nsRefPtr<mozilla::dom::Geolocation> mLocator;
int32_t mWatchId;
bool mShutdown;
};
/**
* Singleton that manages the geolocation provider
*/

Просмотреть файл

@ -11,54 +11,9 @@
#include "mozilla/Preferences.h"
#include "nsGlobalWindow.h"
#include "nsIAppsService.h"
#include "PCOMContentPermissionRequestChild.h"
namespace mozilla {
namespace dom {
/*
* Simple Request
*/
class DesktopNotificationRequest : public nsIContentPermissionRequest,
public nsRunnable,
public PCOMContentPermissionRequestChild
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
DesktopNotificationRequest(DesktopNotification* notification)
: mDesktopNotification(notification) {}
NS_IMETHOD Run() MOZ_OVERRIDE
{
nsCOMPtr<nsIContentPermissionPrompt> prompt =
do_CreateInstance(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
if (prompt) {
prompt->Prompt(this);
}
return NS_OK;
}
~DesktopNotificationRequest()
{
}
virtual bool Recv__delete__(const bool& aAllow) MOZ_OVERRIDE
{
if (aAllow) {
(void) Allow();
} else {
(void) Cancel();
}
return true;
}
virtual void IPDLRelease() MOZ_OVERRIDE { Release(); }
nsRefPtr<DesktopNotification> mDesktopNotification;
};
/* ------------------------------------------------------------------------ */
/* AlertServiceObserver */
/* ------------------------------------------------------------------------ */

Просмотреть файл

@ -5,6 +5,8 @@
#ifndef mozilla_dom_DesktopNotification_h
#define mozilla_dom_DesktopNotification_h
#include "PCOMContentPermissionRequestChild.h"
#include "nsIPrincipal.h"
#include "nsIAlertsService.h"
#include "nsIContentPermissionPrompt.h"
@ -82,7 +84,6 @@ private:
nsCOMPtr<nsIPrincipal> mPrincipal;
};
class DesktopNotificationRequest;
class DesktopNotification MOZ_FINAL : public nsDOMEventTargetHelper
{
@ -144,6 +145,48 @@ protected:
static uint32_t sCount;
};
/*
* Simple Request
*/
class DesktopNotificationRequest : public nsIContentPermissionRequest,
public nsRunnable,
public PCOMContentPermissionRequestChild
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
DesktopNotificationRequest(DesktopNotification* notification)
: mDesktopNotification(notification) {}
NS_IMETHOD Run() MOZ_OVERRIDE
{
nsCOMPtr<nsIContentPermissionPrompt> prompt =
do_CreateInstance(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
if (prompt) {
prompt->Prompt(this);
}
return NS_OK;
}
~DesktopNotificationRequest()
{
}
virtual bool Recv__delete__(const bool& allow) MOZ_OVERRIDE
{
if (allow)
(void) Allow();
else
(void) Cancel();
return true;
}
virtual void IPDLRelease() MOZ_OVERRIDE { Release(); }
nsRefPtr<DesktopNotification> mDesktopNotification;
};
class AlertServiceObserver: public nsIObserver
{
public:

Просмотреть файл

@ -32,7 +32,6 @@
#include "nsJSUtils.h"
#include "nsCxPusher.h"
#include "nsThreadUtils.h"
using namespace mozilla::dom::gonk;
using namespace android;

Просмотреть файл

@ -16,6 +16,7 @@
#include "mozilla/dom/battery/Types.h"
#include "mozilla/dom/network/Types.h"
#include "mozilla/dom/power/Types.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/hal_sandbox/PHal.h"
#include "mozilla/dom/ScreenOrientation.h"

Просмотреть файл

@ -43,7 +43,6 @@
#include "mozilla/dom/battery/Constants.h"
#include "mozilla/FileUtils.h"
#include "mozilla/Monitor.h"
#include "mozilla/RefPtr.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Preferences.h"

Просмотреть файл

@ -25,7 +25,6 @@
#include "Hal.h"
#include "HalSensor.h"
#include "hardware/sensors.h"
#include "nsThreadUtils.h"
#undef LOG

Просмотреть файл

@ -22,11 +22,9 @@
#include "Hal.h"
#include "mozilla/FileUtils.h"
#include "mozilla/RefPtr.h"
#include "mozilla/Monitor.h"
#include "nsPrintfCString.h"
#include "nsXULAppAPI.h"
#include "nsThreadUtils.h"
#include "UeventPoller.h"
using namespace mozilla::hal;

Просмотреть файл

@ -8,7 +8,6 @@
#include <unistd.h>
#include <sys/reboot.h>
#include "nsIObserverService.h"
#include "mozilla/Services.h"
namespace mozilla {
namespace hal_impl {

Просмотреть файл

@ -3,13 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DiskSpaceWatcher.h"
#include "nsIObserverService.h"
#include "nsXULAppAPI.h"
#include "mozilla/Hal.h"
#include "mozilla/ModuleUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Services.h"
#define NS_DISKSPACEWATCHER_CID \
{ 0xab218518, 0xf197, 0x4fb4, { 0x8b, 0x0f, 0x8b, 0xb3, 0x4d, 0xf2, 0x4b, 0xf4 } }

Просмотреть файл

@ -44,7 +44,6 @@
#include "nsIObserverService.h"
#include "nsIScreen.h"
#include "nsScreenManagerGonk.h"
#include "nsThreadUtils.h"
#include "nsWindow.h"
#include "OrientationObserver.h"
#include "GonkMemoryPressureMonitoring.h"