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

Unified Diff: remoting/client/plugin/chromoting_instance.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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
« no previous file with comments | « remoting/client/plugin/chromoting_instance.h ('k') | remoting/client/plugin/delegating_signal_strategy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/chromoting_instance.cc
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 20142d7167b3dff97b734495b2294b66f12a0029..dea1613f2930b8db58f7ef745355d5c08cce7307 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -18,6 +18,7 @@
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
@@ -189,7 +190,7 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance)
rtc::InitRandom(random_seed, sizeof(random_seed));
// Send hello message.
- PostLegacyJsonMessage("hello", make_scoped_ptr(new base::DictionaryValue()));
+ PostLegacyJsonMessage("hello", base::WrapUnique(new base::DictionaryValue()));
}
ChromotingInstance::~ChromotingInstance() {
@@ -226,7 +227,7 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) {
return;
}
- scoped_ptr<base::Value> json = base::JSONReader::Read(
+ std::unique_ptr<base::Value> json = base::JSONReader::Read(
message.AsString(), base::JSON_ALLOW_TRAILING_COMMAS);
base::DictionaryValue* message_dict = nullptr;
std::string method;
@@ -338,16 +339,16 @@ void ChromotingInstance::OnVideoDecodeError() {
void ChromotingInstance::OnVideoFirstFrameReceived() {
PostLegacyJsonMessage("onFirstFrameReceived",
- make_scoped_ptr(new base::DictionaryValue()));
+ base::WrapUnique(new base::DictionaryValue()));
}
void ChromotingInstance::OnVideoFrameDirtyRegion(
const webrtc::DesktopRegion& dirty_region) {
- scoped_ptr<base::ListValue> rects_value(new base::ListValue());
+ std::unique_ptr<base::ListValue> rects_value(new base::ListValue());
for (webrtc::DesktopRegion::Iterator i(dirty_region); !i.IsAtEnd();
i.Advance()) {
const webrtc::DesktopRect& rect = i.rect();
- scoped_ptr<base::ListValue> rect_value(new base::ListValue());
+ std::unique_ptr<base::ListValue> rect_value(new base::ListValue());
rect_value->AppendInteger(rect.left());
rect_value->AppendInteger(rect.top());
rect_value->AppendInteger(rect.width());
@@ -355,7 +356,7 @@ void ChromotingInstance::OnVideoFrameDirtyRegion(
rects_value->Append(rect_value.release());
}
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->Set("rects", rects_value.release());
PostLegacyJsonMessage("onDebugRegion", std::move(data));
}
@@ -414,7 +415,7 @@ void ChromotingInstance::OnConnectionState(
break;
}
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetString("state", protocol::ConnectionToHost::StateToString(state));
data->SetString("error", ConnectionErrorToString(error));
PostLegacyJsonMessage("onConnectionStatus", std::move(data));
@@ -430,7 +431,7 @@ void ChromotingInstance::FetchThirdPartyToken(
// So, it's impossible to reach this with a callback already registered.
DCHECK(third_party_token_fetched_callback_.is_null());
third_party_token_fetched_callback_ = token_fetched_callback;
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetString("tokenUrl", token_url);
data->SetString("hostPublicKey", host_public_key);
data->SetString("scope", scope);
@@ -438,14 +439,14 @@ void ChromotingInstance::FetchThirdPartyToken(
}
void ChromotingInstance::OnConnectionReady(bool ready) {
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetBoolean("ready", ready);
PostLegacyJsonMessage("onConnectionReady", std::move(data));
}
void ChromotingInstance::OnRouteChanged(const std::string& channel_name,
const protocol::TransportRoute& route) {
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetString("channel", channel_name);
data->SetString("connectionType",
protocol::TransportRoute::GetTypeString(route.type));
@@ -453,14 +454,14 @@ void ChromotingInstance::OnRouteChanged(const std::string& channel_name,
}
void ChromotingInstance::SetCapabilities(const std::string& capabilities) {
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetString("capabilities", capabilities);
PostLegacyJsonMessage("setCapabilities", std::move(data));
}
void ChromotingInstance::SetPairingResponse(
const protocol::PairingResponse& pairing_response) {
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetString("clientId", pairing_response.client_id());
data->SetString("sharedSecret", pairing_response.shared_secret());
PostLegacyJsonMessage("pairingResponse", std::move(data));
@@ -468,7 +469,7 @@ void ChromotingInstance::SetPairingResponse(
void ChromotingInstance::DeliverHostMessage(
const protocol::ExtensionMessage& message) {
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetString("type", message.type());
data->SetString("data", message.data());
PostLegacyJsonMessage("extensionMessage", std::move(data));
@@ -481,7 +482,7 @@ void ChromotingInstance::SetDesktopSize(const webrtc::DesktopSize& size,
mouse_input_filter_.set_output_size(size);
touch_input_scaler_.set_output_size(size);
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetInteger("width", size.width());
data->SetInteger("height", size.height());
data->SetInteger("x_dpi", dpi.x());
@@ -497,7 +498,7 @@ void ChromotingInstance::FetchSecretFromDialog(
// So, it's impossible to reach this with a callback already registered.
DCHECK(secret_fetched_callback_.is_null());
secret_fetched_callback_ = secret_fetched_callback;
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetBoolean("pairingSupported", pairing_supported);
PostLegacyJsonMessage("fetchPin", std::move(data));
}
@@ -521,7 +522,7 @@ protocol::CursorShapeStub* ChromotingInstance::GetCursorShapeStub() {
void ChromotingInstance::InjectClipboardEvent(
const protocol::ClipboardEvent& event) {
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetString("mimeType", event.mime_type());
data->SetString("item", event.data());
PostLegacyJsonMessage("injectClipboardItem", std::move(data));
@@ -656,7 +657,7 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
client_.reset(
new ChromotingClient(&context_, this, video_renderer_.get(),
- make_scoped_ptr(new PepperAudioPlayer(this))));
+ base::WrapUnique(new PepperAudioPlayer(this))));
// Setup the signal strategy.
signal_strategy_.reset(new DelegatingSignalStrategy(
@@ -667,13 +668,13 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
scoped_refptr<protocol::TransportContext> transport_context(
new protocol::TransportContext(
signal_strategy_.get(),
- make_scoped_ptr(new PepperPortAllocatorFactory(this)),
- make_scoped_ptr(new PepperUrlRequestFactory(this)),
+ base::WrapUnique(new PepperPortAllocatorFactory(this)),
+ base::WrapUnique(new PepperUrlRequestFactory(this)),
protocol::NetworkSettings(
protocol::NetworkSettings::NAT_TRAVERSAL_FULL),
protocol::TransportRole::CLIENT));
- scoped_ptr<protocol::CandidateSessionConfig> config =
+ std::unique_ptr<protocol::CandidateSessionConfig> config =
protocol::CandidateSessionConfig::CreateDefault();
if (std::find(experiments_list.begin(), experiments_list.end(), "vp9") !=
experiments_list.end()) {
@@ -981,7 +982,7 @@ void ChromotingInstance::PostChromotingMessage(const std::string& method,
void ChromotingInstance::PostLegacyJsonMessage(
const std::string& method,
- scoped_ptr<base::DictionaryValue> data) {
+ std::unique_ptr<base::DictionaryValue> data) {
base::DictionaryValue message;
message.SetString("method", method);
message.Set("data", data.release());
@@ -992,14 +993,14 @@ void ChromotingInstance::PostLegacyJsonMessage(
}
void ChromotingInstance::SendTrappedKey(uint32_t usb_keycode, bool pressed) {
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetInteger("usbKeycode", usb_keycode);
data->SetBoolean("pressed", pressed);
PostLegacyJsonMessage("trappedKeyEvent", std::move(data));
}
void ChromotingInstance::SendOutgoingIq(const std::string& iq) {
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetString("iq", iq);
PostLegacyJsonMessage("sendOutgoingIq", std::move(data));
}
@@ -1007,7 +1008,7 @@ void ChromotingInstance::SendOutgoingIq(const std::string& iq) {
void ChromotingInstance::UpdatePerfStatsInUI() {
// Fetch performance stats from the VideoRenderer and send them to the client
// for display to users.
- scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
data->SetDouble("videoBandwidth", perf_tracker_.video_bandwidth());
data->SetDouble("videoFrameRate", perf_tracker_.video_frame_rate());
data->SetDouble("captureLatency", perf_tracker_.video_capture_ms().Average());
« no previous file with comments | « remoting/client/plugin/chromoting_instance.h ('k') | remoting/client/plugin/delegating_signal_strategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698