Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ipc_socket_factory.h" | 5 #include "content/renderer/p2p/ipc_socket_factory.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "content/renderer/p2p/socket_client.h" | 10 #include "content/renderer/p2p/socket_client.h" |
| 11 #include "content/renderer/p2p/socket_dispatcher.h" | 11 #include "content/renderer/p2p/socket_dispatcher.h" |
| 12 #include "jingle/glue/utils.h" | 12 #include "jingle/glue/utils.h" |
| 13 #include "third_party/libjingle/source/talk/base/asyncpacketsocket.h" | 13 #include "third_party/libjingle/source/talk/base/asyncpacketsocket.h" |
| 14 | 14 |
| 15 namespace content { | |
| 16 | |
| 15 namespace { | 17 namespace { |
|
jam
2011/08/24 00:24:27
ditto
Sergey Ulanov
2011/08/24 01:57:48
Putting this code in content namespace makets it s
jam
2011/08/24 16:30:53
it seems a little odd having an anonymous namespac
Sergey Ulanov
2011/08/24 17:35:12
Actually there is a lot of code in chrome that def
jam
2011/08/24 23:38:42
to be clear, I didn't say it caused problems. if t
| |
| 16 | 18 |
| 17 // IpcPacketSocket implements talk_base::AsyncPacketSocket interface | 19 // IpcPacketSocket implements talk_base::AsyncPacketSocket interface |
| 18 // using P2PSocketClient that works over IPC-channel. It must be used | 20 // using P2PSocketClient that works over IPC-channel. It must be used |
| 19 // on the thread it was created. | 21 // on the thread it was created. |
| 20 class IpcPacketSocket : public talk_base::AsyncPacketSocket, | 22 class IpcPacketSocket : public talk_base::AsyncPacketSocket, |
| 21 public P2PSocketClient::Delegate { | 23 public P2PSocketClient::Delegate { |
| 22 public: | 24 public: |
| 23 IpcPacketSocket(); | 25 IpcPacketSocket(); |
| 24 virtual ~IpcPacketSocket(); | 26 virtual ~IpcPacketSocket(); |
| 25 | 27 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 return NULL; | 357 return NULL; |
| 356 | 358 |
| 357 talk_base::SocketAddress crome_address; | 359 talk_base::SocketAddress crome_address; |
| 358 P2PSocketClient* socket_client = new P2PSocketClient(socket_dispatcher_); | 360 P2PSocketClient* socket_client = new P2PSocketClient(socket_dispatcher_); |
| 359 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); | 361 scoped_ptr<IpcPacketSocket> socket(new IpcPacketSocket()); |
| 360 if (!socket->Init(P2P_SOCKET_TCP_CLIENT, socket_client, local_address, | 362 if (!socket->Init(P2P_SOCKET_TCP_CLIENT, socket_client, local_address, |
| 361 remote_address)) | 363 remote_address)) |
| 362 return NULL; | 364 return NULL; |
| 363 return socket.release(); | 365 return socket.release(); |
| 364 } | 366 } |
| 367 | |
| 368 } // namespace content | |
| OLD | NEW |