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

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

Issue 23688004: Change the PepperInProcessRouter to defer resource destruction messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Follow previous behavior more closely. Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/pepper/pepper_in_process_router.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/public/renderer/render_thread.h" 9 #include "content/public/renderer/render_thread.h"
10 #include "content/public/renderer/render_view.h" 10 #include "content/public/renderer/render_view.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // the message. 103 // the message.
104 if (resource) 104 if (resource)
105 resource->OnReplyReceived(reply_params, nested_msg); 105 resource->OnReplyReceived(reply_params, nested_msg);
106 return true; 106 return true;
107 } 107 }
108 108
109 bool PepperInProcessRouter::SendToHost(IPC::Message* msg) { 109 bool PepperInProcessRouter::SendToHost(IPC::Message* msg) {
110 scoped_ptr<IPC::Message> message(msg); 110 scoped_ptr<IPC::Message> message(msg);
111 111
112 if (!message->is_sync()) { 112 if (!message->is_sync()) {
113 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message); 113 if (message->type() == PpapiHostMsg_ResourceDestroyed::ID) {
dmichael (off chromium) 2013/09/11 15:44:17 I think this deserves a beefier comment. Maybe ref
114 DCHECK(result) << "The message was not handled by the host."; 114 // Dispatch host messages from the message loop.
115 return true; 115 base::MessageLoop::current()->PostTask(
116 FROM_HERE,
117 base::Bind(&PepperInProcessRouter::DispatchHostMsg,
118 weak_factory_.GetWeakPtr(),
119 base::Owned(message.release())));
120 return true;
121 } else {
122 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message);
123 DCHECK(result) << "The message was not handled by the host.";
124 return true;
125 }
116 } 126 }
117 127
118 pending_message_id_ = IPC::SyncMessage::GetMessageId(*message); 128 pending_message_id_ = IPC::SyncMessage::GetMessageId(*message);
119 reply_deserializer_.reset( 129 reply_deserializer_.reset(
120 static_cast<IPC::SyncMessage*>(message.get())->GetReplyDeserializer()); 130 static_cast<IPC::SyncMessage*>(message.get())->GetReplyDeserializer());
121 reply_result_ = false; 131 reply_result_ = false;
122 132
123 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message); 133 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message);
124 DCHECK(result) << "The message was not handled by the host."; 134 DCHECK(result) << "The message was not handled by the host.";
125 135
(...skipping 13 matching lines...) Expand all
139 // Dispatch plugin messages from the message loop. 149 // Dispatch plugin messages from the message loop.
140 base::MessageLoop::current()->PostTask( 150 base::MessageLoop::current()->PostTask(
141 FROM_HERE, 151 FROM_HERE,
142 base::Bind(&PepperInProcessRouter::DispatchPluginMsg, 152 base::Bind(&PepperInProcessRouter::DispatchPluginMsg,
143 weak_factory_.GetWeakPtr(), 153 weak_factory_.GetWeakPtr(),
144 base::Owned(message.release()))); 154 base::Owned(message.release())));
145 } 155 }
146 return true; 156 return true;
147 } 157 }
148 158
159 void PepperInProcessRouter::DispatchHostMsg(IPC::Message* msg) {
160 bool handled = host_impl_->GetPpapiHost()->OnMessageReceived(*msg);
161 DCHECK(handled);
162 }
163
149 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) { 164 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) {
150 bool handled = OnPluginMsgReceived(*msg); 165 bool handled = OnPluginMsgReceived(*msg);
151 DCHECK(handled); 166 DCHECK(handled);
152 } 167 }
153 168
154 bool PepperInProcessRouter::SendToBrowser(IPC::Message *msg) { 169 bool PepperInProcessRouter::SendToBrowser(IPC::Message *msg) {
155 return RenderThread::Get()->Send(msg); 170 return RenderThread::Get()->Send(msg);
156 } 171 }
157 172
158 } // namespace content 173 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_in_process_router.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698