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

Unified Diff: content/browser/presentation/presentation_service_impl.cc

Issue 2653683006: [Presentation API] Fix race condition in which state change is lost. (Closed)
Patch Set: Created 3 years, 11 months 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
Index: content/browser/presentation/presentation_service_impl.cc
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc
index 9d870e3adf4c717129a36ad5d51f12538394c494..d1642c9a91b4d0198dc6f6a05652290777a16f66 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -293,16 +293,15 @@ int PresentationServiceImpl::RegisterJoinSessionCallback(
return request_id;
}
-void PresentationServiceImpl::ListenForConnectionStateChangeAndChangeState(
+void PresentationServiceImpl::ListenForConnectionStateChange(
const PresentationSessionInfo& connection) {
+ // NOTE: Blink will automatically transition the connection's state to
+ // 'connected'.
if (controller_delegate_) {
controller_delegate_->ListenForConnectionStateChange(
render_process_id_, render_frame_id_, connection,
base::Bind(&PresentationServiceImpl::OnConnectionStateChanged,
weak_factory_.GetWeakPtr(), connection));
- OnConnectionStateChanged(connection,
- PresentationConnectionStateChangeInfo(
- PRESENTATION_CONNECTION_STATE_CONNECTED));
}
}
@@ -316,7 +315,7 @@ void PresentationServiceImpl::OnStartSessionSucceeded(
pending_start_session_cb_->Run(
blink::mojom::PresentationSessionInfo::From(session_info),
blink::mojom::PresentationErrorPtr());
- ListenForConnectionStateChangeAndChangeState(session_info);
+ ListenForConnectionStateChange(session_info);
pending_start_session_cb_.reset();
start_session_request_id_ = kInvalidRequestSessionId;
}
@@ -341,7 +340,7 @@ void PresentationServiceImpl::OnJoinSessionSucceeded(
request_session_id,
blink::mojom::PresentationSessionInfo::From(session_info),
blink::mojom::PresentationErrorPtr())) {
- ListenForConnectionStateChangeAndChangeState(session_info);
+ ListenForConnectionStateChange(session_info);
}
}
@@ -614,7 +613,7 @@ void PresentationServiceImpl::OnDefaultPresentationStarted(
DCHECK(client_.get());
client_->OnDefaultSessionStarted(
blink::mojom::PresentationSessionInfo::From(connection));
- ListenForConnectionStateChangeAndChangeState(connection);
+ ListenForConnectionStateChange(connection);
}
PresentationServiceImpl::ScreenAvailabilityListenerImpl::

Powered by Google App Engine
This is Rietveld 408576698