mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
WebDriver: Reference-count WebDriver Session objects
When some WebDriver spec steps are implemented a bit more literally, we will end up in a situation where we remove a session from its client's active session map, but still have more steps to perform. Currently, when we remove the session, it is immediately destroyed because it is stored in an OwnPtr. Instead, we can store it as a RefPtr, which will let the caller to such steps keep the session alive until the subsequent steps are complete. While here, this also changes the storage of active sessions to a HashMap, as all lookups into it are currently a linear search.
This commit is contained in:
parent
7be8931ca0
commit
a0992c7731
3 changed files with 68 additions and 74 deletions
|
@ -9,6 +9,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/Promise.h>
|
||||
|
@ -22,7 +23,7 @@ namespace WebDriver {
|
|||
|
||||
struct LaunchBrowserCallbacks;
|
||||
|
||||
class Session {
|
||||
class Session : public RefCounted<Session> {
|
||||
public:
|
||||
Session(unsigned session_id, NonnullRefPtr<Client> client, Web::WebDriver::LadybirdOptions options);
|
||||
~Session();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue