| OLD | NEW |
| 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. |
| 11 // | 11 // |
| 12 // P2PSocketHost P2PSocketClient | 12 // P2PSocketHost P2PSocketClient |
| 13 // ^ ^ | 13 // ^ ^ |
| 14 // | | | 14 // | | |
| 15 // v IPC v | 15 // v IPC v |
| 16 // P2PSocketsHost <---------> P2PSocketDispatcher | 16 // P2PSocketsHost <---------> P2PSocketDispatcher |
| 17 // | 17 // |
| 18 | 18 |
| 19 #ifndef CHROME_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 19 #ifndef CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
| 20 #define CHROME_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 20 #define CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
| 21 | 21 |
| 22 #include <vector> | 22 #include <vector> |
| 23 | 23 |
| 24 #include "base/id_map.h" | 24 #include "base/id_map.h" |
| 25 #include "chrome/renderer/p2p/socket_client.h" | 25 #include "chrome/renderer/render_view_observer.h" |
| 26 #include "content/common/p2p_sockets.h" | 26 #include "content/common/p2p_sockets.h" |
| 27 #include "chrome/renderer/render_view_observer.h" | 27 #include "content/renderer/p2p/socket_client.h" |
| 28 | 28 |
| 29 namespace base { | 29 namespace base { |
| 30 class MessageLoopProxy; | 30 class MessageLoopProxy; |
| 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: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 61 const std::vector<char>& data); | 61 const std::vector<char>& data); |
| 62 | 62 |
| 63 P2PSocketClient* GetClient(int socket_id); | 63 P2PSocketClient* GetClient(int socket_id); |
| 64 | 64 |
| 65 scoped_refptr<base::MessageLoopProxy> message_loop_; | 65 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 66 IDMap<P2PSocketClient> clients_; | 66 IDMap<P2PSocketClient> clients_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); | 68 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 #endif // CHROME_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 71 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
| OLD | NEW |