Commit e8da6cb7 authored by John Williams's avatar John Williams Committed by Commit Bot

2nd reland of "[Cast MRP] Stop mirroring immediately when a the tab is closed."

This is a reland of f51b93d7

Original change's description:
> [Cast MRP] Stop mirroring immediately when a the tab is closed.
>
> Bug: 1095764, b/159154368
> Change-Id: I36829467e3a6477499c76ae0b15e110acba00c89
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2346911
> Reviewed-by: Yuri Wiitala <miu@chromium.org>
> Commit-Queue: John Williams <jrw@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#803343}

Bug: 1095764
Bug: b/159154368
Change-Id: I9d01af31895152afbf13a21b00091f12352131a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402181
Commit-Queue: John Williams <jrw@chromium.org>
Reviewed-by: default avatarmark a. foltz <mfoltz@chromium.org>
Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812518}
parent 37ba4241
......@@ -15,7 +15,10 @@ MirroringService::MirroringService(
mojo::PendingReceiver<mojom::MirroringService> receiver,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
: receiver_(this, std::move(receiver)),
io_task_runner_(std::move(io_task_runner)) {}
io_task_runner_(std::move(io_task_runner)) {
receiver_.set_disconnect_handler(
base::BindOnce(&MirroringService::OnDisconnect, base::Unretained(this)));
}
MirroringService::~MirroringService() = default;
......@@ -33,4 +36,8 @@ void MirroringService::Start(
std::move(inbound_channel), io_task_runner_);
}
void MirroringService::OnDisconnect() {
session_.reset();
}
} // namespace mirroring
......@@ -33,6 +33,8 @@ class COMPONENT_EXPORT(MIRRORING_SERVICE) MirroringService final
mojo::PendingReceiver<mojom::CastMessageChannel> inbound_channel)
override;
void OnDisconnect();
mojo::Receiver<mojom::MirroringService> receiver_;
const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
std::unique_ptr<Session> session_; // Current mirroring session.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment