WorkerIPCUtils.h (1356B)
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 #ifndef _mozilla_dom_WorkerIPCUtils_h 7 #define _mozilla_dom_WorkerIPCUtils_h 8 9 #include "mozilla/dom/BindingIPCUtils.h" 10 11 // For RequestCredentials 12 #include "mozilla/dom/FetchIPCTypes.h" 13 14 // Undo X11/X.h's definition of None 15 #undef None 16 17 #include "mozilla/dom/WorkerBinding.h" 18 19 namespace IPC { 20 21 template <> 22 struct ParamTraits<mozilla::dom::WorkerType> 23 : public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::WorkerType> {}; 24 25 template <> 26 struct ParamTraits<mozilla::dom::WorkerOptions> { 27 typedef mozilla::dom::WorkerOptions paramType; 28 29 static void Write(MessageWriter* aWriter, const paramType& aParam) { 30 WriteParam(aWriter, aParam.mType); 31 WriteParam(aWriter, aParam.mCredentials); 32 WriteParam(aWriter, aParam.mName); 33 } 34 35 static bool Read(MessageReader* aReader, paramType* aResult) { 36 return ReadParam(aReader, &aResult->mType) && 37 ReadParam(aReader, &aResult->mCredentials) && 38 ReadParam(aReader, &aResult->mName); 39 } 40 }; 41 42 } // namespace IPC 43 44 #endif // _mozilla_dom_WorkerIPCUtils_h