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

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

Issue 2324833004: Define Stable API for WebRTC/Quartc (Closed)
Patch Set: Fix the issues when testing with WebRTC. 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_at_exit.h"
6
7 namespace {
8
9 // A test mode AtExitManager which is allowed be create more than one.
10 // This should only be used for testing! AtExitManagers are kept on a global
11 // stack, and it will be removed during destruction. This allows you to shadow
12 // another AtExitManager.
13 // Create a subclass as the test mode constructor of the AtExitManager is
14 // protected.
pthatcher1 2016/10/14 18:58:59 "as the" => "because the"
zhihuang1 2016/10/16 00:45:27 Done.
15 class AtExitManagerForTest : public base::AtExitManager {
16 public:
17 AtExitManagerForTest() : AtExitManager(true) {}
18 };
19 } // namespace
20
21 namespace net {
22
23 QuartcAtExitManager::QuartcAtExitManager() {}
24
25 QuartcAtExitManager::~QuartcAtExitManager() {}
26
27 void QuartcAtExitManager::SetAtExitManager(bool test_mode) {
28 if (at_exit_manager_) {
pthatcher1 2016/10/14 18:58:59 If the QuartcAtExitManager itsn't usable until aft
zhihuang1 2016/10/16 00:45:27 One reason I'm doing this when working in WebRTC,
29 LOG(WARNING) << "The AtExitManager has already been created";
30 return;
31 }
32 if (test_mode) {
33 // Only create ShadowingAtExitManager for unit tests.
34 LOG(WARNING) << "Creating an AtExitManager for tests.";
35 at_exit_manager_.reset(new AtExitManagerForTest);
36 } else {
37 at_exit_manager_.reset(new base::AtExitManager);
38 }
pthatcher1 2016/10/14 18:58:59 An alternative is to rename AtExitManagerForTest t
zhihuang1 2016/10/16 00:45:27 I think you mean we can have something like this:
39 }
40
41 std::unique_ptr<QuartcAtExitManagerInterface> CreateQuartcAtExitManager() {
42 return std::unique_ptr<QuartcAtExitManagerInterface>(new QuartcAtExitManager);
pthatcher1 2016/10/14 18:58:59 What's the point of having a function that just ca
zhihuang1 2016/10/16 00:45:27 I thought this QuartcAtExitManager is something li
43 }
44 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698