author Greyson Gilbert <greyson.gilbert.oss@gmail.com>
Tue, 30 Jul 2019 23:32:29 +0000
changeset 549189 6019fc32fbf36e44a00248aa12f94c6f111a9213
parent 539898 325b4a93e95a609fec789dd015c8c84dead86499
permissions -rw-r--r--
Bug 1564293 - Allow efficient slicewise upload of 3D textures r=jgilbert Before this patch any partial upload to a texture would incur a zeroing of the texture first to prevent leakage of information. The texture now tracks, for each image not fully initialized, which z-slices have been initialized, and only zeroes the rest of the slices when the texture is used. Differential Revision: https://phabricator.services.mozilla.com/D37843

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * 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 mozilla_ComposerCommandsUpdater_h
#define mozilla_ComposerCommandsUpdater_h

#include "nsCOMPtr.h"  // for already_AddRefed, nsCOMPtr
#include "nsCycleCollectionParticipant.h"
#include "nsIDocumentStateListener.h"
#include "nsINamed.h"
#include "nsISupportsImpl.h"         // for NS_DECL_ISUPPORTS
#include "nsITimer.h"                // for NS_DECL_NSITIMERCALLBACK, etc
#include "nsITransactionListener.h"  // for nsITransactionListener
#include "nscore.h"                  // for NS_IMETHOD, nsresult, etc

class nsCommandManager;
class nsIDocShell;
class nsITransaction;
class nsITransactionManager;
class nsPIDOMWindowOuter;

namespace mozilla {

class ComposerCommandsUpdater final : public nsIDocumentStateListener,
                                      public nsITransactionListener,
                                      public nsITimerCallback,
                                      public nsINamed {

  // nsISupports

  // nsIDocumentStateListener

  // nsITimerCallback

  // nsINamed

  // nsITransactionListener

  void Init(nsPIDOMWindowOuter& aDOMWindow);

   * OnSelectionChange() is called when selection is changed in the editor.
  void OnSelectionChange() { PrimeUpdateTimer(); }

  virtual ~ComposerCommandsUpdater();

  enum {
    eStateUninitialized = -1,
    eStateOff = 0,
    eStateOn = 1,

  bool SelectionIsCollapsed();
  nsresult UpdateDirtyState(bool aNowDirty);
  nsresult UpdateOneCommand(const char* aCommand);
  nsresult UpdateCommandGroup(const nsAString& aCommandGroup);

  nsCommandManager* GetCommandManager();

  nsresult PrimeUpdateTimer();
  void TimerCallback();

  nsCOMPtr<nsITimer> mUpdateTimer;
  nsCOMPtr<nsPIDOMWindowOuter> mDOMWindow;
  nsCOMPtr<nsIDocShell> mDocShell;

  int8_t mDirtyState;
  int8_t mSelectionCollapsed;
  bool mFirstDoOfFirstUndo;

}  // namespace mozilla

#endif  // #ifndef mozilla_ComposerCommandsUpdater_h