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 #include "js/experimental/SourceHook.h" 8 9 #include "mozilla/UniquePtr.h" // mozilla::UniquePtr 10 11 #include <utility> // std::move 12 13 #include "jstypes.h" // JS_PUBLIC_API 14 15 #include "vm/JSContext.h" // JSContext 16 #include "vm/Runtime.h" // JSRuntime 17 SetSourceHook(JSContext * cx,mozilla::UniquePtr<SourceHook> hook)18JS_PUBLIC_API void js::SetSourceHook(JSContext* cx, 19 mozilla::UniquePtr<SourceHook> hook) { 20 cx->runtime()->sourceHook.ref() = std::move(hook); 21 } 22 ForgetSourceHook(JSContext * cx)23JS_PUBLIC_API mozilla::UniquePtr<js::SourceHook> js::ForgetSourceHook( 24 JSContext* cx) { 25 return std::move(cx->runtime()->sourceHook.ref()); 26 } 27