OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 rtc::RefCountedObject<FakePortAllocatorFactory>* allocator = | 42 rtc::RefCountedObject<FakePortAllocatorFactory>* allocator = |
43 new rtc::RefCountedObject<FakePortAllocatorFactory>(); | 43 new rtc::RefCountedObject<FakePortAllocatorFactory>(); |
44 return allocator; | 44 return allocator; |
45 } | 45 } |
46 | 46 |
47 virtual cricket::PortAllocator* CreatePortAllocator( | 47 virtual cricket::PortAllocator* CreatePortAllocator( |
48 const std::vector<StunConfiguration>& stun_configurations, | 48 const std::vector<StunConfiguration>& stun_configurations, |
49 const std::vector<TurnConfiguration>& turn_configurations) { | 49 const std::vector<TurnConfiguration>& turn_configurations) { |
50 stun_configs_ = stun_configurations; | 50 stun_configs_ = stun_configurations; |
51 turn_configs_ = turn_configurations; | 51 turn_configs_ = turn_configurations; |
52 last_created_allocator_ = | 52 return new cricket::FakePortAllocator(rtc::Thread::Current(), NULL); |
53 new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr); | |
54 return last_created_allocator_; | |
55 } | 53 } |
56 | 54 |
57 const std::vector<StunConfiguration>& stun_configs() const { | 55 const std::vector<StunConfiguration>& stun_configs() const { |
58 return stun_configs_; | 56 return stun_configs_; |
59 } | 57 } |
60 | 58 |
61 const std::vector<TurnConfiguration>& turn_configs() const { | 59 const std::vector<TurnConfiguration>& turn_configs() const { |
62 return turn_configs_; | 60 return turn_configs_; |
63 } | 61 } |
64 | 62 |
65 void SetNetworkIgnoreMask(int network_ignore_mask) {} | 63 void SetNetworkIgnoreMask(int network_ignore_mask) {} |
66 | 64 |
67 // Up to caller to ensure this isn't called after the allocator has been | |
68 // destroyed. | |
69 cricket::FakePortAllocator* last_created_allocator() { | |
70 return last_created_allocator_; | |
71 } | |
72 | |
73 protected: | 65 protected: |
74 FakePortAllocatorFactory() {} | 66 FakePortAllocatorFactory() {} |
75 ~FakePortAllocatorFactory() {} | 67 ~FakePortAllocatorFactory() {} |
76 | 68 |
77 private: | 69 private: |
78 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_configs_; | 70 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_configs_; |
79 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_configs_; | 71 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_configs_; |
80 cricket::FakePortAllocator* last_created_allocator_ = nullptr; | |
81 }; | 72 }; |
82 | 73 |
83 } // namespace webrtc | 74 } // namespace webrtc |
84 | 75 |
85 #endif // TALK_APP_WEBRTC_FAKEPORTALLOCATORFACTORY_H_ | 76 #endif // TALK_APP_WEBRTC_FAKEPORTALLOCATORFACTORY_H_ |
OLD | NEW |