summaryrefslogtreecommitdiff
path: root/Userland/Services/WebDriver/BrowserConnection.cpp
blob: 889c7d40957347a7505d8488d6fa94b0999f69ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright (c) 2022, Florent Castelli <florent.castelli@gmail.com>
 * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include "BrowserConnection.h"
#include "Client.h"

namespace WebDriver {

BrowserConnection::BrowserConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, NonnullRefPtr<Client> client, unsigned session_id)
    : IPC::ConnectionFromClient<WebDriverSessionClientEndpoint, WebDriverSessionServerEndpoint>(*this, move(socket), 1)
    , m_client(move(client))
    , m_session_id(session_id)
{
}

void BrowserConnection::die()
{
    dbgln_if(WEBDRIVER_DEBUG, "Session {} was closed remotely. Shutting down...", m_session_id);
    m_client->close_session(m_session_id);
}

}