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

Side by Side Diff: content/renderer/pepper/pepper_in_process_router.cc

Issue 1873783003: Convert //content/renderer 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/pepper/pepper_in_process_router.h" 5 #include "content/renderer/pepper/pepper_in_process_router.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 ppapi::PpapiGlobals::Get()->GetResourceTracker()->GetResource( 94 ppapi::PpapiGlobals::Get()->GetResourceTracker()->GetResource(
95 reply_params.pp_resource()); 95 reply_params.pp_resource());
96 // If the resource doesn't exist, it may have been destroyed so just ignore 96 // If the resource doesn't exist, it may have been destroyed so just ignore
97 // the message. 97 // the message.
98 if (resource) 98 if (resource)
99 resource->OnReplyReceived(reply_params, nested_msg); 99 resource->OnReplyReceived(reply_params, nested_msg);
100 return true; 100 return true;
101 } 101 }
102 102
103 bool PepperInProcessRouter::SendToHost(IPC::Message* msg) { 103 bool PepperInProcessRouter::SendToHost(IPC::Message* msg) {
104 scoped_ptr<IPC::Message> message(msg); 104 std::unique_ptr<IPC::Message> message(msg);
105 105
106 if (!message->is_sync()) { 106 if (!message->is_sync()) {
107 // If this is a resource destroyed message, post a task to dispatch it. 107 // If this is a resource destroyed message, post a task to dispatch it.
108 // Dispatching it synchronously can cause the host to re-enter the proxy 108 // Dispatching it synchronously can cause the host to re-enter the proxy
109 // code while we're still in the resource destructor, leading to a crash. 109 // code while we're still in the resource destructor, leading to a crash.
110 // http://crbug.com/276368. 110 // http://crbug.com/276368.
111 // This won't cause message reordering problems because the resource 111 // This won't cause message reordering problems because the resource
112 // destroyed message is always the last one sent for a resource. 112 // destroyed message is always the last one sent for a resource.
113 if (message->type() == PpapiHostMsg_ResourceDestroyed::ID) { 113 if (message->type() == PpapiHostMsg_ResourceDestroyed::ID) {
114 base::ThreadTaskRunnerHandle::Get()->PostTask( 114 base::ThreadTaskRunnerHandle::Get()->PostTask(
(...skipping 15 matching lines...) Expand all
130 130
131 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message); 131 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message);
132 DCHECK(result) << "The message was not handled by the host."; 132 DCHECK(result) << "The message was not handled by the host.";
133 133
134 pending_message_id_ = 0; 134 pending_message_id_ = 0;
135 reply_deserializer_.reset(NULL); 135 reply_deserializer_.reset(NULL);
136 return reply_result_; 136 return reply_result_;
137 } 137 }
138 138
139 bool PepperInProcessRouter::SendToPlugin(IPC::Message* msg) { 139 bool PepperInProcessRouter::SendToPlugin(IPC::Message* msg) {
140 scoped_ptr<IPC::Message> message(msg); 140 std::unique_ptr<IPC::Message> message(msg);
141 CHECK(!msg->is_sync()); 141 CHECK(!msg->is_sync());
142 if (IPC::SyncMessage::IsMessageReplyTo(*message, pending_message_id_)) { 142 if (IPC::SyncMessage::IsMessageReplyTo(*message, pending_message_id_)) {
143 if (!msg->is_reply_error()) 143 if (!msg->is_reply_error())
144 reply_result_ = reply_deserializer_->SerializeOutputParameters(*message); 144 reply_result_ = reply_deserializer_->SerializeOutputParameters(*message);
145 } else { 145 } else {
146 CHECK(!pending_message_id_); 146 CHECK(!pending_message_id_);
147 // Dispatch plugin messages from the message loop. 147 // Dispatch plugin messages from the message loop.
148 base::ThreadTaskRunnerHandle::Get()->PostTask( 148 base::ThreadTaskRunnerHandle::Get()->PostTask(
149 FROM_HERE, 149 FROM_HERE,
150 base::Bind(&PepperInProcessRouter::DispatchPluginMsg, 150 base::Bind(&PepperInProcessRouter::DispatchPluginMsg,
(...skipping 10 matching lines...) Expand all
161 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) { 161 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) {
162 bool handled = OnPluginMsgReceived(*msg); 162 bool handled = OnPluginMsgReceived(*msg);
163 DCHECK(handled); 163 DCHECK(handled);
164 } 164 }
165 165
166 bool PepperInProcessRouter::SendToBrowser(IPC::Message* msg) { 166 bool PepperInProcessRouter::SendToBrowser(IPC::Message* msg) {
167 return RenderThread::Get()->Send(msg); 167 return RenderThread::Get()->Send(msg);
168 } 168 }
169 169
170 } // namespace content 170 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_in_process_router.h ('k') | content/renderer/pepper/pepper_media_stream_audio_track_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698