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

Side by Side Diff: content/renderer/p2p/socket_client.h

Issue 184813006: Relanding PacketOptions CL after revert (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/p2p/ipc_socket_factory.cc ('k') | content/renderer/p2p/socket_client_impl.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ 5 #ifndef CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_
6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ 6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "content/common/p2p_socket_type.h" 11 #include "content/common/p2p_socket_type.h"
12 #include "net/base/ip_endpoint.h" 12 #include "net/base/ip_endpoint.h"
13 13
14 namespace talk_base {
15 struct PacketOptions;
16 };
17
14 namespace content { 18 namespace content {
15 19
16 class P2PSocketClientDelegate; 20 class P2PSocketClientDelegate;
17 21
18 // P2P socket that routes all calls over IPC. 22 // P2P socket that routes all calls over IPC.
19 // Note that while ref-counting is thread-safe, all methods must be 23 // Note that while ref-counting is thread-safe, all methods must be
20 // called on the same thread. 24 // called on the same thread.
21 class P2PSocketClient : public base::RefCountedThreadSafe<P2PSocketClient> { 25 class P2PSocketClient : public base::RefCountedThreadSafe<P2PSocketClient> {
22 public: 26 public:
23 // Create a new P2PSocketClient() of the specified |type| and connected to 27 // Create a new P2PSocketClient() of the specified |type| and connected to
24 // the specified |address|. |address| matters only when |type| is set to 28 // the specified |address|. |address| matters only when |type| is set to
25 // P2P_SOCKET_TCP_CLIENT. The methods on the returned socket may only be 29 // P2P_SOCKET_TCP_CLIENT. The methods on the returned socket may only be
26 // called on the same thread that created it. 30 // called on the same thread that created it.
27 static scoped_refptr<P2PSocketClient> Create( 31 static scoped_refptr<P2PSocketClient> Create(
28 P2PSocketType type, 32 P2PSocketType type,
29 const net::IPEndPoint& local_address, 33 const net::IPEndPoint& local_address,
30 const net::IPEndPoint& remote_address, 34 const net::IPEndPoint& remote_address,
31 P2PSocketClientDelegate* delegate); 35 P2PSocketClientDelegate* delegate);
32 36
33 P2PSocketClient() {} 37 P2PSocketClient() {}
34 38
35 // Send the |data| to the |address|. 39 // Send the |data| to the |address|.
36 virtual void Send(const net::IPEndPoint& address, 40 virtual void Send(const net::IPEndPoint& address,
37 const std::vector<char>& data) = 0; 41 const std::vector<char>& data) = 0;
38 42
39 // Send the |data| to the |address| using Differentiated Services Code Point 43 // Send the |data| to the |address| using Differentiated Services Code Point
40 // |dscp|. 44 // |dscp|.
41 virtual void SendWithDscp(const net::IPEndPoint& address, 45 virtual void SendWithDscp(const net::IPEndPoint& address,
42 const std::vector<char>& data, 46 const std::vector<char>& data,
43 net::DiffServCodePoint dscp) = 0; 47 const talk_base::PacketOptions& options) = 0;
44 48
45 virtual void SetOption(P2PSocketOption option, int value) = 0; 49 virtual void SetOption(P2PSocketOption option, int value) = 0;
46 50
47 // Must be called before the socket is destroyed. 51 // Must be called before the socket is destroyed.
48 virtual void Close() = 0; 52 virtual void Close() = 0;
49 53
50 virtual int GetSocketID() const = 0; 54 virtual int GetSocketID() const = 0;
51 virtual void SetDelegate(P2PSocketClientDelegate* delegate) = 0; 55 virtual void SetDelegate(P2PSocketClientDelegate* delegate) = 0;
52 56
53 protected: 57 protected:
54 virtual ~P2PSocketClient() {} 58 virtual ~P2PSocketClient() {}
55 59
56 private: 60 private:
57 // Calls destructor. 61 // Calls destructor.
58 friend class base::RefCountedThreadSafe<P2PSocketClient>; 62 friend class base::RefCountedThreadSafe<P2PSocketClient>;
59 }; 63 };
60 } // namespace content 64 } // namespace content
61 65
62 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ 66 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_
OLDNEW
« no previous file with comments | « content/renderer/p2p/ipc_socket_factory.cc ('k') | content/renderer/p2p/socket_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698