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

Side by Side Diff: net/quic/quartc/quartc_factory.cc

Issue 2324833004: Define Stable API for WebRTC/Quartc (Closed)
Patch Set: Add virtual destructors required by WebRTC compiler. Created 4 years, 2 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
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/quic/quartc/quartc_factory.h"
6
7 #include "base/threading/thread_task_runner_handle.h"
8 #include "net/quic/quartc/quartc_alarm_factory.h"
9 #include "net/quic/quartc/quartc_connection_helper.h"
10 #include "net/quic/quartc/quartc_session.h"
11
12 namespace net {
13
14 QuartcFactory::QuartcFactory() {}
15 QuartcFactory::~QuartcFactory() {}
16
17 std::unique_ptr<QuartcSessionInterface> QuartcFactory::CreateQuartcSession(
18 const QuartcConfig& quartc_config) {
19 DCHECK(quartc_config.transport);
20
21 Perspective perspective =
22 quartc_config.is_server ? Perspective::IS_SERVER : Perspective::IS_CLIENT;
23 std::unique_ptr<QuicConnection> quic_connection =
24 CreateQuicConnection(quartc_config, perspective);
25 config_.reset(new QuicConfig);
pthatcher2 2016/10/05 22:12:05 Why do we bother storing this as a member variable
Ryan Hamilton 2016/10/10 19:48:30 Agreed. This seems confusing because it means that
zhihuang1 2016/10/13 06:22:39 I'll remove these member variables.
26 return std::unique_ptr<QuartcSessionInterface>(
27 new QuartcSession(std::move(quic_connection), *(config_.get()),
28 quartc_config.remote_fingerprint_value, perspective,
29 quartc_config.transport));
30 }
31
32 std::unique_ptr<QuicConnection> QuartcFactory::CreateQuicConnection(
33 const QuartcConfig& quartc_config,
34 Perspective perspective) {
35 // The QuicConnection will take ownership.
pthatcher2 2016/10/05 22:12:05 That might be more clear if you used std::unique_p
zhihuang1 2016/10/13 06:22:39 Done.
36 QuartcPacketWriter* writer = new QuartcPacketWriter(quartc_config.transport);
37 helper_.reset(new QuartcConnectionHelper);
pthatcher2 2016/10/05 22:12:05 Why do we bother storing it in a member variable?
38 alarm_factory_.reset(new QuartcAlarmFactory(
39 base::ThreadTaskRunnerHandle::Get().get(), helper_->GetClock()));
40 IPAddress ip(0, 0, 0, 0);
pthatcher2 2016/10/05 22:12:05 This could use a comment with some explanation.
zhihuang1 2016/10/13 06:22:39 Done.
41 return std::unique_ptr<QuicConnection>(new QuicConnection(
42 0, IPEndPoint(ip, 0), helper_.get(), alarm_factory_.get(), writer,
pthatcher2 2016/10/05 22:12:05 A local variable the 0 here a name would help read
zhihuang1 2016/10/13 06:22:39 Done.
43 true /*own the writer*/, perspective, AllSupportedVersions()));
44 }
45
46 std::unique_ptr<QuartcFactoryInterface> CreateQuartcFactory() {
47 return std::unique_ptr<QuartcFactoryInterface>(new QuartcFactory);
48 }
49
50 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698