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

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

Issue 2080083002: Revert of Deletes mojo::Callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 17ec835b5f3017cb2bf09d6e292e9a2c3798a26b..23734a6b980b6ee79c5e9223f2507555b09abf57 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -112,8 +112,8 @@
return output;
}
-void InvokeNewSessionCallbackWithError(
- const PresentationServiceImpl::NewSessionCallback& callback) {
+void InvokeNewSessionMojoCallbackWithError(
+ const NewSessionMojoCallback& callback) {
callback.Run(blink::mojom::PresentationSessionInfoPtr(),
blink::mojom::PresentationError::From(PresentationError(
PRESENTATION_ERROR_UNKNOWN, "Internal error")));
@@ -218,8 +218,9 @@
screen_availability_listeners_.erase(listener_it);
}
-void PresentationServiceImpl::StartSession(const mojo::String& presentation_url,
- const NewSessionCallback& callback) {
+void PresentationServiceImpl::StartSession(
+ const mojo::String& presentation_url,
+ const NewSessionMojoCallback& callback) {
DVLOG(2) << "StartSession";
if (!delegate_) {
callback.Run(
@@ -232,12 +233,12 @@
// There is a StartSession request in progress. To avoid queueing up
// requests, the incoming request is rejected.
if (start_session_request_id_ != kInvalidRequestSessionId) {
- InvokeNewSessionCallbackWithError(callback);
+ InvokeNewSessionMojoCallbackWithError(callback);
return;
}
start_session_request_id_ = GetNextRequestSessionId();
- pending_start_session_cb_.reset(new NewSessionCallbackWrapper(callback));
+ pending_start_session_cb_.reset(new NewSessionMojoCallbackWrapper(callback));
delegate_->StartSession(
render_process_id_, render_frame_id_, presentation_url,
base::Bind(&PresentationServiceImpl::OnStartSessionSucceeded,
@@ -249,7 +250,7 @@
void PresentationServiceImpl::JoinSession(
const mojo::String& presentation_url,
const mojo::String& presentation_id,
- const NewSessionCallback& callback) {
+ const NewSessionMojoCallback& callback) {
DVLOG(2) << "JoinSession";
if (!delegate_) {
callback.Run(blink::mojom::PresentationSessionInfoPtr(),
@@ -261,7 +262,7 @@
int request_session_id = RegisterJoinSessionCallback(callback);
if (request_session_id == kInvalidRequestSessionId) {
- InvokeNewSessionCallbackWithError(callback);
+ InvokeNewSessionMojoCallbackWithError(callback);
return;
}
delegate_->JoinSession(
@@ -276,13 +277,13 @@
}
int PresentationServiceImpl::RegisterJoinSessionCallback(
- const NewSessionCallback& callback) {
+ const NewSessionMojoCallback& callback) {
if (pending_join_session_cbs_.size() >= kMaxNumQueuedSessionRequests)
return kInvalidRequestSessionId;
int request_id = GetNextRequestSessionId();
pending_join_session_cbs_[request_id].reset(
- new NewSessionCallbackWrapper(callback));
+ new NewSessionMojoCallbackWrapper(callback));
return request_id;
}
@@ -377,7 +378,7 @@
void PresentationServiceImpl::SendSessionMessage(
blink::mojom::PresentationSessionInfoPtr session,
blink::mojom::SessionMessagePtr session_message,
- const SendSessionMessageCallback& callback) {
+ const SendMessageMojoCallback& callback) {
DVLOG(2) << "SendSessionMessage";
DCHECK(!session_message.is_null());
// send_message_callback_ should be null by now, otherwise resetting of
@@ -387,7 +388,7 @@
return;
}
- send_message_callback_.reset(new SendSessionMessageCallback(callback));
+ send_message_callback_.reset(new SendMessageMojoCallback(callback));
delegate_->SendMessage(
render_process_id_, render_frame_id_,
session.To<PresentationSessionInfo>(),
@@ -589,18 +590,18 @@
service_->client_->OnScreenAvailabilityNotSupported(availability_url_);
}
-PresentationServiceImpl::NewSessionCallbackWrapper
-::NewSessionCallbackWrapper(const NewSessionCallback& callback)
+PresentationServiceImpl::NewSessionMojoCallbackWrapper
+::NewSessionMojoCallbackWrapper(const NewSessionMojoCallback& callback)
: callback_(callback) {
}
-PresentationServiceImpl::NewSessionCallbackWrapper
-::~NewSessionCallbackWrapper() {
+PresentationServiceImpl::NewSessionMojoCallbackWrapper
+::~NewSessionMojoCallbackWrapper() {
if (!callback_.is_null())
- InvokeNewSessionCallbackWithError(callback_);
-}
-
-void PresentationServiceImpl::NewSessionCallbackWrapper::Run(
+ InvokeNewSessionMojoCallbackWithError(callback_);
+}
+
+void PresentationServiceImpl::NewSessionMojoCallbackWrapper::Run(
blink::mojom::PresentationSessionInfoPtr session,
blink::mojom::PresentationErrorPtr error) {
DCHECK(!callback_.is_null());

Powered by Google App Engine
This is Rietveld 408576698