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

Side by Side Diff: content/public/renderer/p2p_socket_client.h

Issue 45183002: Expose the p2p client in content/public (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (most) comments addressed Created 7 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #ifndef CONTENT_PUBLIC_RENDERER_P2P_SOCKET_CLIENT_H_
6 #define CONTENT_PUBLIC_RENDERER_P2P_SOCKET_CLIENT_H_
7
8 #include <vector>
9
10 #include "base/memory/ref_counted.h"
11 #include "content/public/common/p2p_socket_type.h"
12 #include "net/base/ip_endpoint.h"
13
14 namespace content {
15
16 class P2PSocketClientDelegate;
17
18 // P2P socket that routes all calls over IPC.
19 // Note that while ref-counting is thread-safe, all methods must be
20 // called on the same thread.
21 class P2PSocketClient : public base::RefCountedThreadSafe<P2PSocketClient> {
22 public:
23 // Create a new P2PSocketClient() of the specified |type| and connected to
24 // 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
26 // called on the same thread that created it.
27 static P2PSocketClient* CreateP2PSocket(
jam 2013/11/27 21:30:18 nit: just Create, the "P2PSocket" in the name is r
hubbe 2013/11/27 23:23:01 Done.
28 P2PSocketType type,
29 const net::IPEndPoint& local_address,
30 const net::IPEndPoint& remote_address,
31 P2PSocketClientDelegate* delegate);
32
33 P2PSocketClient() {}
34
35 // Send the |data| to the |address|.
36 virtual void Send(const net::IPEndPoint& address,
37 const std::vector<char>& data) = 0;
38
39 // Send the |data| to the |address| using Differentiated Services Code Point
40 // |dscp|.
41 virtual void SendWithDscp(const net::IPEndPoint& address,
42 const std::vector<char>& data,
43 net::DiffServCodePoint dscp) = 0;
44
45 // Must be called before the socket is destroyed.
46 virtual void Close() = 0;
47
48 virtual int GetSocketID() const = 0;
49 virtual void SetDelegate(P2PSocketClientDelegate* delegate) = 0;
50
51 protected:
52 virtual ~P2PSocketClient() {}
53
54 private:
55 // Calls destructor.
56 friend class base::RefCountedThreadSafe<P2PSocketClient>;
57 };
58 } // namespace content
59
60 #endif // CONTENT_PUBLIC_RENDERER_P2P_SOCKET_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698