| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/quota_message_filter.h" | 5 #include "content/child/quota_message_filter.h" |
| 6 | 6 |
| 7 #include "content/child/quota_dispatcher.h" | 7 #include "content/child/quota_dispatcher.h" |
| 8 #include "content/common/quota_messages.h" | 8 #include "content/common/quota_messages.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 void QuotaMessageFilter::OnFilteredMessageReceived(const IPC::Message& msg) { | 39 void QuotaMessageFilter::OnFilteredMessageReceived(const IPC::Message& msg) { |
| 40 QuotaDispatcher::ThreadSpecificInstance(thread_safe_sender(), this) | 40 QuotaDispatcher::ThreadSpecificInstance(thread_safe_sender(), this) |
| 41 ->OnMessageReceived(msg); | 41 ->OnMessageReceived(msg); |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool QuotaMessageFilter::GetWorkerThreadIdForMessage(const IPC::Message& msg, | 44 bool QuotaMessageFilter::GetWorkerThreadIdForMessage(const IPC::Message& msg, |
| 45 int* ipc_thread_id) { | 45 int* ipc_thread_id) { |
| 46 int request_id = -1; | 46 int request_id = -1; |
| 47 const bool success = PickleIterator(msg).ReadInt(&request_id); | 47 const bool success = base::PickleIterator(msg).ReadInt(&request_id); |
| 48 DCHECK(success); | 48 DCHECK(success); |
| 49 | 49 |
| 50 base::AutoLock lock(request_id_map_lock_); | 50 base::AutoLock lock(request_id_map_lock_); |
| 51 RequestIdToThreadId::iterator found = request_id_map_.find(request_id); | 51 RequestIdToThreadId::iterator found = request_id_map_.find(request_id); |
| 52 if (found != request_id_map_.end()) { | 52 if (found != request_id_map_.end()) { |
| 53 *ipc_thread_id = found->second; | 53 *ipc_thread_id = found->second; |
| 54 request_id_map_.erase(found); | 54 request_id_map_.erase(found); |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace content | 60 } // namespace content |
| OLD | NEW |