CodeCoverage.h (1526B)
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 js_experimental_CodeCoverage_h 8 #define js_experimental_CodeCoverage_h 9 10 #include "jstypes.h" // JS_PUBLIC_API 11 #include "js/Utility.h" // JS::UniqueChars 12 13 struct JS_PUBLIC_API JSContext; 14 15 namespace js { 16 17 /** 18 * Enable the collection of lcov code coverage metrics. 19 * Must be called before a runtime is created and before any calls to 20 * GetCodeCoverageSummary. 21 */ 22 extern JS_PUBLIC_API void EnableCodeCoverage(); 23 24 /** 25 * Generate lcov trace file content for the current realm, and allocate a new 26 * buffer and return the content in it, the size of the newly allocated content 27 * within the buffer would be set to the length out-param. The 'All' variant 28 * will collect data for all realms in the runtime. 29 * 30 * In case of out-of-memory, this function returns nullptr. The length 31 * out-param is undefined on failure. 32 */ 33 extern JS_PUBLIC_API JS::UniqueChars GetCodeCoverageSummary(JSContext* cx, 34 size_t* length); 35 extern JS_PUBLIC_API JS::UniqueChars GetCodeCoverageSummaryAll(JSContext* cx, 36 size_t* length); 37 38 } // namespace js 39 40 #endif // js_experimental_CodeCoverage_h