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/cast_channel/cast_socket.h" | 5 #include "extensions/browser/api/cast_channel/cast_socket.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Helper for logging data with remote host IP and authentication state. | 50 // Helper for logging data with remote host IP and authentication state. |
51 // Assumes |ip_endpoint_| of type net::IPEndPoint and |channel_auth_| of enum | 51 // Assumes |ip_endpoint_| of type net::IPEndPoint and |channel_auth_| of enum |
52 // type ChannelAuthType are available in the current scope. | 52 // type ChannelAuthType are available in the current scope. |
53 #define CONNECTION_INFO() \ | 53 #define CONNECTION_INFO() \ |
54 "[" << ip_endpoint_.ToString() << ", auth=" << channel_auth_ << "] " | 54 "[" << ip_endpoint_.ToString() << ", auth=" << channel_auth_ << "] " |
55 #define VLOG_WITH_CONNECTION(level) VLOG(level) << CONNECTION_INFO() | 55 #define VLOG_WITH_CONNECTION(level) VLOG(level) << CONNECTION_INFO() |
56 #define LOG_WITH_CONNECTION(level) LOG(level) << CONNECTION_INFO() | 56 #define LOG_WITH_CONNECTION(level) LOG(level) << CONNECTION_INFO() |
57 | 57 |
58 namespace extensions { | 58 namespace extensions { |
59 static base::LazyInstance<BrowserContextKeyedAPIFactory< | 59 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
60 ApiResourceManager<api::cast_channel::CastSocket>>> g_factory = | 60 ApiResourceManager<api::cast_channel::CastSocket>>>::DestructorAtExit |
61 LAZY_INSTANCE_INITIALIZER; | 61 g_factory = LAZY_INSTANCE_INITIALIZER; |
62 | 62 |
63 // static | 63 // static |
64 template <> | 64 template <> |
65 BrowserContextKeyedAPIFactory< | 65 BrowserContextKeyedAPIFactory< |
66 ApiResourceManager<api::cast_channel::CastSocket>>* | 66 ApiResourceManager<api::cast_channel::CastSocket>>* |
67 ApiResourceManager<api::cast_channel::CastSocket>::GetFactoryInstance() { | 67 ApiResourceManager<api::cast_channel::CastSocket>::GetFactoryInstance() { |
68 return g_factory.Pointer(); | 68 return g_factory.Pointer(); |
69 } | 69 } |
70 | 70 |
71 namespace api { | 71 namespace api { |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 void CastSocketImpl::SetErrorState(ChannelError error_state) { | 599 void CastSocketImpl::SetErrorState(ChannelError error_state) { |
600 VLOG_WITH_CONNECTION(1) << "SetErrorState " << error_state; | 600 VLOG_WITH_CONNECTION(1) << "SetErrorState " << error_state; |
601 DCHECK_EQ(CHANNEL_ERROR_NONE, error_state_); | 601 DCHECK_EQ(CHANNEL_ERROR_NONE, error_state_); |
602 error_state_ = error_state; | 602 error_state_ = error_state; |
603 delegate_->OnError(error_state_); | 603 delegate_->OnError(error_state_); |
604 } | 604 } |
605 } // namespace cast_channel | 605 } // namespace cast_channel |
606 } // namespace api | 606 } // namespace api |
607 } // namespace extensions | 607 } // namespace extensions |
608 #undef VLOG_WITH_CONNECTION | 608 #undef VLOG_WITH_CONNECTION |
OLD | NEW |