/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */
/** * Abstract base class for something which watches an fd and takes action when * we can read from it without blocking.
*/ class FdWatcher : public MessageLoopForIO::Watcher, public nsIObserver { protected:
MessageLoopForIO::FileDescriptorWatcher mReadWatcher; int mFd;
virtual ~FdWatcher() { // StopWatching should have run.
MOZ_ASSERT(mFd == -1);
}
/** * Open the fd to watch. If we encounter an error, return -1.
*/ virtualint OpenFd() = 0;
/** * Called when you can read() from the fd without blocking. Note that this * function is also called when you're at eof (read() returns 0 in this case).
*/ virtualvoid OnFileCanReadWithoutBlocking(int aFd) override = 0; virtualvoid OnFileCanWriteWithoutBlocking(int aFd) override {};
NS_DECL_THREADSAFE_ISUPPORTS
/** * Initialize this object. This should be called right after the object is * constructed. (This would go in the constructor, except we interact with * XPCOM, which we can't do from a constructor because our refcount is 0 at * that point.)
*/ void Init();
// Implementations may call this function multiple times if they ensure that
virtualvoid StartWatching();
// Since implementations can call StartWatching() multiple times, they can of // course call StopWatching() multiple times. virtualvoid StopWatching();
class FifoWatcher : public FdWatcher { public: /** * The name of the preference used to enable/disable the FifoWatcher.
*/ // The length of this array must match the size of the string constant in // the definition in nsDumpUtils.cpp. A mismatch will result in a compile-time // error. staticconstchar kPrefName[38];
class nsDumpUtils { public: enum Mode { CREATE, CREATE_UNIQUE };
/** * This function creates a new unique file based on |aFilename| in a * world-readable temp directory. This is the system temp directory * or, in the case of Android, the downloads directory. If |aFile| is * non-null, it is assumed to point to a folder, and that folder is used * instead.
*/ static nsresult OpenTempFile(const nsACString& aFilename, nsIFile** aFile, const nsACString& aFoldername = ""_ns,
Mode aMode = CREATE_UNIQUE);
};
#endif
¤ Dauer der Verarbeitung: 0.33 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.