Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / js / src / vm / SourceHook.cpp
blob59d0b74c71b9405a8134df0a0f9d42ac8b295566
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/. */
7 #include "js/experimental/SourceHook.h"
9 #include "mozilla/UniquePtr.h" // mozilla::UniquePtr
11 #include <utility> // std::move
13 #include "jstypes.h" // JS_PUBLIC_API
15 #include "vm/JSContext.h" // JSContext
16 #include "vm/Runtime.h" // JSRuntime
18 JS_PUBLIC_API void js::SetSourceHook(JSContext* cx,
19 mozilla::UniquePtr<SourceHook> hook) {
20 cx->runtime()->sourceHook.ref() = std::move(hook);
23 JS_PUBLIC_API mozilla::UniquePtr<js::SourceHook> js::ForgetSourceHook(
24 JSContext* cx) {
25 return std::move(cx->runtime()->sourceHook.ref());