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

Side by Side Diff: remoting/client/plugin/pepper_port_allocator.h

Issue 1571943002: Simplify PortAllocatorBase and make PortAllocator creation synchronous. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | remoting/client/plugin/pepper_port_allocator.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ppapi/cpp/instance_handle.h" 11 #include "ppapi/cpp/instance_handle.h"
12 #include "remoting/protocol/port_allocator_base.h" 12 #include "remoting/protocol/port_allocator_base.h"
13 #include "remoting/protocol/port_allocator_factory.h" 13 #include "remoting/protocol/port_allocator_factory.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 16
17 // An implementation of cricket::PortAllocator for libjingle that is used by the 17 // An implementation of cricket::PortAllocator for libjingle that is used by the
18 // client plugin. It uses Pepper URLLoader API when creating relay sessions. 18 // client plugin. It uses Pepper URLLoader API when creating relay sessions.
19 class PepperPortAllocator : public protocol::PortAllocatorBase { 19 class PepperPortAllocator : public protocol::PortAllocatorBase {
20 public: 20 public:
21 static scoped_ptr<PepperPortAllocator> Create( 21 PepperPortAllocator(
22 const pp::InstanceHandle& instance); 22 scoped_refptr<protocol::TransportContext> transport_context,
23 pp::InstanceHandle pp_instance);
23 ~PepperPortAllocator() override; 24 ~PepperPortAllocator() override;
24 25
26 pp::InstanceHandle pp_instance() { return pp_instance_; }
27
25 // PortAllocatorBase overrides. 28 // PortAllocatorBase overrides.
26 cricket::PortAllocatorSession* CreateSessionInternal( 29 cricket::PortAllocatorSession* CreateSessionInternal(
27 const std::string& content_name, 30 const std::string& content_name,
28 int component, 31 int component,
29 const std::string& ice_username_fragment, 32 const std::string& ice_username_fragment,
30 const std::string& ice_password) override; 33 const std::string& ice_password) override;
31 34
32 private: 35 private:
33 PepperPortAllocator( 36 pp::InstanceHandle pp_instance_;
34 const pp::InstanceHandle& instance,
35 scoped_ptr<rtc::NetworkManager> network_manager,
36 scoped_ptr<rtc::PacketSocketFactory> socket_factory);
37
38 pp::InstanceHandle instance_;
39 scoped_ptr<rtc::NetworkManager> network_manager_; 37 scoped_ptr<rtc::NetworkManager> network_manager_;
40 scoped_ptr<rtc::PacketSocketFactory> socket_factory_; 38 scoped_ptr<rtc::PacketSocketFactory> socket_factory_;
41 39
42 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocator); 40 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocator);
43 }; 41 };
44 42
45 class PepperPortAllocatorFactory : public protocol::PortAllocatorFactory { 43 class PepperPortAllocatorFactory : public protocol::PortAllocatorFactory {
46 public: 44 public:
47 PepperPortAllocatorFactory(const pp::InstanceHandle& instance); 45 PepperPortAllocatorFactory(pp::InstanceHandle pp_instance);
48 ~PepperPortAllocatorFactory() override; 46 ~PepperPortAllocatorFactory() override;
49 47
50 // PortAllocatorFactory interface. 48 // PortAllocatorFactory interface.
51 scoped_ptr<protocol::PortAllocatorBase> CreatePortAllocator() override; 49 scoped_ptr<cricket::PortAllocator> CreatePortAllocator(
50 scoped_refptr<protocol::TransportContext> transport_context) override;
52 51
53 private: 52 private:
54 pp::InstanceHandle instance_; 53 pp::InstanceHandle pp_instance_;
55 54
56 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocatorFactory); 55 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocatorFactory);
57 }; 56 };
58 57
59 } // namespace remoting 58 } // namespace remoting
60 59
61 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_ 60 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/client/plugin/pepper_port_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698