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

Unified Diff: components/nacl/loader/nacl_ipc_adapter.cc

Issue 472073003: Pepper: Make pending_sync_msgs_ local to IO thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/nacl/loader/nacl_ipc_adapter.cc
diff --git a/components/nacl/loader/nacl_ipc_adapter.cc b/components/nacl/loader/nacl_ipc_adapter.cc
index d3160e4e51e09b7fd27baa4a3d1c47f041e60a5b..714cfc829805fa903a854921cd5f3963515dc38e 100644
--- a/components/nacl/loader/nacl_ipc_adapter.cc
+++ b/components/nacl/loader/nacl_ipc_adapter.cc
@@ -464,15 +464,28 @@ int NaClIPCAdapter::TakeClientFileDescriptor() {
#endif
bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) {
+ uint32_t type = msg.type();
+ if (type == IPC_REPLY_ID) {
+ int id = IPC::SyncMessage::GetMessageId(msg);
+ IOThreadData::PendingSyncMsgMap::iterator it =
+ io_thread_data_.pending_sync_msgs_.find(id);
+ DCHECK(it != io_thread_data_.pending_sync_msgs_.end());
+ if (it != io_thread_data_.pending_sync_msgs_.end()) {
+ type = it->second;
+ io_thread_data_.pending_sync_msgs_.erase(it);
+ }
+ }
+
{
base::AutoLock lock(lock_);
-
scoped_refptr<RewrittenMessage> rewritten_msg(new RewrittenMessage);
typedef std::vector<ppapi::proxy::SerializedHandle> Handles;
Handles handles;
scoped_ptr<IPC::Message> new_msg;
- if (!locked_data_.nacl_msg_scanner_.ScanMessage(msg, &handles, &new_msg))
+
+ if (!locked_data_.nacl_msg_scanner_.ScanMessage(
+ msg, type, &handles, &new_msg))
return false;
// Now add any descriptors we found to rewritten_msg. |handles| is usually
@@ -646,6 +659,11 @@ void NaClIPCAdapter::CloseChannelOnIOThread() {
}
void NaClIPCAdapter::SendMessageOnIOThread(scoped_ptr<IPC::Message> message) {
+ int id = IPC::SyncMessage::GetMessageId(*message.get());
+ DCHECK(io_thread_data_.pending_sync_msgs_.find(id) ==
+ io_thread_data_.pending_sync_msgs_.end());
+
+ io_thread_data_.pending_sync_msgs_[id] = message->type();
dmichael (off chromium) 2014/08/18 20:06:09 It kind of looks like you are adding the id to the
io_thread_data_.channel_->Send(message.release());
}

Powered by Google App Engine
This is Rietveld 408576698