001package Torello.Browser.BrowserAPI;
002
003// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
004// Java-HTML Imports
005// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
006
007import Torello.Browser.*;
008import Torello.Browser.helper.*;
009import Torello.Browser.JavaScriptAPI.*;
010import Torello.JSON.*;
011
012import Torello.Java.ReadOnly.ReadOnlyList;
013import Torello.Java.ReadOnly.ReadOnlyArrayList;
014
015import Torello.JavaDoc.Annotations.StaticFunctional;
016import Torello.JavaDoc.Annotations.JDHeaderBackgroundImg;
017
018import Torello.Browser.BrowserAPI.NestedHelpers.Commands.Memory$$Commands;
019
020
021// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
022// JDK Imports
023// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
024
025import javax.json.JsonObject;
026import javax.json.JsonValue;
027
028/**
029 * <SPAN CLASS=COPIEDJDK><B><CODE>[No Description Provided by Google]</CODE></B></SPAN>
030 * <EMBED CLASS='external-html' DATA-FILE-ID=CDP.CODE_GEN_NOTE>
031 */
032@StaticFunctional@JDHeaderBackgroundImg(EmbedTagFileID="CDP.WOOD_PLANK_NOTE")
033public class Memory
034{
035    // No Pubic Constructors
036    private Memory() { }
037
038
039    // ********************************************************************************************
040    // ********************************************************************************************
041    // Enumerated String Constants Lists
042    // ********************************************************************************************
043    // ********************************************************************************************
044
045
046    /**
047     * Memory pressure level.
048     * <BR /><BR /><B CLASS=StrEnumType>String-Enumeration Type</B>
049     */
050    public static final ReadOnlyList<String> PressureLevel = new ReadOnlyArrayList<>
051        (String.class, "critical", "moderate");
052
053
054
055    // ********************************************************************************************
056    // ********************************************************************************************
057    // Basic Types
058    // ********************************************************************************************
059    // ********************************************************************************************
060
061
062    /**
063     * DOM object counter data.
064     * 
065     * <EMBED CLASS=globalDefs DATA-DOMAIN=Memory DATA-API=BrowserAPI>
066     */
067    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
068    public static class DOMCounter
069        extends BaseType<DOMCounter>
070        implements java.io.Serializable
071    {
072        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
073        protected static final long serialVersionUID = 1;
074
075        private static final NestedHelper<Memory.DOMCounter> singleton =
076            Torello.Browser.BrowserAPI.NestedHelpers.Types.
077                Memory$$DOMCounter$$.singleton;
078
079        /**
080         * Object name. Note: object names should be presumed volatile and clients should not expect
081         * the returned names to be consistent across runs.
082         */
083        public final String name;
084
085        /** Object count. */
086        public final int count;
087
088        /** Constructor.  Please review this class' fields for documentation. */
089        public DOMCounter(ReadOnlyList<Boolean> isPresent, String name, int count)
090        {
091            super(singleton, Domains.Memory, "DOMCounter", 2);
092
093            this.name   = name;
094            this.count  = count;
095
096            this.isPresent = (isPresent == null)
097                ? singleton.generateIsPresentList(this)
098                : THROWS.check(isPresent, 2, "Memory.DOMCounter");
099        }
100
101        /** Creates an instance of this class from a {@link JsonObject}.*/
102        public static DOMCounter fromJSON(JsonObject jo)
103        { return singleton.fromJSON(jo); }
104
105        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
106        public static NestedDescriptor<DOMCounter> descriptor()
107        { return singleton.descriptor(); }
108    }
109
110    /**
111     * Executable module information
112     * 
113     * <EMBED CLASS=globalDefs DATA-DOMAIN=Memory DATA-API=BrowserAPI>
114     */
115    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
116    public static class Module
117        extends BaseType<Module>
118        implements java.io.Serializable
119    {
120        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
121        protected static final long serialVersionUID = 1;
122
123        private static final NestedHelper<Memory.Module> singleton =
124            Torello.Browser.BrowserAPI.NestedHelpers.Types.
125                Memory$$Module$$.singleton;
126
127        /** Name of the module. */
128        public final String name;
129
130        /** UUID of the module. */
131        public final String uuid;
132
133        /**
134         * Base address where the module is loaded into memory. Encoded as a decimal
135         * or hexadecimal (0x prefixed) string.
136         */
137        public final String baseAddress;
138
139        /** Size of the module in bytes. */
140        public final Number size;
141
142        /** Constructor.  Please review this class' fields for documentation. */
143        public Module(
144                ReadOnlyList<Boolean> isPresent, String name, String uuid, String baseAddress,
145                Number size
146            )
147        {
148            super(singleton, Domains.Memory, "Module", 4);
149
150            this.name           = name;
151            this.uuid           = uuid;
152            this.baseAddress    = baseAddress;
153            this.size           = size;
154
155            this.isPresent = (isPresent == null)
156                ? singleton.generateIsPresentList(this)
157                : THROWS.check(isPresent, 4, "Memory.Module");
158        }
159
160        /** Creates an instance of this class from a {@link JsonObject}.*/
161        public static Module fromJSON(JsonObject jo)
162        { return singleton.fromJSON(jo); }
163
164        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
165        public static NestedDescriptor<Module> descriptor()
166        { return singleton.descriptor(); }
167    }
168
169    /**
170     * Array of heap profile samples.
171     * 
172     * <EMBED CLASS=globalDefs DATA-DOMAIN=Memory DATA-API=BrowserAPI>
173     */
174    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
175    public static class SamplingProfile
176        extends BaseType<SamplingProfile>
177        implements java.io.Serializable
178    {
179        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
180        protected static final long serialVersionUID = 1;
181
182        private static final NestedHelper<Memory.SamplingProfile> singleton =
183            Torello.Browser.BrowserAPI.NestedHelpers.Types.
184                Memory$$SamplingProfile$$.singleton;
185
186        /** <CODE>[No Description Provided by Google]</CODE> */
187        public final Memory.SamplingProfileNode[] samples;
188
189        /** <CODE>[No Description Provided by Google]</CODE> */
190        public final Memory.Module[] modules;
191
192        /** Constructor.  Please review this class' fields for documentation. */
193        public SamplingProfile
194            (ReadOnlyList<Boolean> isPresent, SamplingProfileNode[] samples, Module[] modules)
195        {
196            super(singleton, Domains.Memory, "SamplingProfile", 2);
197
198            this.samples = samples;
199            this.modules = modules;
200
201            this.isPresent = (isPresent == null)
202                ? singleton.generateIsPresentList(this)
203                : THROWS.check(isPresent, 2, "Memory.SamplingProfile");
204        }
205
206        /** Creates an instance of this class from a {@link JsonObject}.*/
207        public static SamplingProfile fromJSON(JsonObject jo)
208        { return singleton.fromJSON(jo); }
209
210        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
211        public static NestedDescriptor<SamplingProfile> descriptor()
212        { return singleton.descriptor(); }
213    }
214
215    /**
216     * Heap profile sample.
217     * 
218     * <EMBED CLASS=globalDefs DATA-DOMAIN=Memory DATA-API=BrowserAPI>
219     */
220    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_TYPE_JDHBI")
221    public static class SamplingProfileNode
222        extends BaseType<SamplingProfileNode>
223        implements java.io.Serializable
224    {
225        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
226        protected static final long serialVersionUID = 1;
227
228        private static final NestedHelper<Memory.SamplingProfileNode> singleton =
229            Torello.Browser.BrowserAPI.NestedHelpers.Types.
230                Memory$$SamplingProfileNode$$.singleton;
231
232        /** Size of the sampled allocation. */
233        public final Number size;
234
235        /** Total bytes attributed to this sample. */
236        public final Number total;
237
238        /** Execution stack at the point of allocation. */
239        public final String[] stack;
240
241        /** Constructor.  Please review this class' fields for documentation. */
242        public SamplingProfileNode
243            (ReadOnlyList<Boolean> isPresent, Number size, Number total, String[] stack)
244        {
245            super(singleton, Domains.Memory, "SamplingProfileNode", 3);
246
247            this.size   = size;
248            this.total  = total;
249            this.stack  = stack;
250
251            this.isPresent = (isPresent == null)
252                ? singleton.generateIsPresentList(this)
253                : THROWS.check(isPresent, 3, "Memory.SamplingProfileNode");
254        }
255
256        /** Creates an instance of this class from a {@link JsonObject}.*/
257        public static SamplingProfileNode fromJSON(JsonObject jo)
258        { return singleton.fromJSON(jo); }
259
260        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
261        public static NestedDescriptor<SamplingProfileNode> descriptor()
262        { return singleton.descriptor(); }
263    }
264
265
266    // ********************************************************************************************
267    // ********************************************************************************************
268    // Command-Return Types
269    // ********************************************************************************************
270    // ********************************************************************************************
271
272
273    /**
274     * Retruns current DOM object counters.
275     * 
276     * <EMBED CLASS=globalDefs DATA-DOMAIN=Memory DATA-API=BrowserAPI DATA-CMD=getDOMCounters>
277     * @see Memory#getDOMCounters
278     */
279    @JDHeaderBackgroundImg(EmbedTagFileID="CDP.NESTED_CMD_JDHBI")
280    public static class getDOMCounters$$RET
281        extends BaseType<getDOMCounters$$RET>
282        implements java.io.Serializable
283    {
284        /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
285        protected static final long serialVersionUID = 1;
286
287        private static final NestedHelper<Memory.getDOMCounters$$RET> singleton =
288            Torello.Browser.BrowserAPI.NestedHelpers.CmdReturns.
289                Memory$$getDOMCounters$$RET.singleton;
290
291        /** <CODE>[No Description Provided by Google]</CODE> */
292        public final int documents;
293
294        /** <CODE>[No Description Provided by Google]</CODE> */
295        public final int nodes;
296
297        /** <CODE>[No Description Provided by Google]</CODE> */
298        public final int jsEventListeners;
299
300        /** Constructor.  Please review this class' fields for documentation. */
301        public getDOMCounters$$RET
302            (ReadOnlyList<Boolean> isPresent, int documents, int nodes, int jsEventListeners)
303        {
304            super(singleton, Domains.Memory, "getDOMCounters", 3);
305
306            this.documents          = documents;
307            this.nodes              = nodes;
308            this.jsEventListeners   = jsEventListeners;
309
310            this.isPresent = (isPresent == null)
311                ? singleton.generateIsPresentList(this)
312                : THROWS.check(isPresent, 3, "Memory.getDOMCounters$$RET");
313        }
314
315        /** Creates an instance of this class from a {@link JsonObject}.*/
316        public static getDOMCounters$$RET fromJSON(JsonObject jo)
317        { return singleton.fromJSON(jo); }
318
319        /** Returns this class's {@link NestedDescriptor} singleton-instance. class / type.*/
320        public static NestedDescriptor<getDOMCounters$$RET> descriptor()
321        { return singleton.descriptor(); }
322    }
323
324
325
326
327    // ********************************************************************************************
328    // ********************************************************************************************
329    // Commands
330    // ********************************************************************************************
331    // ********************************************************************************************
332
333
334    /**
335     * Simulate OomIntervention by purging V8 memory.
336     * 
337     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
338     *
339     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
340     * browser receives the invocation-request.
341     *
342     * <BR /><BR /><DIV CLASS=JDHint>
343     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
344     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
345     * the Browser Function has run to completion.
346     * </DIV>
347     */
348    public static Script<Void> forciblyPurgeJavaScriptMemory()
349    {
350        // Ultra-Simple Request JSON - Because this method has no parameters
351        final String requestJSON = "{\"method\":\"Memory.forciblyPurgeJavaScriptMemory\"}";
352
353        return Script.NO_RET(Domains.Memory, "forciblyPurgeJavaScriptMemory", requestJSON);
354    }
355
356    /**
357     * Retrieve native memory allocations profile
358     * collected since renderer process startup.
359     * 
360     * @return An instance of <CODE>{@link Script}&lt;{@link Memory.SamplingProfile}&gt;</CODE>
361     * 
362     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
363     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
364     * <CODE>&lt;{@link Memory.SamplingProfile}&gt;</CODE> will be returned
365     *
366     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
367     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
368     * be retrieved.</I>
369     *
370     * <BR /><BR /><DIV CLASS=JDHint>
371     * This Browser Function's {@code Promise} returns:
372     * <CODE>{@link Memory.SamplingProfile} (<B>profile</B>)</CODE>
373     * </DIV>
374     */
375    public static Script<Memory.SamplingProfile> getAllTimeSamplingProfile()
376    {
377        // Ultra-Simple Request JSON - Because this method has no parameters
378        final String requestJSON = "{\"method\":\"Memory.getAllTimeSamplingProfile\"}";
379
380        return new Script<>(
381            Domains.Memory, "getAllTimeSamplingProfile", requestJSON,
382            Memory$$Commands::getAllTimeSamplingProfile,
383            Memory.SamplingProfile.class
384        );
385    }
386
387    /**
388     * Retrieve native memory allocations profile
389     * collected since browser process startup.
390     * 
391     * @return An instance of <CODE>{@link Script}&lt;{@link Memory.SamplingProfile}&gt;</CODE>
392     * 
393     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
394     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
395     * <CODE>&lt;{@link Memory.SamplingProfile}&gt;</CODE> will be returned
396     *
397     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
398     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
399     * be retrieved.</I>
400     *
401     * <BR /><BR /><DIV CLASS=JDHint>
402     * This Browser Function's {@code Promise} returns:
403     * <CODE>{@link Memory.SamplingProfile} (<B>profile</B>)</CODE>
404     * </DIV>
405     */
406    public static Script<Memory.SamplingProfile> getBrowserSamplingProfile()
407    {
408        // Ultra-Simple Request JSON - Because this method has no parameters
409        final String requestJSON = "{\"method\":\"Memory.getBrowserSamplingProfile\"}";
410
411        return new Script<>(
412            Domains.Memory, "getBrowserSamplingProfile", requestJSON,
413            Memory$$Commands::getBrowserSamplingProfile,
414            Memory.SamplingProfile.class
415        );
416    }
417
418    /**
419     * Retruns current DOM object counters.
420     * 
421     * @return An instance of <CODE>{@link Script}&lt;{@link getDOMCounters$$RET}&gt;</CODE>
422     * 
423     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
424     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
425     * <CODE>&lt;{@link getDOMCounters$$RET}&gt;</CODE> will be returned
426     *
427     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
428     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
429     * be retrieved.</I>
430     *
431     * <BR /><BR /><DIV CLASS=JDHint>
432     * This Browser Function's {@code Promise} returns:{@link getDOMCounters$$RET}
433     * A dedicated return type implies that the browser may return more than 1 datum
434     * </DIV>
435     */
436    public static Script<getDOMCounters$$RET> getDOMCounters()
437    {
438        // Ultra-Simple Request JSON - Because this method has no parameters
439        final String requestJSON = "{\"method\":\"Memory.getDOMCounters\"}";
440
441        return new Script<>(
442            Domains.Memory, "getDOMCounters", requestJSON,
443            getDOMCounters$$RET::fromJSON,
444            getDOMCounters$$RET.class
445        );
446    }
447
448    /**
449     * Retruns DOM object counters after preparing renderer for leak detection.
450     * 
451     * @return An instance of <CODE>{@link Script}&lt;{@link Memory.DOMCounter}[]&gt;</CODE>
452     * 
453     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
454     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
455     * <CODE>&lt;{@link Memory.DOMCounter}[]&gt;</CODE> will be returned
456     *
457     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
458     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
459     * be retrieved.</I>
460     *
461     * <BR /><BR /><DIV CLASS=JDHint>
462     * This Browser Function's {@code Promise} returns:
463     * <CODE>{@link Memory.DOMCounter}[] (<B>counters</B>)</CODE>
464     * <BR />
465     * DOM object counters.
466     * </DIV>
467     */
468    public static Script<Memory.DOMCounter[]> getDOMCountersForLeakDetection()
469    {
470        // Ultra-Simple Request JSON - Because this method has no parameters
471        final String requestJSON = "{\"method\":\"Memory.getDOMCountersForLeakDetection\"}";
472
473        return new Script<>(
474            Domains.Memory, "getDOMCountersForLeakDetection", requestJSON,
475            Memory$$Commands::getDOMCountersForLeakDetection,
476            Memory.DOMCounter[].class
477        );
478    }
479
480    /**
481     * Retrieve native memory allocations profile collected since last
482     * <CODE>startSampling</CODE> call.
483     * 
484     * @return An instance of <CODE>{@link Script}&lt;{@link Memory.SamplingProfile}&gt;</CODE>
485     * 
486     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
487     * {@link Script#exec(WebSocketSender) Script.exec}, and afterwards, a {@link Promise}
488     * <CODE>&lt;{@link Memory.SamplingProfile}&gt;</CODE> will be returned
489     *
490     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
491     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
492     * be retrieved.</I>
493     *
494     * <BR /><BR /><DIV CLASS=JDHint>
495     * This Browser Function's {@code Promise} returns:
496     * <CODE>{@link Memory.SamplingProfile} (<B>profile</B>)</CODE>
497     * </DIV>
498     */
499    public static Script<Memory.SamplingProfile> getSamplingProfile()
500    {
501        // Ultra-Simple Request JSON - Because this method has no parameters
502        final String requestJSON = "{\"method\":\"Memory.getSamplingProfile\"}";
503
504        return new Script<>(
505            Domains.Memory, "getSamplingProfile", requestJSON,
506            Memory$$Commands::getSamplingProfile,
507            Memory.SamplingProfile.class
508        );
509    }
510
511    /**
512     * Prepares for leak detection by terminating workers, stopping spellcheckers,
513     * dropping non-essential internal caches, running garbage collections, etc.
514     * 
515     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
516     *
517     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
518     * browser receives the invocation-request.
519     *
520     * <BR /><BR /><DIV CLASS=JDHint>
521     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
522     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
523     * the Browser Function has run to completion.
524     * </DIV>
525     */
526    public static Script<Void> prepareForLeakDetection()
527    {
528        // Ultra-Simple Request JSON - Because this method has no parameters
529        final String requestJSON = "{\"method\":\"Memory.prepareForLeakDetection\"}";
530
531        return Script.NO_RET(Domains.Memory, "prepareForLeakDetection", requestJSON);
532    }
533
534    /**
535     * Enable/disable suppressing memory pressure notifications in all processes.
536     * 
537     * @param suppressed If true, memory pressure notifications will be suppressed.
538     * 
539     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
540     *
541     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
542     * browser receives the invocation-request.
543     *
544     * <BR /><BR /><DIV CLASS=JDHint>
545     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
546     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
547     * the Browser Function has run to completion.
548     * </DIV>
549     */
550    public static Script<Void> setPressureNotificationsSuppressed(boolean suppressed)
551    {
552        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
553        final String requestJSON = WriteJSON.get(
554            CDPTypes.PRIMITIVE_BOOLEAN, "suppressed", false,
555            "Memory.setPressureNotificationsSuppressed", suppressed
556        );
557
558        return Script.NO_RET(Domains.Memory, "setPressureNotificationsSuppressed", requestJSON);
559    }
560
561    /**
562     * Simulate a memory pressure notification in all processes.
563     * 
564     * @param level Memory pressure level of the notification.
565     * 
566     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
567     *
568     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
569     * browser receives the invocation-request.
570     *
571     * <BR /><BR /><DIV CLASS=JDHint>
572     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
573     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
574     * the Browser Function has run to completion.
575     * </DIV>
576     */
577    public static Script<Void> simulatePressureNotification(String level)
578    {
579        // Build the JSON Request-Object (as a String); only 1 Parameter is passed
580        final String requestJSON = WriteJSON.get
581            (CDPTypes.STRING, "level", false, "Memory.simulatePressureNotification", level);
582
583        return Script.NO_RET(Domains.Memory, "simulatePressureNotification", requestJSON);
584    }
585
586    /**
587     * Start collecting native memory profile.
588     * 
589     * @param samplingInterval Average number of bytes between samples.
590     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
591     * 
592     * @param suppressRandomness Do not randomize intervals between samples.
593     * <BR /><B CLASS=Opt-Top>OPTIONAL</B>
594     * 
595     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
596     *
597     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
598     * browser receives the invocation-request.
599     *
600     * <BR /><BR /><DIV CLASS=JDHint>
601     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
602     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
603     * the Browser Function has run to completion.
604     * </DIV>
605     */
606    public static Script<Void> startSampling(Integer samplingInterval, Boolean suppressRandomness)
607    {
608        // Convert all Method Parameters into a JSON Request-Object (as a String)
609        final String requestJSON = WriteJSON.get(
610            Memory$$Commands.startSampling$$, "Memory.startSampling",
611            samplingInterval, suppressRandomness
612        );
613
614        return Script.NO_RET(Domains.Memory, "startSampling", requestJSON);
615    }
616
617    /**
618     * Stop collecting native memory profile.
619     * 
620     * @return An instance of <CODE>{@link Script}&lt;Void&gt;</CODE>
621     *
622     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
623     * browser receives the invocation-request.
624     *
625     * <BR /><BR /><DIV CLASS=JDHint>
626     * This Browser-Function <I>does not have</I> a return-value.  You may choose to
627     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <Void>} to ensure that
628     * the Browser Function has run to completion.
629     * </DIV>
630     */
631    public static Script<Void> stopSampling()
632    {
633        // Ultra-Simple Request JSON - Because this method has no parameters
634        final String requestJSON = "{\"method\":\"Memory.stopSampling\"}";
635
636        return Script.NO_RET(Domains.Memory, "stopSampling", requestJSON);
637    }
638
639
640}