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 #include "extensions/browser/api/socket/udp_socket.h" | 5 #include "extensions/browser/api/socket/udp_socket.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "extensions/browser/api/api_resource.h" | 11 #include "extensions/browser/api/api_resource.h" |
12 #include "net/base/ip_address.h" | 12 #include "net/base/ip_address.h" |
13 #include "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/log/net_log_source.h" | 15 #include "net/log/net_log_source.h" |
16 #include "net/socket/datagram_socket.h" | 16 #include "net/socket/datagram_socket.h" |
17 #include "net/socket/udp_client_socket.h" | 17 #include "net/socket/udp_client_socket.h" |
18 | 18 |
19 namespace extensions { | 19 namespace extensions { |
20 | 20 |
21 static base::LazyInstance< | 21 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
22 BrowserContextKeyedAPIFactory<ApiResourceManager<ResumableUDPSocket> > > | 22 ApiResourceManager<ResumableUDPSocket>>>::DestructorAtExit g_factory = |
23 g_factory = LAZY_INSTANCE_INITIALIZER; | 23 LAZY_INSTANCE_INITIALIZER; |
24 | 24 |
25 // static | 25 // static |
26 template <> | 26 template <> |
27 BrowserContextKeyedAPIFactory<ApiResourceManager<ResumableUDPSocket> >* | 27 BrowserContextKeyedAPIFactory<ApiResourceManager<ResumableUDPSocket> >* |
28 ApiResourceManager<ResumableUDPSocket>::GetFactoryInstance() { | 28 ApiResourceManager<ResumableUDPSocket>::GetFactoryInstance() { |
29 return g_factory.Pointer(); | 29 return g_factory.Pointer(); |
30 } | 30 } |
31 | 31 |
32 UDPSocket::UDPSocket(const std::string& owner_extension_id) | 32 UDPSocket::UDPSocket(const std::string& owner_extension_id) |
33 : Socket(owner_extension_id), | 33 : Socket(owner_extension_id), |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 ResumableUDPSocket::ResumableUDPSocket(const std::string& owner_extension_id) | 310 ResumableUDPSocket::ResumableUDPSocket(const std::string& owner_extension_id) |
311 : UDPSocket(owner_extension_id), | 311 : UDPSocket(owner_extension_id), |
312 persistent_(false), | 312 persistent_(false), |
313 buffer_size_(0), | 313 buffer_size_(0), |
314 paused_(false) {} | 314 paused_(false) {} |
315 | 315 |
316 bool ResumableUDPSocket::IsPersistent() const { return persistent(); } | 316 bool ResumableUDPSocket::IsPersistent() const { return persistent(); } |
317 | 317 |
318 } // namespace extensions | 318 } // namespace extensions |
OLD | NEW |