| OLD | NEW |
| 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 EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ | 6 #define EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 static void StartReceive(const ReceiveParams& params); | 72 static void StartReceive(const ReceiveParams& params); |
| 73 | 73 |
| 74 // Called when socket receive data. | 74 // Called when socket receive data. |
| 75 static void ReceiveCallback(const ReceiveParams& params, | 75 static void ReceiveCallback(const ReceiveParams& params, |
| 76 int bytes_read, | 76 int bytes_read, |
| 77 scoped_refptr<net::IOBuffer> io_buffer, | 77 scoped_refptr<net::IOBuffer> io_buffer, |
| 78 const std::string& address, | 78 const std::string& address, |
| 79 uint16_t port); | 79 uint16_t port); |
| 80 | 80 |
| 81 // Post an extension event from IO to UI thread | 81 // Post an extension event from IO to UI thread |
| 82 static void PostEvent(const ReceiveParams& params, scoped_ptr<Event> event); | 82 static void PostEvent(const ReceiveParams& params, |
| 83 std::unique_ptr<Event> event); |
| 83 | 84 |
| 84 // Dispatch an extension event on to EventRouter instance on UI thread. | 85 // Dispatch an extension event on to EventRouter instance on UI thread. |
| 85 static void DispatchEvent(void* browser_context_id, | 86 static void DispatchEvent(void* browser_context_id, |
| 86 const std::string& extension_id, | 87 const std::string& extension_id, |
| 87 scoped_ptr<Event> event); | 88 std::unique_ptr<Event> event); |
| 88 | 89 |
| 89 // Usually IO thread (except for unit testing). | 90 // Usually IO thread (except for unit testing). |
| 90 content::BrowserThread::ID thread_id_; | 91 content::BrowserThread::ID thread_id_; |
| 91 content::BrowserContext* const browser_context_; | 92 content::BrowserContext* const browser_context_; |
| 92 scoped_refptr<SocketData> sockets_; | 93 scoped_refptr<SocketData> sockets_; |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 } // namespace api | 96 } // namespace api |
| 96 } // namespace extensions | 97 } // namespace extensions |
| 97 | 98 |
| 98 #endif // EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ | 99 #endif // EXTENSIONS_BROWSER_API_SOCKETS_UDP_UDP_SOCKET_EVENT_DISPATCHER_H_ |
| OLD | NEW |