| 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 return new cricket::FakePortAllocator(rtc::Thread::Current(), NULL); | 52 last_created_allocator_ = |
| 53 new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr); |
| 54 return last_created_allocator_; |
| 53 } | 55 } |
| 54 | 56 |
| 55 const std::vector<StunConfiguration>& stun_configs() const { | 57 const std::vector<StunConfiguration>& stun_configs() const { |
| 56 return stun_configs_; | 58 return stun_configs_; |
| 57 } | 59 } |
| 58 | 60 |
| 59 const std::vector<TurnConfiguration>& turn_configs() const { | 61 const std::vector<TurnConfiguration>& turn_configs() const { |
| 60 return turn_configs_; | 62 return turn_configs_; |
| 61 } | 63 } |
| 62 | 64 |
| 63 void SetNetworkIgnoreMask(int network_ignore_mask) {} | 65 void SetNetworkIgnoreMask(int network_ignore_mask) {} |
| 64 | 66 |
| 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 |
| 65 protected: | 73 protected: |
| 66 FakePortAllocatorFactory() {} | 74 FakePortAllocatorFactory() {} |
| 67 ~FakePortAllocatorFactory() {} | 75 ~FakePortAllocatorFactory() {} |
| 68 | 76 |
| 69 private: | 77 private: |
| 70 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_configs_; | 78 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_configs_; |
| 71 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_configs_; | 79 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_configs_; |
| 80 cricket::FakePortAllocator* last_created_allocator_ = nullptr; |
| 72 }; | 81 }; |
| 73 | 82 |
| 74 } // namespace webrtc | 83 } // namespace webrtc |
| 75 | 84 |
| 76 #endif // TALK_APP_WEBRTC_FAKEPORTALLOCATORFACTORY_H_ | 85 #endif // TALK_APP_WEBRTC_FAKEPORTALLOCATORFACTORY_H_ |
| OLD | NEW |