OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message); | 80 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message); |
81 DCHECK(result) << "The message was not handled by the host."; | 81 DCHECK(result) << "The message was not handled by the host."; |
82 | 82 |
83 pending_message_id_ = 0; | 83 pending_message_id_ = 0; |
84 reply_deserializer_.reset(NULL); | 84 reply_deserializer_.reset(NULL); |
85 return reply_result_; | 85 return reply_result_; |
86 } | 86 } |
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 if (msg->is_sync()) { | 90 CHECK(!msg->is_sync()); |
91 CHECK(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 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()))); |
(...skipping 25 matching lines...) Expand all Loading... |
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 |
OLD | NEW |