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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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
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.h" 8 #include "base/message_loop.h"
9 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" 9 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 bool PepperInProcessRouter::SendToPlugin(IPC::Message* msg) { 88 bool PepperInProcessRouter::SendToPlugin(IPC::Message* msg) {
89 scoped_ptr<IPC::Message> message(msg); 89 scoped_ptr<IPC::Message> message(msg);
90 CHECK(!msg->is_sync()); 90 CHECK(!msg->is_sync());
91 if (IPC::SyncMessage::IsMessageReplyTo(*message, pending_message_id_)) { 91 if (IPC::SyncMessage::IsMessageReplyTo(*message, pending_message_id_)) {
92 if (!msg->is_reply_error()) 92 if (!msg->is_reply_error())
93 reply_result_ = reply_deserializer_->SerializeOutputParameters(*message); 93 reply_result_ = reply_deserializer_->SerializeOutputParameters(*message);
94 } else { 94 } else {
95 CHECK(!pending_message_id_); 95 CHECK(!pending_message_id_);
96 // Dispatch plugin messages from the message loop. 96 // Dispatch plugin messages from the message loop.
97 MessageLoop::current()->PostTask( 97 base::MessageLoop::current()->PostTask(
98 FROM_HERE, 98 FROM_HERE,
99 base::Bind(&PepperInProcessRouter::DispatchPluginMsg, 99 base::Bind(&PepperInProcessRouter::DispatchPluginMsg,
100 weak_factory_.GetWeakPtr(), 100 weak_factory_.GetWeakPtr(),
101 base::Owned(message.release()))); 101 base::Owned(message.release())));
102 } 102 }
103 return true; 103 return true;
104 } 104 }
105 105
106 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) { 106 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) {
107 // Emulate the proxy by dispatching the relevant message here. 107 // Emulate the proxy by dispatching the relevant message here.
108 bool handled = true; 108 bool handled = true;
109 IPC_BEGIN_MESSAGE_MAP(PepperInProcessRouter, *msg) 109 IPC_BEGIN_MESSAGE_MAP(PepperInProcessRouter, *msg)
110 IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnResourceReply) 110 IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnResourceReply)
111 IPC_MESSAGE_UNHANDLED(handled = false) 111 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 15 matching lines...) Expand all
127 reply_params.pp_resource()); 127 reply_params.pp_resource());
128 if (!resource) { 128 if (!resource) {
129 // The resource could have been destroyed while the async processing was 129 // The resource could have been destroyed while the async processing was
130 // pending. Just drop the message. 130 // pending. Just drop the message.
131 return; 131 return;
132 } 132 }
133 resource->OnReplyReceived(reply_params, nested_msg); 133 resource->OnReplyReceived(reply_params, nested_msg);
134 } 134 }
135 135
136 } // namespace content 136 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_graphics_2d_host.cc ('k') | content/renderer/pepper/pepper_plugin_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698