Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: webrtc/api/quicdatatransport.cc

Issue 2146133002: Revert of Modify PeerConnection for end-to-end QuicDataChannel usage (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/quicdatatransport.h ('k') | webrtc/api/quicdatatransport_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/api/quicdatatransport.h" 11 #include "webrtc/api/quicdatatransport.h"
12 12
13 #include "webrtc/base/logging.h" 13 #include "webrtc/base/logging.h"
14 #include "webrtc/p2p/quic/quictransportchannel.h" 14 #include "webrtc/p2p/quic/quictransportchannel.h"
15 #include "webrtc/p2p/quic/reliablequicstream.h" 15 #include "webrtc/p2p/quic/reliablequicstream.h"
16 16
17 namespace webrtc { 17 namespace webrtc {
18 18
19 QuicDataTransport::QuicDataTransport(rtc::Thread* signaling_thread, 19 QuicDataTransport::QuicDataTransport(rtc::Thread* signaling_thread,
20 rtc::Thread* worker_thread, 20 rtc::Thread* worker_thread)
21 rtc::Thread* network_thread) 21 : signaling_thread_(signaling_thread), worker_thread_(worker_thread) {
22 : signaling_thread_(signaling_thread),
23 worker_thread_(worker_thread),
24 network_thread_(network_thread) {
25 RTC_DCHECK(signaling_thread_); 22 RTC_DCHECK(signaling_thread_);
26 RTC_DCHECK(worker_thread_); 23 RTC_DCHECK(worker_thread_);
27 RTC_DCHECK(network_thread_);
28 } 24 }
29 25
30 QuicDataTransport::~QuicDataTransport() {} 26 QuicDataTransport::~QuicDataTransport() {}
31 27
32 bool QuicDataTransport::SetTransportChannel( 28 bool QuicDataTransport::SetTransportChannel(
33 cricket::QuicTransportChannel* channel) { 29 cricket::QuicTransportChannel* channel) {
34 if (!channel) { 30 if (!channel) {
35 LOG(LS_ERROR) << "|channel| is NULL. Cannot set transport channel."; 31 LOG(LS_ERROR) << "|channel| is NULL. Cannot set transport channel.";
36 return false; 32 return false;
37 } 33 }
(...skipping 27 matching lines...) Expand all
65 rtc::scoped_refptr<DataChannelInterface> QuicDataTransport::CreateDataChannel( 61 rtc::scoped_refptr<DataChannelInterface> QuicDataTransport::CreateDataChannel(
66 const std::string& label, 62 const std::string& label,
67 const DataChannelInit* config) { 63 const DataChannelInit* config) {
68 if (config == nullptr) { 64 if (config == nullptr) {
69 return nullptr; 65 return nullptr;
70 } 66 }
71 if (data_channel_by_id_.find(config->id) != data_channel_by_id_.end()) { 67 if (data_channel_by_id_.find(config->id) != data_channel_by_id_.end()) {
72 LOG(LS_ERROR) << "QUIC data channel already exists with id " << config->id; 68 LOG(LS_ERROR) << "QUIC data channel already exists with id " << config->id;
73 return nullptr; 69 return nullptr;
74 } 70 }
75 rtc::scoped_refptr<QuicDataChannel> data_channel(new QuicDataChannel( 71 rtc::scoped_refptr<QuicDataChannel> data_channel(
76 signaling_thread_, worker_thread_, network_thread_, label, *config)); 72 new QuicDataChannel(signaling_thread_, worker_thread_, label, *config));
77 if (quic_transport_channel_) { 73 if (quic_transport_channel_) {
78 if (!data_channel->SetTransportChannel(quic_transport_channel_)) { 74 if (!data_channel->SetTransportChannel(quic_transport_channel_)) {
79 LOG(LS_ERROR) 75 LOG(LS_ERROR)
80 << "Cannot set QUIC transport channel for QUIC data channel " 76 << "Cannot set QUIC transport channel for QUIC data channel "
81 << config->id; 77 << config->id;
82 } 78 }
83 } 79 }
84 80
85 data_channel_by_id_[data_channel->id()] = data_channel; 81 data_channel_by_id_[data_channel->id()] = data_channel;
86 return data_channel; 82 return data_channel;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 137 }
142 QuicDataChannel* data_channel = data_channel_kv->second; 138 QuicDataChannel* data_channel = data_channel_kv->second;
143 QuicDataChannel::Message message; 139 QuicDataChannel::Message message;
144 message.id = message_id; 140 message.id = message_id;
145 message.buffer = rtc::CopyOnWriteBuffer(data, len); 141 message.buffer = rtc::CopyOnWriteBuffer(data, len);
146 message.stream = stream; 142 message.stream = stream;
147 data_channel->OnIncomingMessage(std::move(message)); 143 data_channel->OnIncomingMessage(std::move(message));
148 } 144 }
149 145
150 } // namespace webrtc 146 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/quicdatatransport.h ('k') | webrtc/api/quicdatatransport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698