/* -*- 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/. */
using mozilla::dom::ContentParent; using mozilla::ipc::IPCResult;
namespace mozilla {
namespace {
class ClipboardGetDataCallback final : public nsIAsyncClipboardRequestCallback { public: explicit ClipboardGetDataCallback(std::function<void(nsresult)>&& aCallback)
: mCallback(std::move(aCallback)) {}
// This object will never be held by a cycle-collected object, so it doesn't // need to be cycle-collected despite holding alive cycle-collected objects.
NS_DECL_ISUPPORTS
MOZ_TRY(trans->Init(nullptr)); // The private flag is only used to prevent the data from being cached to the // disk. The flag is not exported to the IPCDataTransfer object. // The flag is set because we are not sure whether the clipboard data is used // in a private browsing context. The transferable is only used in this scope, // so the cache would not reduce memory consumption anyway.
trans->SetIsPrivateData(true); // Fill out flavors for transferable for (uint32_t t = 0; t < aTypes.Length(); t++) {
MOZ_TRY(trans->AddDataFlavor(aTypes[t].get()));
}
IPCResult ClipboardReadRequestParent::RecvGetDataSync( const nsTArray<nsCString>& aFlavors,
dom::IPCTransferableDataOrError* aTransferableDataOrError) { auto destroySoon = [&] { // Delete this actor, but don't do it in the middle of this sync IPC call // Make sure nothing else gets processed before this deletion, so use // DispatchDirectTaskToCurrentThread()
RefPtr<nsIRunnable> task = NS_NewRunnableFunction( "ClipboardReadRequestParent_SyncError", [self = RefPtr{this}]() {
Unused << PClipboardReadRequestParent::Send__delete__(self);
});
nsThreadManager::get().DispatchDirectTaskToCurrentThread(task);
};
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.