diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 1c3d54b6c70..31fc4f29b0c 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -205,7 +205,7 @@ CompositorVsyncObserver::CompositorVsyncObserver(CompositorParent* aCompositorPa { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aWidget != nullptr); - mVsyncDispatcher = aWidget->GetVsyncDispatcher(); + mCompositorVsyncDispatcher = aWidget->GetCompositorVsyncDispatcher(); #ifdef MOZ_WIDGET_GONK GeckoTouchDispatcher::SetCompositorVsyncObserver(this); #endif @@ -215,10 +215,10 @@ CompositorVsyncObserver::~CompositorVsyncObserver() { MOZ_ASSERT(CompositorParent::IsInCompositorThread()); MOZ_ASSERT(!mIsObservingVsync); - // The VsyncDispatcher is cleaned up before this in the nsBaseWidget, which stops vsync listeners + // The CompositorVsyncDispatcher is cleaned up before this in the nsBaseWidget, which stops vsync listeners CancelCurrentCompositeTask(); mCompositorParent = nullptr; - mVsyncDispatcher = nullptr; + mCompositorVsyncDispatcher = nullptr; mNeedsComposite = false; } @@ -301,7 +301,7 @@ void CompositorVsyncObserver::ObserveVsync() { MOZ_ASSERT(CompositorParent::IsInCompositorThread()); - mVsyncDispatcher->SetCompositorVsyncObserver(this); + mCompositorVsyncDispatcher->SetCompositorVsyncObserver(this); mIsObservingVsync = true; } @@ -309,7 +309,7 @@ void CompositorVsyncObserver::UnobserveVsync() { MOZ_ASSERT(CompositorParent::IsInCompositorThread() || NS_IsMainThread()); - mVsyncDispatcher->SetCompositorVsyncObserver(nullptr); + mCompositorVsyncDispatcher->SetCompositorVsyncObserver(nullptr); mIsObservingVsync = false; } diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index b950238abb6..79c67a6d36c 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -118,7 +118,7 @@ private: bool mNeedsComposite; bool mIsObservingVsync; nsRefPtr mCompositorParent; - nsRefPtr mVsyncDispatcher; + nsRefPtr mCompositorVsyncDispatcher; mozilla::Monitor mCurrentCompositeTaskMonitor; CancelableTask* mCurrentCompositeTask; diff --git a/gfx/thebes/VsyncSource.cpp b/gfx/thebes/VsyncSource.cpp index 994b933f170..6b464337954 100644 --- a/gfx/thebes/VsyncSource.cpp +++ b/gfx/thebes/VsyncSource.cpp @@ -12,21 +12,21 @@ using namespace mozilla; using namespace mozilla::gfx; void -VsyncSource::AddVsyncDispatcher(VsyncDispatcher* aVsyncDispatcher) +VsyncSource::AddCompositorVsyncDispatcher(CompositorVsyncDispatcher* aCompositorVsyncDispatcher) { MOZ_ASSERT(NS_IsMainThread()); - GetGlobalDisplay().AddVsyncDispatcher(aVsyncDispatcher); + GetGlobalDisplay().AddCompositorVsyncDispatcher(aCompositorVsyncDispatcher); } void -VsyncSource::RemoveVsyncDispatcher(VsyncDispatcher* aVsyncDispatcher) +VsyncSource::RemoveCompositorVsyncDispatcher(CompositorVsyncDispatcher* aCompositorVsyncDispatcher) { MOZ_ASSERT(NS_IsMainThread()); - GetGlobalDisplay().RemoveVsyncDispatcher(aVsyncDispatcher); + GetGlobalDisplay().RemoveCompositorVsyncDispatcher(aCompositorVsyncDispatcher); } VsyncSource::Display& -VsyncSource::FindDisplay(VsyncDispatcher* aVsyncDispatcher) +VsyncSource::FindDisplay(CompositorVsyncDispatcher* aCompositorVsyncDispatcher) { return GetGlobalDisplay(); } @@ -35,8 +35,8 @@ void VsyncSource::Display::NotifyVsync(TimeStamp aVsyncTimestamp) { // Called on the hardware vsync thread - for (size_t i = 0; i < mVsyncDispatchers.Length(); i++) { - mVsyncDispatchers[i]->NotifyVsync(aVsyncTimestamp); + for (size_t i = 0; i < mCompositorVsyncDispatchers.Length(); i++) { + mCompositorVsyncDispatchers[i]->NotifyVsync(aVsyncTimestamp); } } @@ -48,19 +48,19 @@ VsyncSource::Display::Display() VsyncSource::Display::~Display() { MOZ_ASSERT(NS_IsMainThread()); - mVsyncDispatchers.Clear(); + mCompositorVsyncDispatchers.Clear(); } void -VsyncSource::Display::AddVsyncDispatcher(VsyncDispatcher* aVsyncDispatcher) +VsyncSource::Display::AddCompositorVsyncDispatcher(CompositorVsyncDispatcher* aCompositorVsyncDispatcher) { MOZ_ASSERT(NS_IsMainThread()); - mVsyncDispatchers.AppendElement(aVsyncDispatcher); + mCompositorVsyncDispatchers.AppendElement(aCompositorVsyncDispatcher); } void -VsyncSource::Display::RemoveVsyncDispatcher(VsyncDispatcher* aVsyncDispatcher) +VsyncSource::Display::RemoveCompositorVsyncDispatcher(CompositorVsyncDispatcher* aCompositorVsyncDispatcher) { MOZ_ASSERT(NS_IsMainThread()); - mVsyncDispatchers.RemoveElement(aVsyncDispatcher); + mCompositorVsyncDispatchers.RemoveElement(aCompositorVsyncDispatcher); } diff --git a/gfx/thebes/VsyncSource.h b/gfx/thebes/VsyncSource.h index 343753f7652..f8a1454e5ab 100644 --- a/gfx/thebes/VsyncSource.h +++ b/gfx/thebes/VsyncSource.h @@ -9,7 +9,7 @@ #include "nsTArray.h" namespace mozilla { -class VsyncDispatcher; +class CompositorVsyncDispatcher; namespace gfx { @@ -24,8 +24,8 @@ public: public: Display(); virtual ~Display(); - void AddVsyncDispatcher(mozilla::VsyncDispatcher* aVsyncDispatcher); - void RemoveVsyncDispatcher(mozilla::VsyncDispatcher* aVsyncDispatcher); + void AddCompositorVsyncDispatcher(mozilla::CompositorVsyncDispatcher* aCompositorVsyncDispatcher); + void RemoveCompositorVsyncDispatcher(mozilla::CompositorVsyncDispatcher* aCompositorVsyncDispatcher); // Notified when this display's vsync occurs, on the hardware vsync thread void NotifyVsync(mozilla::TimeStamp aVsyncTimestamp); @@ -35,15 +35,15 @@ public: virtual bool IsVsyncEnabled() = 0; private: - nsTArray> mVsyncDispatchers; + nsTArray> mCompositorVsyncDispatchers; }; // end Display - void AddVsyncDispatcher(mozilla::VsyncDispatcher* aVsyncDispatcher); - void RemoveVsyncDispatcher(mozilla::VsyncDispatcher* aVsyncDispatcher); + void AddCompositorVsyncDispatcher(mozilla::CompositorVsyncDispatcher* aCompositorVsyncDispatcher); + void RemoveCompositorVsyncDispatcher(mozilla::CompositorVsyncDispatcher* aCompositorVsyncDispatcher); protected: virtual Display& GetGlobalDisplay() = 0; // Works across all displays - virtual Display& FindDisplay(mozilla::VsyncDispatcher* aVsyncDispatcher); + virtual Display& FindDisplay(mozilla::CompositorVsyncDispatcher* aCompositorVsyncDispatcher); virtual ~VsyncSource() {} }; // VsyncSource } // gfx diff --git a/widget/VsyncDispatcher.cpp b/widget/VsyncDispatcher.cpp index 5aa8c5322ca..25710cfce95 100644 --- a/widget/VsyncDispatcher.cpp +++ b/widget/VsyncDispatcher.cpp @@ -23,21 +23,21 @@ using namespace mozilla::layers; namespace mozilla { -VsyncDispatcher::VsyncDispatcher() +CompositorVsyncDispatcher::CompositorVsyncDispatcher() : mCompositorObserverLock("CompositorObserverLock") { MOZ_ASSERT(XRE_IsParentProcess()); - gfxPlatform::GetPlatform()->GetHardwareVsync()->AddVsyncDispatcher(this); + gfxPlatform::GetPlatform()->GetHardwareVsync()->AddCompositorVsyncDispatcher(this); } -VsyncDispatcher::~VsyncDispatcher() +CompositorVsyncDispatcher::~CompositorVsyncDispatcher() { // We auto remove this vsync dispatcher from the vsync source in the nsBaseWidget MOZ_ASSERT(NS_IsMainThread()); } void -VsyncDispatcher::NotifyVsync(TimeStamp aVsyncTimestamp) +CompositorVsyncDispatcher::NotifyVsync(TimeStamp aVsyncTimestamp) { // In hardware vsync thread #ifdef MOZ_ENABLE_PROFILER_SPS @@ -53,7 +53,7 @@ VsyncDispatcher::NotifyVsync(TimeStamp aVsyncTimestamp) } void -VsyncDispatcher::SetCompositorVsyncObserver(VsyncObserver* aVsyncObserver) +CompositorVsyncDispatcher::SetCompositorVsyncObserver(VsyncObserver* aVsyncObserver) { MOZ_ASSERT(CompositorParent::IsInCompositorThread()); MutexAutoLock lock(mCompositorObserverLock); @@ -61,13 +61,13 @@ VsyncDispatcher::SetCompositorVsyncObserver(VsyncObserver* aVsyncObserver) } void -VsyncDispatcher::Shutdown() +CompositorVsyncDispatcher::Shutdown() { - // Need to explicitly remove VsyncDispatcher when the nsBaseWidget shuts down. + // Need to explicitly remove CompositorVsyncDispatcher when the nsBaseWidget shuts down. // Otherwise, we would get dead vsync notifications between when the nsBaseWidget // shuts down and the CompositorParent shuts down. MOZ_ASSERT(XRE_IsParentProcess()); MOZ_ASSERT(NS_IsMainThread()); - gfxPlatform::GetPlatform()->GetHardwareVsync()->RemoveVsyncDispatcher(this); + gfxPlatform::GetPlatform()->GetHardwareVsync()->RemoveCompositorVsyncDispatcher(this); } } // namespace mozilla diff --git a/widget/VsyncDispatcher.h b/widget/VsyncDispatcher.h index 2a38f470770..188fc44046d 100644 --- a/widget/VsyncDispatcher.h +++ b/widget/VsyncDispatcher.h @@ -21,7 +21,6 @@ class CompositorVsyncObserver; class VsyncObserver { - // Must be destroyed on main thread since the compositor is as well NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VsyncObserver) public: @@ -34,13 +33,11 @@ protected: virtual ~VsyncObserver() {} }; // VsyncObserver -// VsyncDispatcher is used to dispatch vsync events to the registered observers. -class VsyncDispatcher +class CompositorVsyncDispatcher MOZ_FINAL { - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VsyncDispatcher) - + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorVsyncDispatcher) public: - VsyncDispatcher(); + CompositorVsyncDispatcher(); // Called on the vsync thread when a hardware vsync occurs // The aVsyncTimestamp can mean different things depending on the platform: @@ -55,10 +52,10 @@ public: void Shutdown(); private: - virtual ~VsyncDispatcher(); + virtual ~CompositorVsyncDispatcher(); Mutex mCompositorObserverLock; nsRefPtr mCompositorVsyncObserver; -}; // VsyncDispatcher +}; } // namespace mozilla diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index fc126971220..dae566a19eb 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -220,7 +220,7 @@ nsWindow::NotifyVsync(TimeStamp aVsyncTimestamp) return; } - VsyncDispatcher* vsyncDispatcher = gFocusedWindow->GetVsyncDispatcher(); + CompositorVsyncDispatcher* vsyncDispatcher = gFocusedWindow->GetCompositorVsyncDispatcher(); // During bootup, there is a delay between when the nsWindow is created // and when the Compositor is created, but vsync is already turned on if (vsyncDispatcher) { diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index ae5c60f7a3f..745f5cef97e 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -114,7 +114,7 @@ nsBaseWidget::nsBaseWidget() : mWidgetListener(nullptr) , mAttachedWidgetListener(nullptr) , mContext(nullptr) -, mVsyncDispatcher(nullptr) +, mCompositorVsyncDispatcher(nullptr) , mCursor(eCursor_standard) , mUpdateCursor(true) , mBorderStyle(eBorderStyle_none) @@ -234,9 +234,9 @@ nsBaseWidget::~nsBaseWidget() NS_IF_RELEASE(mContext); delete mOriginalBounds; - // Can have base widgets that are things like tooltips which don't have vsyncDispatchers - if (mVsyncDispatcher) { - mVsyncDispatcher->Shutdown(); + // Can have base widgets that are things like tooltips which don't have CompositorVsyncDispatchers + if (mCompositorVsyncDispatcher) { + mCompositorVsyncDispatcher->Shutdown(); } } @@ -973,22 +973,22 @@ nsBaseWidget::GetPreferredCompositorBackends(nsTArray& aHints) aHints.AppendElement(LayersBackend::LAYERS_BASIC); } -void nsBaseWidget::CreateVsyncDispatcher() +void nsBaseWidget::CreateCompositorVsyncDispatcher() { if (gfxPrefs::HardwareVsyncEnabled()) { // Parent directly listens to the vsync source whereas // child process communicate via IPC // Should be called AFTER gfxPlatform is initialized if (XRE_IsParentProcess()) { - mVsyncDispatcher = new VsyncDispatcher(); + mCompositorVsyncDispatcher = new CompositorVsyncDispatcher(); } } } -VsyncDispatcher* -nsBaseWidget::GetVsyncDispatcher() +CompositorVsyncDispatcher* +nsBaseWidget::GetCompositorVsyncDispatcher() { - return mVsyncDispatcher; + return mCompositorVsyncDispatcher; } void nsBaseWidget::CreateCompositor(int aWidth, int aHeight) @@ -1008,7 +1008,7 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight) return; } - CreateVsyncDispatcher(); + CreateCompositorVsyncDispatcher(); mCompositorParent = NewCompositorParent(aWidth, aHeight); MessageChannel *parentChannel = mCompositorParent->GetIPCChannel(); nsRefPtr lm = new ClientLayerManager(this); diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index 1e3c6789f8d..991c886a7da 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -39,7 +39,7 @@ class GeckoContentController; struct ScrollableLayerGuid; } -class VsyncDispatcher; +class CompositorVsyncDispatcher; } namespace base { @@ -142,8 +142,8 @@ public: LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, bool* aAllowRetaining = nullptr); - VsyncDispatcher* GetVsyncDispatcher() MOZ_OVERRIDE; - virtual void CreateVsyncDispatcher(); + CompositorVsyncDispatcher* GetCompositorVsyncDispatcher() MOZ_OVERRIDE; + virtual void CreateCompositorVsyncDispatcher(); virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight); virtual void CreateCompositor(); virtual void CreateCompositor(int aWidth, int aHeight); @@ -426,7 +426,7 @@ protected: nsRefPtr mBasicLayerManager; nsRefPtr mCompositorChild; nsRefPtr mCompositorParent; - nsRefPtr mVsyncDispatcher; + nsRefPtr mCompositorVsyncDispatcher; nsRefPtr mAPZC; nsRefPtr mShutdownObserver; nsCursor mCursor; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 97f34cf5288..f6ebc09bbf4 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -36,7 +36,7 @@ class nsIntRegion; class nsIScreen; namespace mozilla { -class VsyncDispatcher; +class CompositorVsyncDispatcher; namespace dom { class TabChild; } @@ -692,7 +692,7 @@ class nsIWidget : public nsISupports { typedef mozilla::widget::InputContext InputContext; typedef mozilla::widget::InputContextAction InputContextAction; typedef mozilla::widget::SizeConstraints SizeConstraints; - typedef mozilla::VsyncDispatcher VsyncDispatcher; + typedef mozilla::CompositorVsyncDispatcher CompositorVsyncDispatcher; // Used in UpdateThemeGeometries. struct ThemeGeometry { @@ -872,9 +872,9 @@ class nsIWidget : public nsISupports { virtual float GetDPI() = 0; /** - * Returns the VsyncDispatcher associated with this widget + * Returns the CompositorVsyncDispatcher associated with this widget */ - virtual VsyncDispatcher* GetVsyncDispatcher() = 0; + virtual CompositorVsyncDispatcher* GetCompositorVsyncDispatcher() = 0; /** * Return the default scale factor for the window. This is the