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

Side by Side Diff: chrome/renderer/p2p/socket_dispatcher.h

Issue 6685013: Use IPEndPoint for P2P IPC messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 // P2PSocketDispatcher is a per-renderer object that dispatchers all 5 // P2PSocketDispatcher is a per-renderer object that dispatchers all
6 // P2P messages received from the browser and relays all P2P messages 6 // P2P messages received from the browser and relays all P2P messages
7 // sent to the browser. P2PSocketClient instances register themselves 7 // sent to the browser. P2PSocketClient instances register themselves
8 // with the dispatcher using RegisterClient() and UnregisterClient(). 8 // with the dispatcher using RegisterClient() and UnregisterClient().
9 // 9 //
10 // Relationship of classes. 10 // Relationship of classes.
(...skipping 20 matching lines...) Expand all
31 } // namespace base 31 } // namespace base
32 32
33 // P2PSocketDispatcher works on the renderer thread. It dispatches all 33 // P2PSocketDispatcher works on the renderer thread. It dispatches all
34 // messages on that thread, and all its methods must be called on the 34 // messages on that thread, and all its methods must be called on the
35 // same thread. 35 // same thread.
36 class P2PSocketDispatcher : public RenderViewObserver { 36 class P2PSocketDispatcher : public RenderViewObserver {
37 public: 37 public:
38 explicit P2PSocketDispatcher(RenderView* render_view); 38 explicit P2PSocketDispatcher(RenderView* render_view);
39 virtual ~P2PSocketDispatcher(); 39 virtual ~P2PSocketDispatcher();
40 40
41 P2PSocketClient* CreateSocket(P2PSocketType type, P2PSocketAddress address, 41 P2PSocketClient* CreateSocket(P2PSocketType type,
42 const net::IPEndPoint& address,
42 P2PSocketClient::Delegate* delegate); 43 P2PSocketClient::Delegate* delegate);
43 44
44 // RenderViewObserver overrides. 45 // RenderViewObserver overrides.
45 virtual bool OnMessageReceived(const IPC::Message& message); 46 virtual bool OnMessageReceived(const IPC::Message& message);
46 47
47 private: 48 private:
48 friend class P2PSocketClient; 49 friend class P2PSocketClient;
49 50
50 // Called by P2PSocketClient. 51 // Called by P2PSocketClient.
51 int RegisterClient(P2PSocketClient* client); 52 int RegisterClient(P2PSocketClient* client);
52 void UnregisterClient(int id); 53 void UnregisterClient(int id);
53 void SendP2PMessage(IPC::Message* msg); 54 void SendP2PMessage(IPC::Message* msg);
54 base::MessageLoopProxy* message_loop(); 55 base::MessageLoopProxy* message_loop();
55 56
56 // Incoming message handlers. 57 // Incoming message handlers.
57 void OnSocketCreated(int socket_id, const P2PSocketAddress& address); 58 void OnSocketCreated(int socket_id, const net::IPEndPoint& address);
58 void OnError(int socket_id); 59 void OnError(int socket_id);
59 void OnDataReceived(int socket_id, const P2PSocketAddress& address, 60 void OnDataReceived(int socket_id, const net::IPEndPoint& address,
60 const std::vector<char>& data); 61 const std::vector<char>& data);
61 62
62 P2PSocketClient* GetClient(int socket_id); 63 P2PSocketClient* GetClient(int socket_id);
63 64
64 scoped_refptr<base::MessageLoopProxy> message_loop_; 65 scoped_refptr<base::MessageLoopProxy> message_loop_;
65 IDMap<P2PSocketClient> clients_; 66 IDMap<P2PSocketClient> clients_;
66 67
67 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); 68 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher);
68 }; 69 };
69 70
70 #endif // CHROME_RENDERER_P2P_SOCKET_DISPATCHER_H_ 71 #endif // CHROME_RENDERER_P2P_SOCKET_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698