1313# limitations under the License.
1414
1515import pathlib
16- from typing import TYPE_CHECKING , Optional , Union , cast
16+ from typing import Dict , Optional , Union , cast
1717
1818from playwright ._impl ._artifact import Artifact
19- from playwright ._impl ._connection import from_nullable_channel
19+ from playwright ._impl ._connection import ChannelOwner , from_nullable_channel
2020from playwright ._impl ._helper import locals_to_params
21+ from playwright ._impl ._local_utils import LocalUtils
2122
22- if TYPE_CHECKING : # pragma: no cover
23- from playwright ._impl ._browser_context import BrowserContext
2423
25-
26- class Tracing :
27- def __init__ (self , context : "BrowserContext" ) -> None :
28- self ._context = context
29- self ._channel = context ._channel
30- self ._loop = context ._loop
31- self ._dispatcher_fiber = context ._channel ._connection ._dispatcher_fiber
24+ class Tracing (ChannelOwner ):
25+ def __init__ (
26+ self , parent : ChannelOwner , type : str , guid : str , initializer : Dict
27+ ) -> None :
28+ super ().__init__ (parent , type , guid , initializer )
29+ _local_utils : LocalUtils
3230
3331 async def start (
3432 self ,
@@ -54,7 +52,7 @@ async def stop(self, path: Union[pathlib.Path, str] = None) -> None:
5452 await self ._channel .send ("tracingStop" )
5553
5654 async def _do_stop_chunk (self , file_path : Union [pathlib .Path , str ] = None ) -> None :
57- is_local = not self ._channel . _connection .is_remote
55+ is_local = not self ._connection .is_remote
5856
5957 mode = "doNotSave"
6058 if file_path :
@@ -88,4 +86,4 @@ async def _do_stop_chunk(self, file_path: Union[pathlib.Path, str] = None) -> No
8886
8987 # Add local sources to the remote trace if necessary.
9088 if result .get ("sourceEntries" , []):
91- await self ._context . _local_utils .zip (file_path , result ["sourceEntries" ])
89+ await self ._local_utils .zip (file_path , result ["sourceEntries" ])
0 commit comments