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

Unified Diff: media/cast/test/sender.cc

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « media/cast/test/receiver.cc ('k') | media/cast/test/simulator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/test/sender.cc
diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc
index 8750634c98ef7cf1358354c94e9d5377a687ec00..842440baa6a205118068c18076fd920b8a020e6e 100644
--- a/media/cast/test/sender.cc
+++ b/media/cast/test/sender.cc
@@ -6,6 +6,8 @@
// or read from a file.
#include <stdint.h>
+
+#include <memory>
#include <queue>
#include <utility>
@@ -15,7 +17,7 @@
#include "base/files/file_path.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread.h"
@@ -91,7 +93,7 @@ void DumpLoggingData(const media::cast::proto::LogMetadata& log_metadata,
VLOG(0) << "Frame map size: " << frame_events.size();
VLOG(0) << "Packet map size: " << packet_events.size();
- scoped_ptr<char[]> event_log(new char[kMaxSerializedLogBytes]);
+ std::unique_ptr<char[]> event_log(new char[kMaxSerializedLogBytes]);
int event_log_bytes;
if (!media::cast::SerializeEvents(log_metadata,
frame_events,
@@ -113,8 +115,10 @@ void DumpLoggingData(const media::cast::proto::LogMetadata& log_metadata,
void WriteLogsToFileAndDestroySubscribers(
const scoped_refptr<media::cast::CastEnvironment>& cast_environment,
- scoped_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber,
- scoped_ptr<media::cast::EncodingEventSubscriber> audio_event_subscriber,
+ std::unique_ptr<media::cast::EncodingEventSubscriber>
+ video_event_subscriber,
+ std::unique_ptr<media::cast::EncodingEventSubscriber>
+ audio_event_subscriber,
base::ScopedFILE video_log_file,
base::ScopedFILE audio_log_file) {
cast_environment->logger()->Unsubscribe(video_event_subscriber.get());
@@ -140,14 +144,15 @@ void WriteLogsToFileAndDestroySubscribers(
void WriteStatsAndDestroySubscribers(
const scoped_refptr<media::cast::CastEnvironment>& cast_environment,
- scoped_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber,
- scoped_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber,
- scoped_ptr<media::cast::ReceiverTimeOffsetEstimatorImpl> estimator) {
+ std::unique_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber,
+ std::unique_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber,
+ std::unique_ptr<media::cast::ReceiverTimeOffsetEstimatorImpl> estimator) {
cast_environment->logger()->Unsubscribe(video_stats_subscriber.get());
cast_environment->logger()->Unsubscribe(audio_stats_subscriber.get());
cast_environment->logger()->Unsubscribe(estimator.get());
- scoped_ptr<base::DictionaryValue> stats = video_stats_subscriber->GetStats();
+ std::unique_ptr<base::DictionaryValue> stats =
+ video_stats_subscriber->GetStats();
std::string json;
base::JSONWriter::WriteWithOptions(
*stats, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
@@ -170,13 +175,14 @@ class TransportClient : public media::cast::CastTransport::Client {
VLOG(1) << "Transport status: " << status;
};
void OnLoggingEventsReceived(
- scoped_ptr<std::vector<media::cast::FrameEvent>> frame_events,
- scoped_ptr<std::vector<media::cast::PacketEvent>> packet_events) final {
+ std::unique_ptr<std::vector<media::cast::FrameEvent>> frame_events,
+ std::unique_ptr<std::vector<media::cast::PacketEvent>> packet_events)
+ final {
DCHECK(log_event_dispatcher_);
log_event_dispatcher_->DispatchBatchOfEvents(std::move(frame_events),
std::move(packet_events));
};
- void ProcessRtpPacket(scoped_ptr<media::cast::Packet> packet) final {}
+ void ProcessRtpPacket(std::unique_ptr<media::cast::Packet> packet) final {}
private:
media::cast::LogEventDispatcher* const
@@ -231,18 +237,15 @@ int main(int argc, char** argv) {
// Running transport on the main thread.
scoped_refptr<media::cast::CastEnvironment> cast_environment(
new media::cast::CastEnvironment(
- make_scoped_ptr<base::TickClock>(new base::DefaultTickClock()),
- io_message_loop.task_runner(),
- audio_thread.task_runner(),
+ base::WrapUnique<base::TickClock>(new base::DefaultTickClock()),
+ io_message_loop.task_runner(), audio_thread.task_runner(),
video_thread.task_runner()));
// SendProcess initialization.
- scoped_ptr<media::cast::FakeMediaSource> fake_media_source(
+ std::unique_ptr<media::cast::FakeMediaSource> fake_media_source(
new media::cast::FakeMediaSource(test_thread.task_runner(),
- cast_environment->Clock(),
- audio_config,
- video_config,
- false));
+ cast_environment->Clock(), audio_config,
+ video_config, false));
int final_fps = 0;
if (!base::StringToInt(cmd->GetSwitchValueASCII(kSwitchFps),
@@ -258,18 +261,18 @@ int main(int argc, char** argv) {
fake_media_source->SetVariableFrameSizeMode(true);
// CastTransport initialization.
- scoped_ptr<media::cast::CastTransport> transport_sender =
+ std::unique_ptr<media::cast::CastTransport> transport_sender =
media::cast::CastTransport::Create(
cast_environment->Clock(), base::TimeDelta::FromSeconds(1),
- make_scoped_ptr(new TransportClient(cast_environment->logger())),
- make_scoped_ptr(new media::cast::UdpTransport(
+ base::WrapUnique(new TransportClient(cast_environment->logger())),
+ base::WrapUnique(new media::cast::UdpTransport(
nullptr, io_message_loop.task_runner(), net::IPEndPoint(),
remote_endpoint, base::Bind(&UpdateCastTransportStatus))),
io_message_loop.task_runner());
// Set up event subscribers.
- scoped_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber;
- scoped_ptr<media::cast::EncodingEventSubscriber> audio_event_subscriber;
+ std::unique_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber;
+ std::unique_ptr<media::cast::EncodingEventSubscriber> audio_event_subscriber;
std::string video_log_file_name("/tmp/video_events.log.gz");
std::string audio_log_file_name("/tmp/audio_events.log.gz");
LOG(INFO) << "Logging audio events to: " << audio_log_file_name;
@@ -282,14 +285,14 @@ int main(int argc, char** argv) {
cast_environment->logger()->Subscribe(audio_event_subscriber.get());
// Subscribers for stats.
- scoped_ptr<media::cast::ReceiverTimeOffsetEstimatorImpl> offset_estimator(
- new media::cast::ReceiverTimeOffsetEstimatorImpl());
+ std::unique_ptr<media::cast::ReceiverTimeOffsetEstimatorImpl>
+ offset_estimator(new media::cast::ReceiverTimeOffsetEstimatorImpl());
cast_environment->logger()->Subscribe(offset_estimator.get());
- scoped_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber(
+ std::unique_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber(
new media::cast::StatsEventSubscriber(media::cast::VIDEO_EVENT,
cast_environment->Clock(),
offset_estimator.get()));
- scoped_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber(
+ std::unique_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber(
new media::cast::StatsEventSubscriber(media::cast::AUDIO_EVENT,
cast_environment->Clock(),
offset_estimator.get()));
@@ -329,7 +332,7 @@ int main(int argc, char** argv) {
base::TimeDelta::FromSeconds(logging_duration_seconds));
// CastSender initialization.
- scoped_ptr<media::cast::CastSender> cast_sender =
+ std::unique_ptr<media::cast::CastSender> cast_sender =
media::cast::CastSender::Create(cast_environment, transport_sender.get());
io_message_loop.PostTask(
FROM_HERE,
« no previous file with comments | « media/cast/test/receiver.cc ('k') | media/cast/test/simulator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698