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

Unified Diff: tools/ipc_fuzzer/message_lib/message_file_reader.cc

Issue 2972773004: Remove ScopedVector from tools/ipc_fuzzer/. (Closed)
Patch Set: rev Created 3 years, 5 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 | « tools/ipc_fuzzer/message_lib/message_file.h ('k') | tools/ipc_fuzzer/message_lib/message_file_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ipc_fuzzer/message_lib/message_file_reader.cc
diff --git a/tools/ipc_fuzzer/message_lib/message_file_reader.cc b/tools/ipc_fuzzer/message_lib/message_file_reader.cc
index b7cb05a87415fdcea8c63afdb01eb75e2b9d4761..e41f4f79bee1ced3ff35eb4dd9918cbd6ae39b3f 100644
--- a/tools/ipc_fuzzer/message_lib/message_file_reader.cc
+++ b/tools/ipc_fuzzer/message_lib/message_file_reader.cc
@@ -10,6 +10,7 @@
#include "base/files/memory_mapped_file.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_piece.h"
#include "ipc/ipc_message.h"
#include "tools/ipc_fuzzer/message_lib/message_cracker.h"
@@ -127,8 +128,7 @@ bool Reader::ReadMessages() {
// Copy is necessary to fix message type later.
IPC::Message const_message(begin, msglen);
- IPC::Message* message = new IPC::Message(const_message);
- messages_->push_back(message);
+ messages_->push_back(base::MakeUnique<IPC::Message>(const_message));
file_data_.remove_prefix(msglen);
}
return true;
@@ -195,13 +195,12 @@ bool Reader::RemoveUnknownMessages() {
// increase the lifetime of message files. This is only a partial fix because
// message arguments and structure layouts can change as well.
void Reader::FixMessageTypes() {
- for (MessageVector::iterator it = messages_->begin();
- it != messages_->end(); ++it) {
- uint32_t type = (*it)->type();
+ for (const auto& message : *messages_) {
+ uint32_t type = message->type();
const std::string& name = name_map_.TypeToName(type);
uint32_t correct_type = MessageNames::GetInstance()->NameToType(name);
if (type != correct_type)
- MessageCracker::SetMessageType(*it, correct_type);
+ MessageCracker::SetMessageType(message.get(), correct_type);
}
}
« no previous file with comments | « tools/ipc_fuzzer/message_lib/message_file.h ('k') | tools/ipc_fuzzer/message_lib/message_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698