Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Unified Diff: content/renderer/gpu/stream_texture_host_android.cc

Issue 2530443002: Fix OnChannelError() in StreamTextureHost (Closed)
Patch Set: Addressed comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/media/android/stream_texture_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/stream_texture_host_android.cc
diff --git a/content/renderer/gpu/stream_texture_host_android.cc b/content/renderer/gpu/stream_texture_host_android.cc
index e03a16dee84a20222268155158f35d56ae766ac0..120a47279cd7044e520111eb693ee68fd65d50b8 100644
--- a/content/renderer/gpu/stream_texture_host_android.cc
+++ b/content/renderer/gpu/stream_texture_host_android.cc
@@ -15,20 +15,22 @@ namespace content {
StreamTextureHost::StreamTextureHost(scoped_refptr<gpu::GpuChannelHost> channel,
int32_t route_id)
: route_id_(route_id),
- listener_(NULL),
+ listener_(nullptr),
channel_(std::move(channel)),
weak_ptr_factory_(this) {
DCHECK(channel_);
+ DCHECK(route_id_);
}
StreamTextureHost::~StreamTextureHost() {
- if (channel_.get() && route_id_)
+ if (channel_)
channel_->RemoveRoute(route_id_);
}
bool StreamTextureHost::BindToCurrentThread(Listener* listener) {
listener_ = listener;
- if (channel_.get() && route_id_) {
+
+ if (channel_) {
channel_->AddRoute(route_id_, weak_ptr_factory_.GetWeakPtr());
channel_->Send(new GpuStreamTextureMsg_StartListening(route_id_));
return true;
@@ -40,8 +42,7 @@ bool StreamTextureHost::BindToCurrentThread(Listener* listener) {
bool StreamTextureHost::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(StreamTextureHost, message)
- IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_FrameAvailable,
- OnFrameAvailable);
+ IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_FrameAvailable, OnFrameAvailable);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
DCHECK(handled);
@@ -49,6 +50,7 @@ bool StreamTextureHost::OnMessageReceived(const IPC::Message& message) {
}
void StreamTextureHost::OnChannelError() {
+ channel_ = nullptr;
}
void StreamTextureHost::OnFrameAvailable() {
@@ -57,20 +59,20 @@ void StreamTextureHost::OnFrameAvailable() {
}
void StreamTextureHost::EstablishPeer(int player_id, int frame_id) {
- if (route_id_) {
+ if (channel_) {
channel_->Send(
new GpuStreamTextureMsg_EstablishPeer(route_id_, frame_id, player_id));
}
}
void StreamTextureHost::SetStreamTextureSize(const gfx::Size& size) {
- if (route_id_)
+ if (channel_)
channel_->Send(new GpuStreamTextureMsg_SetSize(route_id_, size));
}
void StreamTextureHost::ForwardStreamTextureForSurfaceRequest(
const base::UnguessableToken& request_token) {
- if (route_id_) {
+ if (channel_) {
channel_->Send(new GpuStreamTextureMsg_ForwardForSurfaceRequest(
route_id_, request_token));
}
« no previous file with comments | « no previous file | content/renderer/media/android/stream_texture_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698