Commit aa0afc9d authored by Markus Stange's avatar Markus Stange
Browse files

Bug 598482 part 5 - Remove support for event-based invalidation flushing. r=roc

parent 12934e68
Loading
Loading
Loading
Loading
+1 −42
Original line number Diff line number Diff line
@@ -80,21 +80,6 @@

#define NSCOORD_NONE      PR_INT32_MIN

void
nsViewManager::PostInvalidateEvent()
{
  NS_ASSERTION(IsRootVM(), "Caller screwed up");

  if (!mInvalidateEvent.IsPending()) {
    nsRefPtr<nsInvalidateEvent> ev = new nsInvalidateEvent(this);
    if (NS_FAILED(NS_DispatchToCurrentThread(ev))) {
      NS_WARNING("failed to dispatch nsInvalidateEvent");
    } else {
      mInvalidateEvent = ev;
    }
  }
}

#undef DEBUG_MOUSE_LOCATION

PRInt32 nsViewManager::mVMCount = 0;
@@ -132,10 +117,6 @@ nsViewManager::~nsViewManager()
    mRootView = nsnull;
  }

  // Make sure to revoke pending events for all viewmanagers, since some events
  // are posted by a non-root viewmanager.
  mInvalidateEvent.Revoke();
  
  if (!IsRootVM()) {
    // We have a strong ref to mRootViewManager
    NS_RELEASE(mRootViewManager);
@@ -1387,11 +1368,7 @@ void nsViewManager::TriggerRefresh(PRUint32 aUpdateFlags)
  if (mUpdateBatchCnt > 0)
    return;

  if (!mHasPendingUpdates) {
    // Nothing to do
  } else if (aUpdateFlags & NS_VMREFRESH_DEFERRED) {
    PostInvalidateEvent();
  } else { // NO_SYNC
  if (mHasPendingUpdates) {
    FlushPendingInvalidates();
  }
}
@@ -1531,24 +1508,6 @@ nsViewManager::CallDidPaintOnObservers()
  }
}

void
nsViewManager::ProcessInvalidateEvent()
{
  NS_ASSERTION(IsRootVM(),
               "Incorrectly targeted invalidate event");
  // If we're in the middle of an update batch, just repost the event,
  // to be processed when the batch ends.
  bool processEvent = (mUpdateBatchCnt == 0);
  if (processEvent) {
    FlushPendingInvalidates();
  }
  mInvalidateEvent.Forget();
  if (!processEvent) {
    // We didn't actually process this event... post a new one
    PostInvalidateEvent();
  }
}

NS_IMETHODIMP
nsViewManager::GetLastUserEventTime(PRUint32& aTime)
{
+0 −23
Original line number Diff line number Diff line
@@ -81,8 +81,6 @@
   Composite() calls should also be forwarded to the root view manager.
*/

class nsInvalidateEvent;

class nsViewManager : public nsIViewManager {
public:
  nsViewManager();
@@ -142,7 +140,6 @@ public:
 
  NS_IMETHOD IsPainting(bool& aIsPainting);
  NS_IMETHOD GetLastUserEventTime(PRUint32& aTime);
  void ProcessInvalidateEvent();
  static PRUint32 gLastUserEventTime;

  /* Update the cached RootViewManager pointer on this view manager. */
@@ -259,8 +256,6 @@ private:
  // never null (if we have no ancestors, it will be |this|).
  nsViewManager     *mRootViewManager;

  nsRevocableEventPtr<nsInvalidateEvent> mInvalidateEvent;

  // The following members should not be accessed directly except by
  // the root view manager.  Some have accessor functions to enforce
  // this, as noted.
@@ -281,24 +276,6 @@ private:

  //list of view managers
  static nsVoidArray       *gViewManagers;

  void PostInvalidateEvent();
};

class nsInvalidateEvent : public nsRunnable {
public:
  nsInvalidateEvent(class nsViewManager *vm) : mViewManager(vm) {
    NS_ASSERTION(mViewManager, "null parameter");
  }
  void Revoke() { mViewManager = nsnull; }

  NS_IMETHOD Run() {
    if (mViewManager)
      mViewManager->ProcessInvalidateEvent();
    return NS_OK;
  }
protected:
  class nsViewManager *mViewManager;
};

#endif /* nsViewManager_h___ */