/// <summary>
 ///     Starts profiling in the current context.
 /// </summary>
 /// <remarks>
 ///     Requires an active script context.
 /// </remarks>
 /// <param name="callback">The profiling callback to use.</param>
 /// <param name="eventMask">The profiling events to callback with.</param>
 /// <param name="context">A context to pass to the profiling callback.</param>
 public static void StartProfiling(Native.IActiveScriptProfilerCallback callback, Native.ProfilerEventMask eventMask, int context)
 {
     Native.ThrowIfError(Native.JsStartProfiling(callback, eventMask, context));
 }
Beispiel #2
0
 public void OnFunctionExitByName(string pwszFunctionName, Native.ProfilerScriptType type)
 {
     Console.WriteLine("Profiler.OnFunctionExitByName: {0}, {1}", pwszFunctionName, type);
 }
Beispiel #3
0
 public void ScriptCompiled(int scriptId, Native.ProfilerScriptType type, IntPtr pIDebugDocumentContext)
 {
     Console.WriteLine("Profiler.ScriptCompiled: {0}, {1}", scriptId, type);
 }
Beispiel #4
0
 /// <summary>
 ///     Sets a memory allocation callback for specified runtime
 /// </summary>
 /// <remarks>
 ///     <para>
 ///         Registering a memory allocation callback will cause the runtime to call back to the host
 ///         whenever it acquires memory from, or releases memory to, the OS. The callback routine is
 ///         called before the runtime memory manager allocates a block of memory. The allocation will
 ///         be rejected if the callback returns false. The runtime memory manager will also invoke the
 ///         callback routine after freeing a block of memory, as well as after allocation failures.
 ///     </para>
 ///     <para>
 ///         The callback is invoked on the current runtime execution thread, therefore execution is
 ///         blocked until the callback completes.
 ///     </para>
 ///     <para>
 ///         The return value of the callback is not stored; previously rejected allocations will not
 ///         prevent the runtime from invoking the callback again later for new memory allocations.
 ///     </para>
 /// </remarks>
 /// <param name="callbackState">
 ///     User provided state that will be passed back to the callback.
 /// </param>
 /// <param name="allocationCallback">
 ///     Memory allocation callback to be called for memory allocation events.
 /// </param>
 public void SetMemoryAllocationCallback(IntPtr callbackState,
                                         JavaScriptMemoryAllocationCallback allocationCallback)
 {
     Native.ThrowIfError(Native.JsSetRuntimeMemoryAllocationCallback(this, callbackState, allocationCallback));
 }
Beispiel #5
0
 /// <summary>
 ///     Sets a callback function that is called by the runtime before garbage collection.
 /// </summary>
 /// <remarks>
 ///     <para>
 ///         The callback is invoked on the current runtime execution thread, therefore execution is
 ///         blocked until the callback completes.
 ///     </para>
 ///     <para>
 ///         The callback can be used by hosts to prepare for garbage collection. For example, by
 ///         releasing unnecessary references on Chakra objects.
 ///     </para>
 /// </remarks>
 /// <param name="callbackState">
 ///     User provided state that will be passed back to the callback.
 /// </param>
 /// <param name="beforeCollectCallback">The callback function being set.</param>
 public void SetBeforeCollectCallback(IntPtr callbackState, JavaScriptBeforeCollectCallback beforeCollectCallback)
 {
     Native.ThrowIfError(Native.JsSetRuntimeBeforeCollectCallback(this, callbackState, beforeCollectCallback));
 }
Beispiel #6
0
 /// <summary>
 ///     Delete the value at the specified index of an object.
 /// </summary>
 /// <remarks>
 ///     Requires an active script context.
 /// </remarks>
 /// <param name="index">The index to delete.</param>
 public void DeleteIndexedProperty(JavaScriptValue index)
 {
     Native.ThrowIfError(Native.JsDeleteIndexedProperty(this, index));
 }
Beispiel #7
0
 /// <summary>
 ///     Performs a full garbage collection.
 /// </summary>
 public void CollectGarbage()
 {
     Native.ThrowIfError(Native.JsCollectGarbage(this));
 }
Beispiel #8
0
 /// <summary>
 ///     Set the value at the specified index of an object.
 /// </summary>
 /// <remarks>
 ///     Requires an active script context.
 /// </remarks>
 /// <param name="index">The index to set.</param>
 /// <param name="value">The value to set.</param>
 public void SetIndexedProperty(JavaScriptValue index, JavaScriptValue value)
 {
     Native.ThrowIfError(Native.JsSetIndexedProperty(this, index, value));
 }
Beispiel #9
0
 /// <summary>
 ///     Sets an object's property.
 /// </summary>
 /// <remarks>
 ///     Requires an active script context.
 /// </remarks>
 /// <param name="id">The ID of the property.</param>
 /// <param name="value">The new value of the property.</param>
 /// <param name="useStrictRules">The property set should follow strict mode rules.</param>
 public void SetProperty(JavaScriptPropertyId id, JavaScriptValue value, bool useStrictRules)
 {
     Native.ThrowIfError(Native.JsSetProperty(this, id, value, useStrictRules));
 }
Beispiel #10
0
 /// <summary>
 ///     Sets an object to not be extensible.
 /// </summary>
 /// <remarks>
 ///     Requires an active script context.
 /// </remarks>
 public void PreventExtension()
 {
     Native.ThrowIfError(Native.JsPreventExtension(this));
 }
 /// <summary>
 ///     Creates a debug script context for running scripts.
 /// </summary>
 /// <remarks>
 ///     Each script context has its own global object that is isolated from all other script 
 ///     contexts.
 /// </remarks>
 /// <param name="debugApplication">The debug application to use.</param>
 /// <returns>The created script context.</returns>
 public JavaScriptContext CreateContext(Native.IDebugApplication32 debugApplication)
 {
     JavaScriptContext reference;
     if (Environment.Is64BitProcess)
     {
         throw new InvalidOperationException();
     }
     Native.ThrowIfError(Native.JsCreateContext(this, debugApplication, out reference));
     return reference;
 }
 /// <summary>
 ///     Starts debugging in the context.
 /// </summary>
 /// <param name="debugApplication">The debug application to use for debugging.</param>
 public static void StartDebugging(Native.IDebugApplication32 debugApplication)
 {
     if (Environment.Is64BitProcess)
     {
         throw new InvalidOperationException();
     }
     Native.ThrowIfError(Native.JsStartDebugging(debugApplication));
 }