| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/api/cast_channel/cast_socket.h" | 5 #include "chrome/browser/extensions/api/cast_channel/cast_socket.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // The default keepalive delay. On Linux, keepalives probes will be sent after | 41 // The default keepalive delay. On Linux, keepalives probes will be sent after |
| 42 // the socket is idle for this length of time, and the socket will be closed | 42 // the socket is idle for this length of time, and the socket will be closed |
| 43 // after 9 failed probes. So the total idle time before close is 10 * | 43 // after 9 failed probes. So the total idle time before close is 10 * |
| 44 // kTcpKeepAliveDelaySecs. | 44 // kTcpKeepAliveDelaySecs. |
| 45 const int kTcpKeepAliveDelaySecs = 10; | 45 const int kTcpKeepAliveDelaySecs = 10; |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 namespace extensions { | 49 namespace extensions { |
| 50 | 50 |
| 51 static base::LazyInstance< | 51 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
| 52 ProfileKeyedAPIFactory<ApiResourceManager<api::cast_channel::CastSocket> > > | 52 ApiResourceManager<api::cast_channel::CastSocket> > > g_factory = |
| 53 g_factory = LAZY_INSTANCE_INITIALIZER; | 53 LAZY_INSTANCE_INITIALIZER; |
| 54 | 54 |
| 55 // static | 55 // static |
| 56 template <> | 56 template <> |
| 57 ProfileKeyedAPIFactory<ApiResourceManager<api::cast_channel::CastSocket> >* | 57 BrowserContextKeyedAPIFactory< |
| 58 ApiResourceManager<api::cast_channel::CastSocket> >* |
| 58 ApiResourceManager<api::cast_channel::CastSocket>::GetFactoryInstance() { | 59 ApiResourceManager<api::cast_channel::CastSocket>::GetFactoryInstance() { |
| 59 return g_factory.Pointer(); | 60 return g_factory.Pointer(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 namespace api { | 63 namespace api { |
| 63 namespace cast_channel { | 64 namespace cast_channel { |
| 64 | 65 |
| 65 const uint32 kMaxMessageSize = 65536; | 66 const uint32 kMaxMessageSize = 65536; |
| 66 // Don't use sizeof(MessageHeader) because of alignment; instead, sum the | 67 // Don't use sizeof(MessageHeader) because of alignment; instead, sum the |
| 67 // sizeof() for the fields. | 68 // sizeof() for the fields. |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 return true; | 782 return true; |
| 782 } | 783 } |
| 783 | 784 |
| 784 CastSocket::WriteRequest::~WriteRequest() { } | 785 CastSocket::WriteRequest::~WriteRequest() { } |
| 785 | 786 |
| 786 } // namespace cast_channel | 787 } // namespace cast_channel |
| 787 } // namespace api | 788 } // namespace api |
| 788 } // namespace extensions | 789 } // namespace extensions |
| 789 | 790 |
| 790 #undef VLOG_WITH_URL | 791 #undef VLOG_WITH_URL |
| OLD | NEW |