| 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/p2p/socket_dispatcher.h" | 5 #include "content/renderer/p2p/socket_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 DCHECK(message_loop_->BelongsToCurrentThread()); | 27 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 28 message_sender_ = NULL; | 28 message_sender_ = NULL; |
| 29 } | 29 } |
| 30 | 30 |
| 31 void Send(IPC::Message* msg) { | 31 void Send(IPC::Message* msg) { |
| 32 message_loop_->PostTask(FROM_HERE, | 32 message_loop_->PostTask(FROM_HERE, |
| 33 base::Bind(&AsyncMessageSender::DoSend, this, msg)); | 33 base::Bind(&AsyncMessageSender::DoSend, this, msg)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 friend class base::RefCountedThreadSafe<AsyncMessageSender>; |
| 38 ~AsyncMessageSender() {} |
| 39 |
| 37 void DoSend(IPC::Message* msg) { | 40 void DoSend(IPC::Message* msg) { |
| 38 DCHECK(message_loop_->BelongsToCurrentThread()); | 41 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 39 if (message_sender_) | 42 if (message_sender_) |
| 40 message_sender_->Send(msg); | 43 message_sender_->Send(msg); |
| 41 } | 44 } |
| 42 | 45 |
| 43 scoped_refptr<base::MessageLoopProxy> message_loop_; | 46 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 44 IPC::Message::Sender* message_sender_; | 47 IPC::Message::Sender* message_sender_; |
| 45 | 48 |
| 46 DISALLOW_COPY_AND_ASSIGN(AsyncMessageSender); | 49 DISALLOW_COPY_AND_ASSIGN(AsyncMessageSender); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // hasn't processed the close message by the time it sends the | 179 // hasn't processed the close message by the time it sends the |
| 177 // message to the renderer. | 180 // message to the renderer. |
| 178 VLOG(1) << "Received P2P message for socket that doesn't exist."; | 181 VLOG(1) << "Received P2P message for socket that doesn't exist."; |
| 179 return NULL; | 182 return NULL; |
| 180 } | 183 } |
| 181 | 184 |
| 182 return client; | 185 return client; |
| 183 } | 186 } |
| 184 | 187 |
| 185 } // namespace content | 188 } // namespace content |
| OLD | NEW |