# frozen_string_literal: true # Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # This file is automatically generated. Any changes will be lost! module Selenium module DevTools module V101 class HeapProfiler EVENTS = { add_heap_snapshot_chunk: 'addHeapSnapshotChunk', heap_stats_update: 'heapStatsUpdate', last_seen_object_id: 'lastSeenObjectId', report_heap_snapshot_progress: 'reportHeapSnapshotProgress', reset_profiles: 'resetProfiles', }.freeze def initialize(devtools) @devtools = devtools end def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["HeapProfiler.#{event}"] << block end def add_inspected_heap_object(heap_object_id:) @devtools.send_cmd('HeapProfiler.addInspectedHeapObject', heapObjectId: heap_object_id) end def collect_garbage @devtools.send_cmd('HeapProfiler.collectGarbage') end def disable @devtools.send_cmd('HeapProfiler.disable') end def enable @devtools.send_cmd('HeapProfiler.enable') end def get_heap_object_id(object_id:) @devtools.send_cmd('HeapProfiler.getHeapObjectId', objectId: object_id) end def get_object_by_heap_object_id(object_id:, object_group: nil) @devtools.send_cmd('HeapProfiler.getObjectByHeapObjectId', objectId: object_id, objectGroup: object_group) end def get_sampling_profile @devtools.send_cmd('HeapProfiler.getSamplingProfile') end def start_sampling(sampling_interval: nil) @devtools.send_cmd('HeapProfiler.startSampling', samplingInterval: sampling_interval) end def start_tracking_heap_objects(track_allocations: nil) @devtools.send_cmd('HeapProfiler.startTrackingHeapObjects', trackAllocations: track_allocations) end def stop_sampling @devtools.send_cmd('HeapProfiler.stopSampling') end def stop_tracking_heap_objects(report_progress: nil, treat_global_objects_as_roots: nil, capture_numeric_value: nil) @devtools.send_cmd('HeapProfiler.stopTrackingHeapObjects', reportProgress: report_progress, treatGlobalObjectsAsRoots: treat_global_objects_as_roots, captureNumericValue: capture_numeric_value) end def take_heap_snapshot(report_progress: nil, treat_global_objects_as_roots: nil, capture_numeric_value: nil) @devtools.send_cmd('HeapProfiler.takeHeapSnapshot', reportProgress: report_progress, treatGlobalObjectsAsRoots: treat_global_objects_as_roots, captureNumericValue: capture_numeric_value) end end # HeapProfiler end # V101 end # DevTools end # Selenium