mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
b9843e0358
- Bug 1167459 - Skip rendering function name nodes if there's no name available (e.g. for C++ pseudoframes), r=jsantell (4a69ed224)
- missing bits Bug 1102219 - Part 4: Replace String.prototype.contains with `String.prototype.includes` in chrome code. r=till (73cd2d2b1)
- Bug 1165045 - Don't create nodes with empty text in the call tree, r=jsantell (b013aa82d)
- Bug 1166122 - Fix regression in the call tree caused by bug 1165045, r=jsantell (ee3f16901)
- Bug 1167975 - CallView._displaySelf sets this.document just because other functions use it; it should pass it as an argument instead, r=jsantell (5ef560c4f)
- Bug 1122662 - Resize graphs when window resizes;r=vporof (25c108e4e)
- Bug 1164784 - Eliminate CSS duplication with perf tool record button r=jsantell (43c9bb999)
- Bug 1150761 - Rename the performance tool's details view names to better describe the data visualizations. r=vp (04ceb6a37)
- Bug 1144424 - Rename '{self,total} allocations' to '{self,total} sampled allocations' in the performance tool. r=jsantell (ae79ad54f)
- Bug 1069910 - Add tooltips explaining what each column in the profiler's tree view represents; r=jsantell (8756f88b6)
- Bug 1107849 - Define a min/max width for the performance panel sidebar. r=vporof (e1769e831)
- Bug 11663354 - A locked recording button should appear disabled in the performance tool. r=vp (4a359d39e)
- Bug 1023546 - DevTools - Support HDPI resolutions for Windows. r=bgrins (ef1a3ecb8)
- Bug 1168125 - Cleanup performance xul and css, r=jsantell (8ec794e46)
- Bug 1168125 - Replace the waterfall view with a tree, r=jsantell (ea76514fe)
- Bug 1168125 - Add marker folding logic, r=jsantell (1d3748d2a)
- Bug 862341 Part 1: Move the network request storage from the console frontend to the console client so the netmonitor can reuse it. r=vporof (d29fb2b73)
- remove gre from resource path (126b00df1)
- Bug 943306 - Allow persisting console input history between sessions;r=past (146ebb486)
- Bug 1134845 - Add clearHistory jsterm helper to remove persisted console input history. r=past (22237e95b)
- Bug 1143497 - Offer a way to extend WebConsole commands. r=bgrins (84e2d2957)
- Bug 1125205 - Display console API messages from shared or service workers to the web console, r=past (b4b701a2c)
- Bug 1169342 - Remove nsIDOMDeviceStorage. Cleanup nsDOMDeviceStorage event wrappers. r=dhylands (41338e16f)
- Bug 1151610 - Manage the case where two extensions fight over the same command. r=bgrins (63f9d2064)
- Bug 862341 Part 2: Display cached network requests in the web console. r=vporof (83c0e7263)
- Bug 1144211 - Improve code coverage of camera mochitests. r=mikeh (ba9f3de89)
- Bug 1152500 - Fix how stop recording may be handled out-of-order. r=dhylands (d8bdd379c)
- Bug 862341 Part 3: Display cached network requests in the network panel. r=vporof (a1a6f151d)
- Bug 862341 Part 4: Start recording network requests when the toolbox opens. r=vporof (7a2bdf847)
- Bug 1151499 - Correct the FM playable state. r=baku (8af26fff2)
- Bug 1180347 - Split media.useAudioChannelService to support turning the service on without turning the Firefox OS specific APIs on; r=baku (3fa29291a)
- Bug 862341 Part 5: Tests. r=vporof (82fb944c6)
247 lines
9.7 KiB
C++
247 lines
9.7 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef DOM_CAMERA_DOMCAMERACONTROL_H
|
|
#define DOM_CAMERA_DOMCAMERACONTROL_H
|
|
|
|
#include "nsCOMPtr.h"
|
|
#include "nsAutoPtr.h"
|
|
#include "nsCycleCollectionParticipant.h"
|
|
#include "mozilla/dom/CameraControlBinding.h"
|
|
#include "mozilla/dom/Promise.h"
|
|
#include "ICameraControl.h"
|
|
#include "CameraCommon.h"
|
|
#include "DOMMediaStream.h"
|
|
#include "AudioChannelAgent.h"
|
|
#include "nsProxyRelease.h"
|
|
#include "nsHashPropertyBag.h"
|
|
#include "DeviceStorage.h"
|
|
#include "DOMCameraControlListener.h"
|
|
#include "nsWeakReference.h"
|
|
#ifdef MOZ_WIDGET_GONK
|
|
#include "nsITimer.h"
|
|
#endif
|
|
|
|
class nsDOMDeviceStorage;
|
|
class nsPIDOMWindow;
|
|
class nsIDOMBlob;
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
class CameraCapabilities;
|
|
struct CameraPictureOptions;
|
|
struct CameraStartRecordingOptions;
|
|
struct CameraRegion;
|
|
struct CameraSize;
|
|
template<typename T> class Optional;
|
|
} // namespace dom
|
|
class ErrorResult;
|
|
class StartRecordingHelper;
|
|
|
|
#define NS_DOM_CAMERA_CONTROL_CID \
|
|
{ 0x3700c096, 0xf920, 0x438d, \
|
|
{ 0x8b, 0x3f, 0x15, 0xb3, 0xc9, 0x96, 0x23, 0x62 } }
|
|
|
|
// Main camera control.
|
|
class nsDOMCameraControl final : public DOMMediaStream
|
|
, public nsSupportsWeakReference
|
|
{
|
|
public:
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_CAMERA_CONTROL_CID)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMCameraControl, DOMMediaStream)
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
// Because this header's filename doesn't match its C++ or DOM-facing
|
|
// classname, we can't rely on the [Func="..."] WebIDL tag to implicitly
|
|
// include the right header for us; instead we must explicitly include a
|
|
// HasSupport() method in each header. We can get rid of these with the
|
|
// Great Renaming proposed in bug 983177.
|
|
static bool HasSupport(JSContext* aCx, JSObject* aGlobal);
|
|
|
|
nsDOMCameraControl(uint32_t aCameraId,
|
|
const dom::CameraConfiguration& aInitialConfig,
|
|
dom::Promise* aPromise,
|
|
nsPIDOMWindow* aWindow);
|
|
|
|
void Shutdown();
|
|
|
|
nsPIDOMWindow* GetParentObject() const { return mWindow; }
|
|
|
|
// Attributes.
|
|
void GetEffect(nsString& aEffect, ErrorResult& aRv);
|
|
void SetEffect(const nsAString& aEffect, ErrorResult& aRv);
|
|
void GetWhiteBalanceMode(nsString& aMode, ErrorResult& aRv);
|
|
void SetWhiteBalanceMode(const nsAString& aMode, ErrorResult& aRv);
|
|
void GetSceneMode(nsString& aMode, ErrorResult& aRv);
|
|
void SetSceneMode(const nsAString& aMode, ErrorResult& aRv);
|
|
void GetFlashMode(nsString& aMode, ErrorResult& aRv);
|
|
void SetFlashMode(const nsAString& aMode, ErrorResult& aRv);
|
|
void GetFocusMode(nsString& aMode, ErrorResult& aRv);
|
|
void SetFocusMode(const nsAString& aMode, ErrorResult& aRv);
|
|
double GetZoom(ErrorResult& aRv);
|
|
void SetZoom(double aZoom, ErrorResult& aRv);
|
|
double GetFocalLength(ErrorResult& aRv);
|
|
double GetFocusDistanceNear(ErrorResult& aRv);
|
|
double GetFocusDistanceOptimum(ErrorResult& aRv);
|
|
double GetFocusDistanceFar(ErrorResult& aRv);
|
|
void SetExposureCompensation(double aCompensation, ErrorResult& aRv);
|
|
double GetExposureCompensation(ErrorResult& aRv);
|
|
int32_t SensorAngle();
|
|
already_AddRefed<dom::CameraCapabilities> Capabilities();
|
|
void GetIsoMode(nsString& aMode, ErrorResult& aRv);
|
|
void SetIsoMode(const nsAString& aMode, ErrorResult& aRv);
|
|
double GetPictureQuality(ErrorResult& aRv);
|
|
void SetPictureQuality(double aQuality, ErrorResult& aRv);
|
|
void GetMeteringMode(nsString& aMode, ErrorResult& aRv);
|
|
void SetMeteringMode(const nsAString& aMode, ErrorResult& aRv);
|
|
|
|
// Methods.
|
|
already_AddRefed<dom::Promise> SetConfiguration(const dom::CameraConfiguration& aConfiguration,
|
|
ErrorResult& aRv);
|
|
void GetMeteringAreas(nsTArray<dom::CameraRegion>& aAreas, ErrorResult& aRv);
|
|
void SetMeteringAreas(const dom::Optional<dom::Sequence<dom::CameraRegion> >& aAreas, ErrorResult& aRv);
|
|
void GetFocusAreas(nsTArray<dom::CameraRegion>& aAreas, ErrorResult& aRv);
|
|
void SetFocusAreas(const dom::Optional<dom::Sequence<dom::CameraRegion> >& aAreas, ErrorResult& aRv);
|
|
void GetPictureSize(dom::CameraSize& aSize, ErrorResult& aRv);
|
|
void SetPictureSize(const dom::CameraSize& aSize, ErrorResult& aRv);
|
|
void GetThumbnailSize(dom::CameraSize& aSize, ErrorResult& aRv);
|
|
void SetThumbnailSize(const dom::CameraSize& aSize, ErrorResult& aRv);
|
|
already_AddRefed<dom::Promise> AutoFocus(ErrorResult& aRv);
|
|
void StartFaceDetection(ErrorResult& aRv);
|
|
void StopFaceDetection(ErrorResult& aRv);
|
|
already_AddRefed<dom::Promise> TakePicture(const dom::CameraPictureOptions& aOptions,
|
|
ErrorResult& aRv);
|
|
already_AddRefed<dom::Promise> StartRecording(const dom::CameraStartRecordingOptions& aOptions,
|
|
nsDOMDeviceStorage& storageArea,
|
|
const nsAString& filename,
|
|
ErrorResult& aRv);
|
|
void StopRecording(ErrorResult& aRv);
|
|
void ResumePreview(ErrorResult& aRv);
|
|
already_AddRefed<dom::Promise> ReleaseHardware(ErrorResult& aRv);
|
|
void ResumeContinuousFocus(ErrorResult& aRv);
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
operator nsISupports*() { return static_cast<DOMMediaStream*>(this); }
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
static void PreinitCameraHardware();
|
|
static void DiscardCachedCameraInstance(nsITimer* aTimer, void* aClosure);
|
|
#endif
|
|
|
|
IMPL_EVENT_HANDLER(facesdetected)
|
|
IMPL_EVENT_HANDLER(shutter)
|
|
IMPL_EVENT_HANDLER(close)
|
|
IMPL_EVENT_HANDLER(recorderstatechange)
|
|
IMPL_EVENT_HANDLER(previewstatechange)
|
|
IMPL_EVENT_HANDLER(focus)
|
|
IMPL_EVENT_HANDLER(picture)
|
|
IMPL_EVENT_HANDLER(configurationchange)
|
|
|
|
protected:
|
|
virtual ~nsDOMCameraControl();
|
|
|
|
class DOMCameraConfiguration final : public dom::CameraConfiguration
|
|
{
|
|
public:
|
|
NS_INLINE_DECL_REFCOUNTING(DOMCameraConfiguration)
|
|
|
|
DOMCameraConfiguration();
|
|
explicit DOMCameraConfiguration(const dom::CameraConfiguration& aConfiguration);
|
|
|
|
// Additional configuration options that aren't exposed to the DOM
|
|
uint32_t mMaxFocusAreas;
|
|
uint32_t mMaxMeteringAreas;
|
|
|
|
private:
|
|
// Private destructor, to discourage deletion outside of Release():
|
|
~DOMCameraConfiguration();
|
|
};
|
|
|
|
friend class DOMCameraControlListener;
|
|
friend class mozilla::StartRecordingHelper;
|
|
|
|
void OnCreatedFileDescriptor(bool aSucceeded);
|
|
|
|
void OnAutoFocusComplete(bool aAutoFocusSucceeded);
|
|
void OnAutoFocusMoving(bool aIsMoving);
|
|
void OnTakePictureComplete(nsIDOMBlob* aPicture);
|
|
void OnFacesDetected(const nsTArray<ICameraControl::Face>& aFaces);
|
|
|
|
void OnGetCameraComplete();
|
|
void OnHardwareStateChange(DOMCameraControlListener::HardwareState aState, nsresult aReason);
|
|
void OnPreviewStateChange(DOMCameraControlListener::PreviewState aState);
|
|
void OnRecorderStateChange(CameraControlListener::RecorderState aState, int32_t aStatus, int32_t aTrackNum);
|
|
void OnConfigurationChange(DOMCameraConfiguration* aConfiguration);
|
|
void OnShutter();
|
|
void OnUserError(CameraControlListener::UserContext aContext, nsresult aError);
|
|
|
|
bool IsWindowStillActive();
|
|
nsresult SelectPreviewSize(const dom::CameraSize& aRequestedPreviewSize, ICameraControl::Size& aSelectedPreviewSize);
|
|
|
|
void ReleaseAudioChannelAgent();
|
|
nsresult NotifyRecordingStatusChange(const nsString& aMsg);
|
|
|
|
already_AddRefed<dom::Promise> CreatePromise(ErrorResult& aRv);
|
|
void AbortPromise(nsRefPtr<dom::Promise>& aPromise);
|
|
virtual void EventListenerAdded(nsIAtom* aType) override;
|
|
void DispatchPreviewStateEvent(DOMCameraControlListener::PreviewState aState);
|
|
void DispatchStateEvent(const nsString& aType, const nsString& aState);
|
|
|
|
nsRefPtr<ICameraControl> mCameraControl; // non-DOM camera control
|
|
|
|
// An agent used to join audio channel service.
|
|
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
|
|
|
|
nsresult Set(uint32_t aKey, const dom::Optional<dom::Sequence<dom::CameraRegion> >& aValue, uint32_t aLimit);
|
|
nsresult Get(uint32_t aKey, nsTArray<dom::CameraRegion>& aValue);
|
|
|
|
nsRefPtr<DOMCameraConfiguration> mCurrentConfiguration;
|
|
nsRefPtr<dom::CameraCapabilities> mCapabilities;
|
|
|
|
// camera control pending promises
|
|
nsRefPtr<dom::Promise> mGetCameraPromise;
|
|
nsRefPtr<dom::Promise> mAutoFocusPromise;
|
|
nsRefPtr<dom::Promise> mTakePicturePromise;
|
|
nsRefPtr<dom::Promise> mStartRecordingPromise;
|
|
nsRefPtr<dom::Promise> mReleasePromise;
|
|
nsRefPtr<dom::Promise> mSetConfigurationPromise;
|
|
|
|
// Camera event listener; we only need this weak reference so that
|
|
// we can remove the listener from the camera when we're done
|
|
// with it.
|
|
DOMCameraControlListener* mListener;
|
|
|
|
// our viewfinder stream
|
|
nsRefPtr<CameraPreviewMediaStream> mInput;
|
|
|
|
// set once when this object is created
|
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
|
|
|
dom::CameraStartRecordingOptions mOptions;
|
|
nsRefPtr<DeviceStorageFileDescriptor> mDSFileDescriptor;
|
|
DOMCameraControlListener::PreviewState mPreviewState;
|
|
bool mRecording;
|
|
bool mSetInitialConfig;
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
// cached camera control, to improve start-up time
|
|
static StaticRefPtr<ICameraControl> sCachedCameraControl;
|
|
static nsresult sCachedCameraControlStartResult;
|
|
static nsCOMPtr<nsITimer> sDiscardCachedCameraControlTimer;
|
|
#endif
|
|
|
|
private:
|
|
nsDOMCameraControl(const nsDOMCameraControl&) = delete;
|
|
nsDOMCameraControl& operator=(const nsDOMCameraControl&) = delete;
|
|
};
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsDOMCameraControl, NS_DOM_CAMERA_CONTROL_CID)
|
|
|
|
} // namespace mozilla
|
|
|
|
#endif // DOM_CAMERA_DOMCAMERACONTROL_H
|