Index: content/browser/browser_plugin/browser_plugin_guest.cc |
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc |
index bcb8464383290287d0f6998aa759a6589b3020f2..a3ae85678e4d1b4d2398d1e5ec7c705ee953fb77 100644 |
--- a/content/browser/browser_plugin/browser_plugin_guest.cc |
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc |
@@ -9,6 +9,7 @@ |
#include <algorithm> |
#include "base/macros.h" |
+#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.h" |
#include "base/pickle.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -501,7 +502,7 @@ void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { |
// As a result, we must save all these IPCs until attachment and then |
// forward them so that the embedder gets a chance to see and process |
// the load events. |
- pending_messages_.push_back(linked_ptr<IPC::Message>(msg)); |
+ pending_messages_.push_back(base::WrapUnique(msg)); |
return; |
} |
owner_web_contents_->Send(msg); |
@@ -556,19 +557,19 @@ void BrowserPluginGuest::EmbedderSystemDragEnded() { |
// as in https://codereview.chromium.org/1404353004/ once all Chrome platforms |
// support this. https://crbug.com/544212 |
IPC::Message* BrowserPluginGuest::UpdateInstanceIdIfNecessary( |
- IPC::Message* msg) const { |
- DCHECK(msg); |
+ std::unique_ptr<IPC::Message> msg) const { |
+ DCHECK(msg.get()); |
int msg_browser_plugin_instance_id = browser_plugin::kInstanceIDNone; |
- base::PickleIterator iter(*msg); |
+ base::PickleIterator iter(*msg.get()); |
if (!iter.ReadInt(&msg_browser_plugin_instance_id) || |
msg_browser_plugin_instance_id != browser_plugin::kInstanceIDNone) { |
- return msg; |
+ return msg.release(); |
Avi (use Gerrit)
2016/10/19 18:08:23
What?
It makes little sense to have the parameter
|
} |
// This method may be called with no browser_plugin_instance_id in tests. |
if (!browser_plugin_instance_id()) |
- return msg; |
+ return msg.release(); |
Avi (use Gerrit)
2016/10/19 18:08:23
ditto
|
std::unique_ptr<IPC::Message> new_msg( |
new IPC::Message(msg->routing_id(), msg->type(), msg->priority())); |
@@ -588,7 +589,6 @@ IPC::Message* BrowserPluginGuest::UpdateInstanceIdIfNecessary( |
CHECK(write_success) |
<< "Unexpected failure writing remaining IPC::Message payload."; |
- delete msg; |
return new_msg.release(); |
Avi (use Gerrit)
2016/10/19 18:08:23
All paths out of this function return a unique_ptr
limasdf
2016/10/20 12:09:02
Done.
|
} |
@@ -597,10 +597,10 @@ void BrowserPluginGuest::SendQueuedMessages() { |
return; |
while (!pending_messages_.empty()) { |
- linked_ptr<IPC::Message> message_ptr = pending_messages_.front(); |
+ std::unique_ptr<IPC::Message> message_ptr = |
+ std::move(pending_messages_.front()); |
pending_messages_.pop_front(); |
- SendMessageToEmbedder( |
- UpdateInstanceIdIfNecessary(message_ptr.release())); |
+ SendMessageToEmbedder(UpdateInstanceIdIfNecessary(std::move(message_ptr))); |
Avi (use Gerrit)
2016/10/19 18:10:32
And it all comes together here. Have UpdateInstanc
limasdf
2016/10/20 12:09:02
Done.
|
} |
} |