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

Unified Diff: content/renderer/gpu/frame_swap_message_queue.cc

Issue 2435863004: Remove stl_util's deletion function use from content/. (Closed)
Patch Set: minus service worker Created 4 years, 2 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
Index: content/renderer/gpu/frame_swap_message_queue.cc
diff --git a/content/renderer/gpu/frame_swap_message_queue.cc b/content/renderer/gpu/frame_swap_message_queue.cc
index 58719d6091238a1aa2cb3f1ce7244c12f89fd7fa..b6c1466cc5e63f4820947cecf589c55e83f91b05 100644
--- a/content/renderer/gpu/frame_swap_message_queue.cc
+++ b/content/renderer/gpu/frame_swap_message_queue.cc
@@ -6,6 +6,7 @@
#include <algorithm>
#include <limits>
+#include <memory>
#include <utility>
#include "base/containers/hash_tables.h"
@@ -49,14 +50,9 @@ class SendMessageScopeImpl : public FrameSwapMessageQueue::SendMessageScope {
class VisualStateQueue : public FrameSwapMessageSubQueue {
public:
- VisualStateQueue() {}
+ VisualStateQueue() = default;
- ~VisualStateQueue() override {
- for (VisualStateQueueMap::iterator i = queue_.begin(); i != queue_.end();
- i++) {
- base::STLDeleteElements(&i->second);
- }
- }
+ ~VisualStateQueue() override = default;
bool Empty() const override { return queue_.empty(); }
@@ -66,7 +62,7 @@ class VisualStateQueue : public FrameSwapMessageSubQueue {
if (is_first)
*is_first = (queue_.count(source_frame_number) == 0);
- queue_[source_frame_number].push_back(msg.release());
+ queue_[source_frame_number].push_back(std::move(msg));
}
void DrainMessages(
@@ -75,17 +71,14 @@ class VisualStateQueue : public FrameSwapMessageSubQueue {
auto end = queue_.upper_bound(source_frame_number);
for (auto i = queue_.begin(); i != end; i++) {
DCHECK(i->first <= source_frame_number);
- for (IPC::Message* msg : i->second) {
- messages->push_back(base::WrapUnique(msg));
- }
- i->second.clear();
+ std::move(i->second.begin(), i->second.end(),
+ std::back_inserter(*messages));
}
queue_.erase(queue_.begin(), end);
}
private:
- typedef std::map<int, std::vector<IPC::Message*> > VisualStateQueueMap;
- VisualStateQueueMap queue_;
+ std::map<int, std::vector<std::unique_ptr<IPC::Message>>> queue_;
DISALLOW_COPY_AND_ASSIGN(VisualStateQueue);
};
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.cc ('k') | content/renderer/media/rtc_peer_connection_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698