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 "ipc/ipc_channel_proxy.h" | 5 #include "ipc/ipc_channel_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 // Called on the IPC::Channel thread | 95 // Called on the IPC::Channel thread |
96 bool ChannelProxy::Context::OnMessageReceivedNoFilter(const Message& message) { | 96 bool ChannelProxy::Context::OnMessageReceivedNoFilter(const Message& message) { |
97 listener_task_runner_->PostTask( | 97 listener_task_runner_->PostTask( |
98 FROM_HERE, base::Bind(&Context::OnDispatchMessage, this, message)); | 98 FROM_HERE, base::Bind(&Context::OnDispatchMessage, this, message)); |
99 return true; | 99 return true; |
100 } | 100 } |
101 | 101 |
102 // Called on the IPC::Channel thread | 102 // Called on the IPC::Channel thread |
103 void ChannelProxy::Context::OnChannelConnected(int32 peer_pid) { | 103 void ChannelProxy::Context::OnChannelConnected(int32_t peer_pid) { |
104 // We cache off the peer_pid so it can be safely accessed from both threads. | 104 // We cache off the peer_pid so it can be safely accessed from both threads. |
105 peer_pid_ = channel_->GetPeerPID(); | 105 peer_pid_ = channel_->GetPeerPID(); |
106 | 106 |
107 // Add any pending filters. This avoids a race condition where someone | 107 // Add any pending filters. This avoids a race condition where someone |
108 // creates a ChannelProxy, calls AddFilter, and then right after starts the | 108 // creates a ChannelProxy, calls AddFilter, and then right after starts the |
109 // peer process. The IO thread could receive a message before the task to add | 109 // peer process. The IO thread could receive a message before the task to add |
110 // the filter is run on the IO thread. | 110 // the filter is run on the IO thread. |
111 OnAddFilter(); | 111 OnAddFilter(); |
112 | 112 |
113 // See above comment about using listener_task_runner_ here. | 113 // See above comment about using listener_task_runner_ here. |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 return channel->TakeClientFileDescriptor(); | 518 return channel->TakeClientFileDescriptor(); |
519 } | 519 } |
520 #endif | 520 #endif |
521 | 521 |
522 void ChannelProxy::OnChannelInit() { | 522 void ChannelProxy::OnChannelInit() { |
523 } | 523 } |
524 | 524 |
525 //----------------------------------------------------------------------------- | 525 //----------------------------------------------------------------------------- |
526 | 526 |
527 } // namespace IPC | 527 } // namespace IPC |
OLD | NEW |