OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/push_messaging/push_dispatcher.h" | 5 #include "content/child/push_messaging/push_dispatcher.h" |
6 | 6 |
7 #include "content/child/push_messaging/push_provider.h" | 7 #include "content/child/push_messaging/push_provider.h" |
8 #include "content/common/push_messaging_messages.h" | 8 #include "content/common/push_messaging_messages.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 29 matching lines...) Expand all Loading... |
40 void PushDispatcher::OnFilteredMessageReceived(const IPC::Message& msg) { | 40 void PushDispatcher::OnFilteredMessageReceived(const IPC::Message& msg) { |
41 bool handled = PushProvider::ThreadSpecificInstance( | 41 bool handled = PushProvider::ThreadSpecificInstance( |
42 thread_safe_sender(), this)->OnMessageReceived(msg); | 42 thread_safe_sender(), this)->OnMessageReceived(msg); |
43 DCHECK(handled); | 43 DCHECK(handled); |
44 } | 44 } |
45 | 45 |
46 bool PushDispatcher::GetWorkerThreadIdForMessage(const IPC::Message& msg, | 46 bool PushDispatcher::GetWorkerThreadIdForMessage(const IPC::Message& msg, |
47 int* ipc_thread_id) { | 47 int* ipc_thread_id) { |
48 int request_id = -1; | 48 int request_id = -1; |
49 | 49 |
50 const bool success = PickleIterator(msg).ReadInt(&request_id); | 50 const bool success = base::PickleIterator(msg).ReadInt(&request_id); |
51 DCHECK(success); | 51 DCHECK(success); |
52 | 52 |
53 base::AutoLock lock(request_id_map_lock_); | 53 base::AutoLock lock(request_id_map_lock_); |
54 auto it = request_id_map_.find(request_id); | 54 auto it = request_id_map_.find(request_id); |
55 if (it != request_id_map_.end()) { | 55 if (it != request_id_map_.end()) { |
56 *ipc_thread_id = it->second; | 56 *ipc_thread_id = it->second; |
57 request_id_map_.erase(it); | 57 request_id_map_.erase(it); |
58 return true; | 58 return true; |
59 } | 59 } |
60 return false; | 60 return false; |
61 } | 61 } |
62 | 62 |
63 } // namespace content | 63 } // namespace content |
OLD | NEW |