Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  JSIPCValueUtils.h

  Sprache: C
 

/* 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_DOM_IPC_JSACTOR_JSIPCVALUEUTILS_H_
#define MOZILLA_DOM_IPC_JSACTOR_JSIPCVALUEUTILS_H_

#include "js/RootingAPI.h"
#include "js/Value.h"
#include "jstypes.h"
#include "mozilla/Maybe.h"
#include "mozilla/dom/JSActor.h"
#include "mozilla/dom/JSIPCValue.h"

// This file contains a number of useful methods for JSIPCValue, mostly dealing
// with turning it to and from a JS value.

namespace mozilla::dom {

// Return true if a message for an actor with the given name should be
// sent typed.
bool JSActorSupportsTypedSend(const nsACString& aName);

class JSIPCValueUtils {
 public:
  struct Context {
    explicit Context(JSContext* aCx, bool aStrict = true)
        : mCx(aCx), mStrict(aStrict) {}

    MOZ_IMPLICIT operator JSContext*() const { return mCx; }

    JSContext* mCx;

    // If we encounter a JS value that can't be directly serialized to
    // JSIPCValue, we fall back to using structured cloning. mStrict
    // determines the behavior if this structured cloning fails. If mStrict is
    // true, then the entire serialization will fail. If it is false, we'll
    // instead serialize to a fallback value. See UntypedFromJSVal for details.
    bool mStrict;
  };

  // Convert a JS value to an IPDL representation of that value, or return
  // Nothing if the value isn't supported. If aSendTyped is false, the result
  // will always just be a wrapper around a StructuredCloneData.
  static JSIPCValue FromJSVal(Context& aCx, JS::Handle<JS::Value> aVal,
                              bool aSendTyped, ErrorResult& aError);

  // Same as the above, except with support for a transfers object, if needed.
  static JSIPCValue FromJSVal(Context& aCx, JS::Handle<JS::Value> aVal,
                              JS::Handle<JS::Value> aTransferable,
                              bool aSendTyped, ErrorResult& aError);

  // This is equivalent to calling FromJSVal with aSendTyped equal to true.
  static JSIPCValue TypedFromJSVal(Context& aCx, JS::Handle<JS::Value> aVal,
                                   ErrorResult& aError);

  // Convert the IPDL representation of a JS value back into the equivalent
  // JS value. This will return false on failure.
  static void ToJSVal(JSContext* aCx, JSIPCValue&& aIn,
                      JS::MutableHandle<JS::Value> aOut, ErrorResult& aError);
};

}  // namespace mozilla::dom

#endif  // MOZILLA_DOM_IPC_JSACTOR_JSIPCVALUEUTILS_H_

Messung V0.5 in Prozent
C=93 H=98 G=95

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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 und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=141584
#Domains=752002