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

Unified Diff: media/gpu/video_encode_accelerator_unittest.cc

Issue 2893953002: Revert of Remove ScopedVector from all other codes in media/ (Closed)
Patch Set: Created 3 years, 7 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/gpu/jpeg_decode_accelerator_unittest.cc ('k') | media/midi/midi_device_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/video_encode_accelerator_unittest.cc
diff --git a/media/gpu/video_encode_accelerator_unittest.cc b/media/gpu/video_encode_accelerator_unittest.cc
index 6cf9d3af93a93e008c2dffa1d96b98ed6a722931..cdb9984aa44e992106c82837ec796268213b55aa 100644
--- a/media/gpu/video_encode_accelerator_unittest.cc
+++ b/media/gpu/video_encode_accelerator_unittest.cc
@@ -19,8 +19,8 @@
#include "base/files/file_util.h"
#include "base/macros.h"
#include "base/memory/aligned_memory.h"
-#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/numerics/safe_conversions.h"
@@ -380,9 +380,8 @@
// Parse |data| into its constituent parts, set the various output fields
// accordingly, read in video stream, and store them to |test_streams|.
-static void ParseAndReadTestStreamData(
- const base::FilePath::StringType& data,
- std::vector<std::unique_ptr<TestStream>>* test_streams) {
+static void ParseAndReadTestStreamData(const base::FilePath::StringType& data,
+ ScopedVector<TestStream>* test_streams) {
// Split the string to individual test stream data.
std::vector<base::FilePath::StringType> test_streams_data =
base::SplitString(data, base::FilePath::StringType(1, ';'),
@@ -402,7 +401,7 @@
}
LOG_ASSERT(fields.size() >= 4U) << data;
LOG_ASSERT(fields.size() <= 9U) << data;
- auto test_stream = base::MakeUnique<TestStream>();
+ TestStream* test_stream = new TestStream();
test_stream->in_filename = FilePathStringTypeToString(fields[0]);
int width, height;
@@ -439,7 +438,7 @@
LOG_ASSERT(base::StringToUint(
fields[8], &test_stream->requested_subsequent_framerate));
}
- test_streams->push_back(std::move(test_stream));
+ test_streams->push_back(test_stream);
}
}
@@ -546,7 +545,7 @@
// switch "--verify_all_output".
bool verify_all_output() const { return verify_all_output_; }
- std::vector<std::unique_ptr<TestStream>> test_streams_;
+ ScopedVector<TestStream> test_streams_;
private:
std::unique_ptr<base::FilePath::StringType> test_stream_data_;
@@ -924,7 +923,7 @@
// All methods of this class should be run on the same thread.
base::ThreadChecker thread_checker_;
- std::vector<std::unique_ptr<base::SharedMemory>> output_shms_;
+ ScopedVector<base::SharedMemory> output_shms_;
int32_t next_output_buffer_id_;
};
@@ -1407,10 +1406,10 @@
ASSERT_GT(output_buffer_size_, 0UL);
for (unsigned int i = 0; i < kNumOutputBuffers; ++i) {
- auto shm = base::MakeUnique<base::SharedMemory>();
+ base::SharedMemory* shm = new base::SharedMemory();
LOG_ASSERT(shm->CreateAndMapAnonymous(output_buffer_size_));
- FeedEncoderWithOutput(shm.get());
- output_shms_.push_back(std::move(shm));
+ output_shms_.push_back(shm);
+ FeedEncoderWithOutput(shm);
}
if (g_env->run_at_fps()) {
@@ -1903,10 +1902,10 @@
ASSERT_GT(output_size, 0UL);
for (unsigned int i = 0; i < kNumOutputBuffers; ++i) {
- auto shm = base::MakeUnique<base::SharedMemory>();
+ base::SharedMemory* shm = new base::SharedMemory();
LOG_ASSERT(shm->CreateAndMapAnonymous(output_size));
- FeedEncoderWithOutput(shm.get(), output_size);
- output_shms_.push_back(std::move(shm));
+ output_shms_.push_back(shm);
+ FeedEncoderWithOutput(shm, output_size);
}
}
@@ -2086,8 +2085,8 @@
std::get<7>(GetParam()) || g_env->verify_all_output();
const bool verify_output_timestamp = std::get<8>(GetParam());
- std::vector<std::unique_ptr<ClientStateNotification<ClientState>>> notes;
- std::vector<std::unique_ptr<VEAClient>> clients;
+ ScopedVector<ClientStateNotification<ClientState>> notes;
+ ScopedVector<VEAClient> clients;
base::Thread vea_client_thread("EncoderClientThread");
ASSERT_TRUE(vea_client_thread.Start());
@@ -2102,16 +2101,16 @@
(save_to_file &&
!g_env->test_streams_[test_stream_index]->out_filename.empty());
- notes.push_back(base::MakeUnique<ClientStateNotification<ClientState>>());
- clients.push_back(base::MakeUnique<VEAClient>(
- g_env->test_streams_[test_stream_index].get(), notes.back().get(),
+ notes.push_back(new ClientStateNotification<ClientState>());
+ clients.push_back(new VEAClient(
+ g_env->test_streams_[test_stream_index], notes.back(),
encoder_save_to_file, keyframe_period, force_bitrate, test_perf,
mid_stream_bitrate_switch, mid_stream_framerate_switch, verify_output,
verify_output_timestamp));
vea_client_thread.task_runner()->PostTask(
FROM_HERE, base::Bind(&VEAClient::CreateEncoder,
- base::Unretained(clients.back().get())));
+ base::Unretained(clients.back())));
}
// All encoders must pass through states in this order.
@@ -2136,8 +2135,8 @@
for (size_t i = 0; i < num_concurrent_encoders; ++i) {
vea_client_thread.task_runner()->PostTask(
- FROM_HERE, base::Bind(&VEAClient::DestroyEncoder,
- base::Unretained(clients[i].get())));
+ FROM_HERE,
+ base::Bind(&VEAClient::DestroyEncoder, base::Unretained(clients[i])));
}
// This ensures all tasks have finished.
« no previous file with comments | « media/gpu/jpeg_decode_accelerator_unittest.cc ('k') | media/midi/midi_device_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698