tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TaintingIPCUtils.h (1002B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_ipc_Tainting_h
      8 #define mozilla_ipc_Tainting_h
      9 
     10 #include "mozilla/Tainting.h"
     11 
     12 #include "chrome/common/ipc_message_utils.h"
     13 
     14 namespace IPC {
     15 
     16 template <typename T>
     17 struct ParamTraits<mozilla::Tainted<T>> {
     18  static void Write(MessageWriter* aWriter, const mozilla::Tainted<T>& aParam) {
     19    WriteParam(aWriter, aParam.mValue);
     20  }
     21 
     22  static void Write(MessageWriter* aWriter, mozilla::Tainted<T>&& aParam) {
     23    WriteParam(aWriter, std::move(aParam.mValue));
     24  }
     25 
     26  static bool Read(MessageReader* aReader, mozilla::Tainted<T>* aResult) {
     27    return ReadParam(aReader, &(aResult->mValue));
     28  }
     29 };
     30 
     31 }  // namespace IPC
     32 
     33 #endif  // ifndef mozilla_ipc_Tainting_h