mithwire 0.50.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mithwire/__init__.py +32 -0
- mithwire/cdp/README.md +4 -0
- mithwire/cdp/__init__.py +6 -0
- mithwire/cdp/accessibility.py +668 -0
- mithwire/cdp/animation.py +494 -0
- mithwire/cdp/audits.py +1995 -0
- mithwire/cdp/autofill.py +292 -0
- mithwire/cdp/background_service.py +215 -0
- mithwire/cdp/bluetooth_emulation.py +626 -0
- mithwire/cdp/browser.py +821 -0
- mithwire/cdp/cache_storage.py +311 -0
- mithwire/cdp/cast.py +172 -0
- mithwire/cdp/console.py +107 -0
- mithwire/cdp/crash_report_context.py +55 -0
- mithwire/cdp/css.py +2750 -0
- mithwire/cdp/database.py +179 -0
- mithwire/cdp/debugger.py +1405 -0
- mithwire/cdp/device_access.py +141 -0
- mithwire/cdp/device_orientation.py +45 -0
- mithwire/cdp/dom.py +2257 -0
- mithwire/cdp/dom_debugger.py +321 -0
- mithwire/cdp/dom_snapshot.py +876 -0
- mithwire/cdp/dom_storage.py +222 -0
- mithwire/cdp/emulation.py +1779 -0
- mithwire/cdp/event_breakpoints.py +56 -0
- mithwire/cdp/extensions.py +238 -0
- mithwire/cdp/fed_cm.py +283 -0
- mithwire/cdp/fetch.py +507 -0
- mithwire/cdp/file_system.py +115 -0
- mithwire/cdp/headless_experimental.py +115 -0
- mithwire/cdp/heap_profiler.py +401 -0
- mithwire/cdp/indexed_db.py +528 -0
- mithwire/cdp/input_.py +701 -0
- mithwire/cdp/inspector.py +95 -0
- mithwire/cdp/io.py +101 -0
- mithwire/cdp/layer_tree.py +464 -0
- mithwire/cdp/log.py +190 -0
- mithwire/cdp/media.py +313 -0
- mithwire/cdp/memory.py +305 -0
- mithwire/cdp/network.py +5342 -0
- mithwire/cdp/overlay.py +1468 -0
- mithwire/cdp/page.py +3972 -0
- mithwire/cdp/performance.py +124 -0
- mithwire/cdp/performance_timeline.py +200 -0
- mithwire/cdp/preload.py +575 -0
- mithwire/cdp/profiler.py +420 -0
- mithwire/cdp/pwa.py +278 -0
- mithwire/cdp/py.typed +0 -0
- mithwire/cdp/runtime.py +1589 -0
- mithwire/cdp/schema.py +50 -0
- mithwire/cdp/security.py +518 -0
- mithwire/cdp/service_worker.py +401 -0
- mithwire/cdp/smart_card_emulation.py +891 -0
- mithwire/cdp/storage.py +1573 -0
- mithwire/cdp/system_info.py +327 -0
- mithwire/cdp/target.py +829 -0
- mithwire/cdp/tethering.py +65 -0
- mithwire/cdp/tracing.py +377 -0
- mithwire/cdp/util.py +18 -0
- mithwire/cdp/web_audio.py +606 -0
- mithwire/cdp/web_authn.py +598 -0
- mithwire/cdp/web_mcp.py +293 -0
- mithwire/core/_contradict.py +142 -0
- mithwire/core/browser.py +923 -0
- mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
- mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
- mithwire/core/config.py +323 -0
- mithwire/core/connection.py +564 -0
- mithwire/core/element.py +1205 -0
- mithwire/core/tab.py +2202 -0
- mithwire/core/util.py +5063 -0
- mithwire-0.50.3.dist-info/METADATA +1049 -0
- mithwire-0.50.3.dist-info/RECORD +76 -0
- mithwire-0.50.3.dist-info/WHEEL +5 -0
- mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
- mithwire-0.50.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE!
|
|
2
|
+
#
|
|
3
|
+
# This file is generated from the CDP specification. If you need to make
|
|
4
|
+
# changes, edit the generator and regenerate all of the modules.
|
|
5
|
+
#
|
|
6
|
+
# CDP domain: HeadlessExperimental (experimental)
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
import enum
|
|
10
|
+
import typing
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from .util import event_class, T_JSON_DICT
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from deprecated.sphinx import deprecated # type: ignore
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class ScreenshotParams:
|
|
20
|
+
'''
|
|
21
|
+
Encoding options for a screenshot.
|
|
22
|
+
'''
|
|
23
|
+
#: Image compression format (defaults to png).
|
|
24
|
+
format_: typing.Optional[str] = None
|
|
25
|
+
|
|
26
|
+
#: Compression quality from range [0..100] (jpeg and webp only).
|
|
27
|
+
quality: typing.Optional[int] = None
|
|
28
|
+
|
|
29
|
+
#: Optimize image encoding for speed, not for resulting size (defaults to false)
|
|
30
|
+
optimize_for_speed: typing.Optional[bool] = None
|
|
31
|
+
|
|
32
|
+
def to_json(self) -> T_JSON_DICT:
|
|
33
|
+
json: T_JSON_DICT = dict()
|
|
34
|
+
if self.format_ is not None:
|
|
35
|
+
json['format'] = self.format_
|
|
36
|
+
if self.quality is not None:
|
|
37
|
+
json['quality'] = self.quality
|
|
38
|
+
if self.optimize_for_speed is not None:
|
|
39
|
+
json['optimizeForSpeed'] = self.optimize_for_speed
|
|
40
|
+
return json
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def from_json(cls, json: T_JSON_DICT) -> ScreenshotParams:
|
|
44
|
+
return cls(
|
|
45
|
+
format_=str(json['format']) if json.get('format', None) is not None else None,
|
|
46
|
+
quality=int(json['quality']) if json.get('quality', None) is not None else None,
|
|
47
|
+
optimize_for_speed=bool(json['optimizeForSpeed']) if json.get('optimizeForSpeed', None) is not None else None,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def begin_frame(
|
|
52
|
+
frame_time_ticks: typing.Optional[float] = None,
|
|
53
|
+
interval: typing.Optional[float] = None,
|
|
54
|
+
no_display_updates: typing.Optional[bool] = None,
|
|
55
|
+
screenshot: typing.Optional[ScreenshotParams] = None
|
|
56
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[bool, typing.Optional[str]]]:
|
|
57
|
+
'''
|
|
58
|
+
Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a
|
|
59
|
+
screenshot from the resulting frame. Requires that the target was created with enabled
|
|
60
|
+
BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also
|
|
61
|
+
https://goo.gle/chrome-headless-rendering for more background.
|
|
62
|
+
|
|
63
|
+
:param frame_time_ticks: *(Optional)* Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, the current time will be used.
|
|
64
|
+
:param interval: *(Optional)* The interval between BeginFrames that is reported to the compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
|
|
65
|
+
:param no_display_updates: *(Optional)* Whether updates should not be committed and drawn onto the display. False by default. If true, only side effects of the BeginFrame will be run, such as layout and animations, but any visual updates may not be visible on the display or in screenshots.
|
|
66
|
+
:param screenshot: *(Optional)* If set, a screenshot of the frame will be captured and returned in the response. Otherwise, no screenshot will be captured. Note that capturing a screenshot can fail, for example, during renderer initialization. In such a case, no screenshot data will be returned.
|
|
67
|
+
:returns: A tuple with the following items:
|
|
68
|
+
|
|
69
|
+
0. **hasDamage** - Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display. Reported for diagnostic uses, may be removed in the future.
|
|
70
|
+
1. **screenshotData** - *(Optional)* Base64-encoded image data of the screenshot, if one was requested and successfully taken. (Encoded as a base64 string when passed over JSON)
|
|
71
|
+
'''
|
|
72
|
+
params: T_JSON_DICT = dict()
|
|
73
|
+
if frame_time_ticks is not None:
|
|
74
|
+
params['frameTimeTicks'] = frame_time_ticks
|
|
75
|
+
if interval is not None:
|
|
76
|
+
params['interval'] = interval
|
|
77
|
+
if no_display_updates is not None:
|
|
78
|
+
params['noDisplayUpdates'] = no_display_updates
|
|
79
|
+
if screenshot is not None:
|
|
80
|
+
params['screenshot'] = screenshot.to_json()
|
|
81
|
+
cmd_dict: T_JSON_DICT = {
|
|
82
|
+
'method': 'HeadlessExperimental.beginFrame',
|
|
83
|
+
'params': params,
|
|
84
|
+
}
|
|
85
|
+
json = yield cmd_dict
|
|
86
|
+
return (
|
|
87
|
+
bool(json['hasDamage']),
|
|
88
|
+
str(json['screenshotData']) if json.get('screenshotData', None) is not None else None
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@deprecated(version="1.3")
|
|
93
|
+
def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
94
|
+
'''
|
|
95
|
+
Disables headless events for the target.
|
|
96
|
+
|
|
97
|
+
.. deprecated:: 1.3
|
|
98
|
+
'''
|
|
99
|
+
cmd_dict: T_JSON_DICT = {
|
|
100
|
+
'method': 'HeadlessExperimental.disable',
|
|
101
|
+
}
|
|
102
|
+
json = yield cmd_dict
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@deprecated(version="1.3")
|
|
106
|
+
def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
107
|
+
'''
|
|
108
|
+
Enables headless events for the target.
|
|
109
|
+
|
|
110
|
+
.. deprecated:: 1.3
|
|
111
|
+
'''
|
|
112
|
+
cmd_dict: T_JSON_DICT = {
|
|
113
|
+
'method': 'HeadlessExperimental.enable',
|
|
114
|
+
}
|
|
115
|
+
json = yield cmd_dict
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE!
|
|
2
|
+
#
|
|
3
|
+
# This file is generated from the CDP specification. If you need to make
|
|
4
|
+
# changes, edit the generator and regenerate all of the modules.
|
|
5
|
+
#
|
|
6
|
+
# CDP domain: HeapProfiler (experimental)
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
import enum
|
|
10
|
+
import typing
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from .util import event_class, T_JSON_DICT
|
|
13
|
+
|
|
14
|
+
from . import runtime
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class HeapSnapshotObjectId(str):
|
|
18
|
+
'''
|
|
19
|
+
Heap snapshot object id.
|
|
20
|
+
'''
|
|
21
|
+
def to_json(self) -> str:
|
|
22
|
+
return self
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def from_json(cls, json: str) -> HeapSnapshotObjectId:
|
|
26
|
+
return cls(json)
|
|
27
|
+
|
|
28
|
+
def __repr__(self):
|
|
29
|
+
return 'HeapSnapshotObjectId({})'.format(super().__repr__())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class SamplingHeapProfileNode:
|
|
34
|
+
'''
|
|
35
|
+
Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.
|
|
36
|
+
'''
|
|
37
|
+
#: Function location.
|
|
38
|
+
call_frame: runtime.CallFrame
|
|
39
|
+
|
|
40
|
+
#: Allocations size in bytes for the node excluding children.
|
|
41
|
+
self_size: float
|
|
42
|
+
|
|
43
|
+
#: Node id. Ids are unique across all profiles collected between startSampling and stopSampling.
|
|
44
|
+
id_: int
|
|
45
|
+
|
|
46
|
+
#: Child nodes.
|
|
47
|
+
children: typing.List[SamplingHeapProfileNode]
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> T_JSON_DICT:
|
|
50
|
+
json: T_JSON_DICT = dict()
|
|
51
|
+
json['callFrame'] = self.call_frame.to_json()
|
|
52
|
+
json['selfSize'] = self.self_size
|
|
53
|
+
json['id'] = self.id_
|
|
54
|
+
json['children'] = [i.to_json() for i in self.children]
|
|
55
|
+
return json
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json: T_JSON_DICT) -> SamplingHeapProfileNode:
|
|
59
|
+
return cls(
|
|
60
|
+
call_frame=runtime.CallFrame.from_json(json['callFrame']),
|
|
61
|
+
self_size=float(json['selfSize']),
|
|
62
|
+
id_=int(json['id']),
|
|
63
|
+
children=[SamplingHeapProfileNode.from_json(i) for i in json['children']],
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@dataclass
|
|
68
|
+
class SamplingHeapProfileSample:
|
|
69
|
+
'''
|
|
70
|
+
A single sample from a sampling profile.
|
|
71
|
+
'''
|
|
72
|
+
#: Allocation size in bytes attributed to the sample.
|
|
73
|
+
size: float
|
|
74
|
+
|
|
75
|
+
#: Id of the corresponding profile tree node.
|
|
76
|
+
node_id: int
|
|
77
|
+
|
|
78
|
+
#: Time-ordered sample ordinal number. It is unique across all profiles retrieved
|
|
79
|
+
#: between startSampling and stopSampling.
|
|
80
|
+
ordinal: float
|
|
81
|
+
|
|
82
|
+
def to_json(self) -> T_JSON_DICT:
|
|
83
|
+
json: T_JSON_DICT = dict()
|
|
84
|
+
json['size'] = self.size
|
|
85
|
+
json['nodeId'] = self.node_id
|
|
86
|
+
json['ordinal'] = self.ordinal
|
|
87
|
+
return json
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_json(cls, json: T_JSON_DICT) -> SamplingHeapProfileSample:
|
|
91
|
+
return cls(
|
|
92
|
+
size=float(json['size']),
|
|
93
|
+
node_id=int(json['nodeId']),
|
|
94
|
+
ordinal=float(json['ordinal']),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@dataclass
|
|
99
|
+
class SamplingHeapProfile:
|
|
100
|
+
'''
|
|
101
|
+
Sampling profile.
|
|
102
|
+
'''
|
|
103
|
+
head: SamplingHeapProfileNode
|
|
104
|
+
|
|
105
|
+
samples: typing.List[SamplingHeapProfileSample]
|
|
106
|
+
|
|
107
|
+
def to_json(self) -> T_JSON_DICT:
|
|
108
|
+
json: T_JSON_DICT = dict()
|
|
109
|
+
json['head'] = self.head.to_json()
|
|
110
|
+
json['samples'] = [i.to_json() for i in self.samples]
|
|
111
|
+
return json
|
|
112
|
+
|
|
113
|
+
@classmethod
|
|
114
|
+
def from_json(cls, json: T_JSON_DICT) -> SamplingHeapProfile:
|
|
115
|
+
return cls(
|
|
116
|
+
head=SamplingHeapProfileNode.from_json(json['head']),
|
|
117
|
+
samples=[SamplingHeapProfileSample.from_json(i) for i in json['samples']],
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def add_inspected_heap_object(
|
|
122
|
+
heap_object_id: HeapSnapshotObjectId
|
|
123
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
124
|
+
'''
|
|
125
|
+
Enables console to refer to the node with given id via $x (see Command Line API for more details
|
|
126
|
+
$x functions).
|
|
127
|
+
|
|
128
|
+
:param heap_object_id: Heap snapshot object id to be accessible by means of $x command line API.
|
|
129
|
+
'''
|
|
130
|
+
params: T_JSON_DICT = dict()
|
|
131
|
+
params['heapObjectId'] = heap_object_id.to_json()
|
|
132
|
+
cmd_dict: T_JSON_DICT = {
|
|
133
|
+
'method': 'HeapProfiler.addInspectedHeapObject',
|
|
134
|
+
'params': params,
|
|
135
|
+
}
|
|
136
|
+
json = yield cmd_dict
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def collect_garbage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
140
|
+
|
|
141
|
+
cmd_dict: T_JSON_DICT = {
|
|
142
|
+
'method': 'HeapProfiler.collectGarbage',
|
|
143
|
+
}
|
|
144
|
+
json = yield cmd_dict
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
148
|
+
|
|
149
|
+
cmd_dict: T_JSON_DICT = {
|
|
150
|
+
'method': 'HeapProfiler.disable',
|
|
151
|
+
}
|
|
152
|
+
json = yield cmd_dict
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
156
|
+
|
|
157
|
+
cmd_dict: T_JSON_DICT = {
|
|
158
|
+
'method': 'HeapProfiler.enable',
|
|
159
|
+
}
|
|
160
|
+
json = yield cmd_dict
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def get_heap_object_id(
|
|
164
|
+
object_id: runtime.RemoteObjectId
|
|
165
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,HeapSnapshotObjectId]:
|
|
166
|
+
'''
|
|
167
|
+
:param object_id: Identifier of the object to get heap object id for.
|
|
168
|
+
:returns: Id of the heap snapshot object corresponding to the passed remote object id.
|
|
169
|
+
'''
|
|
170
|
+
params: T_JSON_DICT = dict()
|
|
171
|
+
params['objectId'] = object_id.to_json()
|
|
172
|
+
cmd_dict: T_JSON_DICT = {
|
|
173
|
+
'method': 'HeapProfiler.getHeapObjectId',
|
|
174
|
+
'params': params,
|
|
175
|
+
}
|
|
176
|
+
json = yield cmd_dict
|
|
177
|
+
return HeapSnapshotObjectId.from_json(json['heapSnapshotObjectId'])
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def get_object_by_heap_object_id(
|
|
181
|
+
object_id: HeapSnapshotObjectId,
|
|
182
|
+
object_group: typing.Optional[str] = None
|
|
183
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.RemoteObject]:
|
|
184
|
+
'''
|
|
185
|
+
:param object_id:
|
|
186
|
+
:param object_group: *(Optional)* Symbolic group name that can be used to release multiple objects.
|
|
187
|
+
:returns: Evaluation result.
|
|
188
|
+
'''
|
|
189
|
+
params: T_JSON_DICT = dict()
|
|
190
|
+
params['objectId'] = object_id.to_json()
|
|
191
|
+
if object_group is not None:
|
|
192
|
+
params['objectGroup'] = object_group
|
|
193
|
+
cmd_dict: T_JSON_DICT = {
|
|
194
|
+
'method': 'HeapProfiler.getObjectByHeapObjectId',
|
|
195
|
+
'params': params,
|
|
196
|
+
}
|
|
197
|
+
json = yield cmd_dict
|
|
198
|
+
return runtime.RemoteObject.from_json(json['result'])
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def get_sampling_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingHeapProfile]:
|
|
202
|
+
'''
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
:returns: Return the sampling profile being collected.
|
|
206
|
+
'''
|
|
207
|
+
cmd_dict: T_JSON_DICT = {
|
|
208
|
+
'method': 'HeapProfiler.getSamplingProfile',
|
|
209
|
+
}
|
|
210
|
+
json = yield cmd_dict
|
|
211
|
+
return SamplingHeapProfile.from_json(json['profile'])
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def start_sampling(
|
|
215
|
+
sampling_interval: typing.Optional[float] = None,
|
|
216
|
+
stack_depth: typing.Optional[float] = None,
|
|
217
|
+
include_objects_collected_by_major_gc: typing.Optional[bool] = None,
|
|
218
|
+
include_objects_collected_by_minor_gc: typing.Optional[bool] = None
|
|
219
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
220
|
+
'''
|
|
221
|
+
:param sampling_interval: *(Optional)* Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
|
|
222
|
+
:param stack_depth: *(Optional)* Maximum stack depth. The default value is 128.
|
|
223
|
+
:param include_objects_collected_by_major_gc: *(Optional)* By default, the sampling heap profiler reports only objects which are still alive when the profile is returned via getSamplingProfile or stopSampling, which is useful for determining what functions contribute the most to steady-state memory usage. This flag instructs the sampling heap profiler to also include information about objects discarded by major GC, which will show which functions cause large temporary memory usage or long GC pauses.
|
|
224
|
+
:param include_objects_collected_by_minor_gc: *(Optional)* By default, the sampling heap profiler reports only objects which are still alive when the profile is returned via getSamplingProfile or stopSampling, which is useful for determining what functions contribute the most to steady-state memory usage. This flag instructs the sampling heap profiler to also include information about objects discarded by minor GC, which is useful when tuning a latency-sensitive application for minimal GC activity.
|
|
225
|
+
'''
|
|
226
|
+
params: T_JSON_DICT = dict()
|
|
227
|
+
if sampling_interval is not None:
|
|
228
|
+
params['samplingInterval'] = sampling_interval
|
|
229
|
+
if stack_depth is not None:
|
|
230
|
+
params['stackDepth'] = stack_depth
|
|
231
|
+
if include_objects_collected_by_major_gc is not None:
|
|
232
|
+
params['includeObjectsCollectedByMajorGC'] = include_objects_collected_by_major_gc
|
|
233
|
+
if include_objects_collected_by_minor_gc is not None:
|
|
234
|
+
params['includeObjectsCollectedByMinorGC'] = include_objects_collected_by_minor_gc
|
|
235
|
+
cmd_dict: T_JSON_DICT = {
|
|
236
|
+
'method': 'HeapProfiler.startSampling',
|
|
237
|
+
'params': params,
|
|
238
|
+
}
|
|
239
|
+
json = yield cmd_dict
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def start_tracking_heap_objects(
|
|
243
|
+
track_allocations: typing.Optional[bool] = None
|
|
244
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
245
|
+
'''
|
|
246
|
+
:param track_allocations: *(Optional)*
|
|
247
|
+
'''
|
|
248
|
+
params: T_JSON_DICT = dict()
|
|
249
|
+
if track_allocations is not None:
|
|
250
|
+
params['trackAllocations'] = track_allocations
|
|
251
|
+
cmd_dict: T_JSON_DICT = {
|
|
252
|
+
'method': 'HeapProfiler.startTrackingHeapObjects',
|
|
253
|
+
'params': params,
|
|
254
|
+
}
|
|
255
|
+
json = yield cmd_dict
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def stop_sampling() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingHeapProfile]:
|
|
259
|
+
'''
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
:returns: Recorded sampling heap profile.
|
|
263
|
+
'''
|
|
264
|
+
cmd_dict: T_JSON_DICT = {
|
|
265
|
+
'method': 'HeapProfiler.stopSampling',
|
|
266
|
+
}
|
|
267
|
+
json = yield cmd_dict
|
|
268
|
+
return SamplingHeapProfile.from_json(json['profile'])
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def stop_tracking_heap_objects(
|
|
272
|
+
report_progress: typing.Optional[bool] = None,
|
|
273
|
+
treat_global_objects_as_roots: typing.Optional[bool] = None,
|
|
274
|
+
capture_numeric_value: typing.Optional[bool] = None,
|
|
275
|
+
expose_internals: typing.Optional[bool] = None
|
|
276
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
277
|
+
'''
|
|
278
|
+
:param report_progress: *(Optional)* If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
|
|
279
|
+
:param treat_global_objects_as_roots: **(DEPRECATED)** *(Optional)* Deprecated in favor of ```exposeInternals```.
|
|
280
|
+
:param capture_numeric_value: *(Optional)* If true, numerical values are included in the snapshot
|
|
281
|
+
:param expose_internals: **(EXPERIMENTAL)** *(Optional)* If true, exposes internals of the snapshot.
|
|
282
|
+
'''
|
|
283
|
+
params: T_JSON_DICT = dict()
|
|
284
|
+
if report_progress is not None:
|
|
285
|
+
params['reportProgress'] = report_progress
|
|
286
|
+
if treat_global_objects_as_roots is not None:
|
|
287
|
+
params['treatGlobalObjectsAsRoots'] = treat_global_objects_as_roots
|
|
288
|
+
if capture_numeric_value is not None:
|
|
289
|
+
params['captureNumericValue'] = capture_numeric_value
|
|
290
|
+
if expose_internals is not None:
|
|
291
|
+
params['exposeInternals'] = expose_internals
|
|
292
|
+
cmd_dict: T_JSON_DICT = {
|
|
293
|
+
'method': 'HeapProfiler.stopTrackingHeapObjects',
|
|
294
|
+
'params': params,
|
|
295
|
+
}
|
|
296
|
+
json = yield cmd_dict
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def take_heap_snapshot(
|
|
300
|
+
report_progress: typing.Optional[bool] = None,
|
|
301
|
+
treat_global_objects_as_roots: typing.Optional[bool] = None,
|
|
302
|
+
capture_numeric_value: typing.Optional[bool] = None,
|
|
303
|
+
expose_internals: typing.Optional[bool] = None
|
|
304
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
305
|
+
'''
|
|
306
|
+
:param report_progress: *(Optional)* If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
|
|
307
|
+
:param treat_global_objects_as_roots: **(DEPRECATED)** *(Optional)* If true, a raw snapshot without artificial roots will be generated. Deprecated in favor of ```exposeInternals```.
|
|
308
|
+
:param capture_numeric_value: *(Optional)* If true, numerical values are included in the snapshot
|
|
309
|
+
:param expose_internals: **(EXPERIMENTAL)** *(Optional)* If true, exposes internals of the snapshot.
|
|
310
|
+
'''
|
|
311
|
+
params: T_JSON_DICT = dict()
|
|
312
|
+
if report_progress is not None:
|
|
313
|
+
params['reportProgress'] = report_progress
|
|
314
|
+
if treat_global_objects_as_roots is not None:
|
|
315
|
+
params['treatGlobalObjectsAsRoots'] = treat_global_objects_as_roots
|
|
316
|
+
if capture_numeric_value is not None:
|
|
317
|
+
params['captureNumericValue'] = capture_numeric_value
|
|
318
|
+
if expose_internals is not None:
|
|
319
|
+
params['exposeInternals'] = expose_internals
|
|
320
|
+
cmd_dict: T_JSON_DICT = {
|
|
321
|
+
'method': 'HeapProfiler.takeHeapSnapshot',
|
|
322
|
+
'params': params,
|
|
323
|
+
}
|
|
324
|
+
json = yield cmd_dict
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
@event_class('HeapProfiler.addHeapSnapshotChunk')
|
|
328
|
+
@dataclass
|
|
329
|
+
class AddHeapSnapshotChunk:
|
|
330
|
+
chunk: str
|
|
331
|
+
|
|
332
|
+
@classmethod
|
|
333
|
+
def from_json(cls, json: T_JSON_DICT) -> AddHeapSnapshotChunk:
|
|
334
|
+
return cls(
|
|
335
|
+
chunk=str(json['chunk'])
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
@event_class('HeapProfiler.heapStatsUpdate')
|
|
340
|
+
@dataclass
|
|
341
|
+
class HeapStatsUpdate:
|
|
342
|
+
'''
|
|
343
|
+
If heap objects tracking has been started then backend may send update for one or more fragments
|
|
344
|
+
'''
|
|
345
|
+
#: An array of triplets. Each triplet describes a fragment. The first integer is the fragment
|
|
346
|
+
#: index, the second integer is a total count of objects for the fragment, the third integer is
|
|
347
|
+
#: a total size of the objects for the fragment.
|
|
348
|
+
stats_update: typing.List[int]
|
|
349
|
+
|
|
350
|
+
@classmethod
|
|
351
|
+
def from_json(cls, json: T_JSON_DICT) -> HeapStatsUpdate:
|
|
352
|
+
return cls(
|
|
353
|
+
stats_update=[int(i) for i in json['statsUpdate']]
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
@event_class('HeapProfiler.lastSeenObjectId')
|
|
358
|
+
@dataclass
|
|
359
|
+
class LastSeenObjectId:
|
|
360
|
+
'''
|
|
361
|
+
If heap objects tracking has been started then backend regularly sends a current value for last
|
|
362
|
+
seen object id and corresponding timestamp. If the were changes in the heap since last event
|
|
363
|
+
then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.
|
|
364
|
+
'''
|
|
365
|
+
last_seen_object_id: int
|
|
366
|
+
timestamp: float
|
|
367
|
+
|
|
368
|
+
@classmethod
|
|
369
|
+
def from_json(cls, json: T_JSON_DICT) -> LastSeenObjectId:
|
|
370
|
+
return cls(
|
|
371
|
+
last_seen_object_id=int(json['lastSeenObjectId']),
|
|
372
|
+
timestamp=float(json['timestamp'])
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
@event_class('HeapProfiler.reportHeapSnapshotProgress')
|
|
377
|
+
@dataclass
|
|
378
|
+
class ReportHeapSnapshotProgress:
|
|
379
|
+
done: int
|
|
380
|
+
total: int
|
|
381
|
+
finished: typing.Optional[bool]
|
|
382
|
+
|
|
383
|
+
@classmethod
|
|
384
|
+
def from_json(cls, json: T_JSON_DICT) -> ReportHeapSnapshotProgress:
|
|
385
|
+
return cls(
|
|
386
|
+
done=int(json['done']),
|
|
387
|
+
total=int(json['total']),
|
|
388
|
+
finished=bool(json['finished']) if json.get('finished', None) is not None else None
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
@event_class('HeapProfiler.resetProfiles')
|
|
393
|
+
@dataclass
|
|
394
|
+
class ResetProfiles:
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
@classmethod
|
|
398
|
+
def from_json(cls, json: T_JSON_DICT) -> ResetProfiles:
|
|
399
|
+
return cls(
|
|
400
|
+
|
|
401
|
+
)
|