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

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

Issue 1545243002: Convert Pass()→std::move() in //content/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 569c9e6ea3723e59ad1f024ab7a424606118f4ec..07644589a40adcd08c73fafec1293d17473d031a 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -6,9 +6,9 @@
#include <stddef.h>
#include <stdint.h>
-
#include <algorithm>
#include <string>
+#include <utility>
#include <vector>
#include "base/logging.h"
@@ -64,7 +64,7 @@ presentation::SessionMessagePtr ToMojoSessionMessage(
output->message = input->message;
}
}
- return output.Pass();
+ return output;
}
scoped_ptr<PresentationSessionMessage> GetPresentationSessionMessage(
@@ -77,41 +77,41 @@ scoped_ptr<PresentationSessionMessage> GetPresentationSessionMessage(
DCHECK(input->data.is_null());
// Return null PresentationSessionMessage if size exceeds.
if (input->message.size() > content::kMaxPresentationSessionMessageSize)
- return output.Pass();
+ return output;
output.reset(
new PresentationSessionMessage(PresentationMessageType::TEXT));
input->message.Swap(&output->message);
- return output.Pass();
+ return output;
}
case presentation::PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER: {
DCHECK(!input->data.is_null());
DCHECK(input->message.is_null());
if (input->data.size() > content::kMaxPresentationSessionMessageSize)
- return output.Pass();
+ return output;
output.reset(new PresentationSessionMessage(
PresentationMessageType::ARRAY_BUFFER));
output->data.reset(new std::vector<uint8_t>);
input->data.Swap(output->data.get());
- return output.Pass();
+ return output;
}
case presentation::PRESENTATION_MESSAGE_TYPE_BLOB: {
DCHECK(!input->data.is_null());
DCHECK(input->message.is_null());
if (input->data.size() > content::kMaxPresentationSessionMessageSize)
- return output.Pass();
+ return output;
output.reset(
new PresentationSessionMessage(PresentationMessageType::BLOB));
output->data.reset(new std::vector<uint8_t>);
input->data.Swap(output->data.get());
- return output.Pass();
+ return output;
}
}
NOTREACHED() << "Invalid presentation message type " << input->type;
- return output.Pass();
+ return output;
}
void InvokeNewSessionMojoCallbackWithError(
@@ -165,13 +165,13 @@ void PresentationServiceImpl::CreateMojoService(
web_contents,
GetContentClient()->browser()->GetPresentationServiceDelegate(
web_contents));
- impl->Bind(request.Pass());
+ impl->Bind(std::move(request));
}
void PresentationServiceImpl::Bind(
mojo::InterfaceRequest<presentation::PresentationService> request) {
binding_.reset(new mojo::Binding<presentation::PresentationService>(
- this, request.Pass()));
+ this, std::move(request)));
binding_->set_connection_error_handler([this]() {
DVLOG(1) << "Connection error";
delete this;
@@ -182,7 +182,7 @@ void PresentationServiceImpl::SetClient(
presentation::PresentationServiceClientPtr client) {
DCHECK(!client_.get());
// TODO(imcheng): Set ErrorHandler to listen for errors.
- client_ = client.Pass();
+ client_ = std::move(client);
}
void PresentationServiceImpl::ListenForScreenAvailability(
@@ -203,7 +203,7 @@ void PresentationServiceImpl::ListenForScreenAvailability(
render_process_id_,
render_frame_id_,
listener.get())) {
- screen_availability_listeners_[availability_url] = listener.Pass();
+ screen_availability_listeners_[availability_url] = std::move(listener);
} else {
DVLOG(1) << "AddScreenAvailabilityListener failed. Ignoring request.";
}
@@ -363,7 +363,7 @@ bool PresentationServiceImpl::RunAndEraseJoinSessionMojoCallback(
return false;
DCHECK(it->second.get());
- it->second->Run(session.Pass(), error.Pass());
+ it->second->Run(std::move(session), std::move(error));
pending_join_session_cbs_.erase(it);
return true;
}
@@ -402,7 +402,7 @@ void PresentationServiceImpl::SendSessionMessage(
delegate_->SendMessage(
render_process_id_, render_frame_id_,
session.To<PresentationSessionInfo>(),
- GetPresentationSessionMessage(session_message.Pass()),
+ GetPresentationSessionMessage(std::move(session_message)),
base::Bind(&PresentationServiceImpl::OnSendMessageCallback,
weak_factory_.GetWeakPtr()));
}
@@ -476,7 +476,7 @@ void PresentationServiceImpl::OnSessionMessages(
client_->OnSessionMessagesReceived(
presentation::PresentationSessionInfo::From(session),
- mojoMessages.Pass());
+ std::move(mojoMessages));
}
void PresentationServiceImpl::DidNavigateAnyFrame(
@@ -600,7 +600,7 @@ void PresentationServiceImpl::NewSessionMojoCallbackWrapper::Run(
presentation::PresentationSessionInfoPtr session,
presentation::PresentationErrorPtr error) {
DCHECK(!callback_.is_null());
- callback_.Run(session.Pass(), error.Pass());
+ callback_.Run(std::move(session), std::move(error));
callback_.reset();
}

Powered by Google App Engine
This is Rietveld 408576698