| 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/renderer/p2p/socket_client_impl.h" | 5 #include "content/renderer/p2p/socket_client_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "content/common/p2p_messages.h" | 12 #include "content/common/p2p_messages.h" |
| 13 #include "content/renderer/p2p/socket_client_delegate.h" | 13 #include "content/renderer/p2p/socket_client_delegate.h" |
| 14 #include "content/renderer/p2p/socket_dispatcher.h" | 14 #include "content/renderer/p2p/socket_dispatcher.h" |
| 15 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
| 16 #include "crypto/random.h" | 16 #include "crypto/random.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 uint64_t GetUniqueId(uint32 random_socket_id, uint32 packet_id) { | 20 uint64_t GetUniqueId(uint32_t random_socket_id, uint32_t packet_id) { |
| 21 uint64_t uid = random_socket_id; | 21 uint64_t uid = random_socket_id; |
| 22 uid <<= 32; | 22 uid <<= 32; |
| 23 uid |= packet_id; | 23 uid |= packet_id; |
| 24 return uid; | 24 return uid; |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 delegate_->OnDataReceived(address, data, timestamp); | 245 delegate_->OnDataReceived(address, data, timestamp); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void P2PSocketClientImpl::Detach() { | 248 void P2PSocketClientImpl::Detach() { |
| 249 DCHECK(ipc_task_runner_->BelongsToCurrentThread()); | 249 DCHECK(ipc_task_runner_->BelongsToCurrentThread()); |
| 250 dispatcher_ = NULL; | 250 dispatcher_ = NULL; |
| 251 OnError(); | 251 OnError(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace content | 254 } // namespace content |
| OLD | NEW |