OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const linked_ptr<SpdyHeaderBlock>& headers, | 42 const linked_ptr<SpdyHeaderBlock>& headers, |
43 SpdyControlFlags flags, | 43 SpdyControlFlags flags, |
44 SpdyStreamId id, | 44 SpdyStreamId id, |
45 SpdyStreamId associated_stream) | 45 SpdyStreamId associated_stream) |
46 : headers_(headers), | 46 : headers_(headers), |
47 flags_(flags), | 47 flags_(flags), |
48 id_(id), | 48 id_(id), |
49 associated_stream_(associated_stream) { | 49 associated_stream_(associated_stream) { |
50 } | 50 } |
51 | 51 |
52 NetLogSpdySynParameter::~NetLogSpdySynParameter() { | |
53 } | |
54 | |
55 Value* NetLogSpdySynParameter::ToValue() const { | 52 Value* NetLogSpdySynParameter::ToValue() const { |
56 DictionaryValue* dict = new DictionaryValue(); | 53 DictionaryValue* dict = new DictionaryValue(); |
57 ListValue* headers_list = new ListValue(); | 54 ListValue* headers_list = new ListValue(); |
58 for (SpdyHeaderBlock::const_iterator it = headers_->begin(); | 55 for (SpdyHeaderBlock::const_iterator it = headers_->begin(); |
59 it != headers_->end(); ++it) { | 56 it != headers_->end(); ++it) { |
60 headers_list->Append(new StringValue(base::StringPrintf( | 57 headers_list->Append(new StringValue(base::StringPrintf( |
61 "%s: %s", it->first.c_str(), it->second.c_str()))); | 58 "%s: %s", it->first.c_str(), it->second.c_str()))); |
62 } | 59 } |
63 dict->SetInteger("flags", flags_); | 60 dict->SetInteger("flags", flags_); |
64 dict->Set("headers", headers_list); | 61 dict->Set("headers", headers_list); |
65 dict->SetInteger("id", id_); | 62 dict->SetInteger("id", id_); |
66 if (associated_stream_) | 63 if (associated_stream_) |
67 dict->SetInteger("associated_stream", associated_stream_); | 64 dict->SetInteger("associated_stream", associated_stream_); |
68 return dict; | 65 return dict; |
69 } | 66 } |
70 | 67 |
| 68 NetLogSpdySynParameter::~NetLogSpdySynParameter() {} |
| 69 |
71 NetLogSpdyCredentialParameter::NetLogSpdyCredentialParameter( | 70 NetLogSpdyCredentialParameter::NetLogSpdyCredentialParameter( |
72 size_t slot, | 71 size_t slot, |
73 const std::string& origin) | 72 const std::string& origin) |
74 : slot_(slot), | 73 : slot_(slot), |
75 origin_(origin) { | 74 origin_(origin) { |
76 } | 75 } |
77 | 76 |
78 NetLogSpdyCredentialParameter::~NetLogSpdyCredentialParameter() { | |
79 } | |
80 | |
81 Value* NetLogSpdyCredentialParameter::ToValue() const { | 77 Value* NetLogSpdyCredentialParameter::ToValue() const { |
82 DictionaryValue* dict = new DictionaryValue(); | 78 DictionaryValue* dict = new DictionaryValue(); |
83 dict->SetInteger("slot", slot_); | 79 dict->SetInteger("slot", slot_); |
84 dict->SetString("origin", origin_); | 80 dict->SetString("origin", origin_); |
85 return dict; | 81 return dict; |
86 } | 82 } |
87 | 83 |
| 84 NetLogSpdyCredentialParameter::~NetLogSpdyCredentialParameter() {} |
| 85 |
88 NetLogSpdySessionCloseParameter::NetLogSpdySessionCloseParameter( | 86 NetLogSpdySessionCloseParameter::NetLogSpdySessionCloseParameter( |
89 int status, | 87 int status, |
90 const std::string& description) | 88 const std::string& description) |
91 : status_(status), | 89 : status_(status), |
92 description_(description) {} | 90 description_(description) { |
93 | |
94 NetLogSpdySessionCloseParameter::~NetLogSpdySessionCloseParameter() { | |
95 } | 91 } |
96 | 92 |
97 Value* NetLogSpdySessionCloseParameter::ToValue() const { | 93 Value* NetLogSpdySessionCloseParameter::ToValue() const { |
98 DictionaryValue* dict = new DictionaryValue(); | 94 DictionaryValue* dict = new DictionaryValue(); |
99 dict->SetInteger("status", status_); | 95 dict->SetInteger("status", status_); |
100 dict->SetString("description", description_); | 96 dict->SetString("description", description_); |
101 return dict; | 97 return dict; |
102 } | 98 } |
103 | 99 |
| 100 NetLogSpdySessionCloseParameter::~NetLogSpdySessionCloseParameter() {} |
| 101 |
104 namespace { | 102 namespace { |
105 | 103 |
106 const int kReadBufferSize = 8 * 1024; | 104 const int kReadBufferSize = 8 * 1024; |
107 const int kDefaultConnectionAtRiskOfLossSeconds = 10; | 105 const int kDefaultConnectionAtRiskOfLossSeconds = 10; |
108 const int kTrailingPingDelayTimeSeconds = 1; | 106 const int kTrailingPingDelayTimeSeconds = 1; |
109 const int kHungIntervalSeconds = 10; | 107 const int kHungIntervalSeconds = 10; |
110 | 108 |
111 class NetLogSpdySessionParameter : public NetLog::EventParameters { | 109 class NetLogSpdySessionParameter : public NetLog::EventParameters { |
112 public: | 110 public: |
113 NetLogSpdySessionParameter(const HostPortProxyPair& host_pair) | 111 NetLogSpdySessionParameter(const HostPortProxyPair& host_pair) |
114 : host_pair_(host_pair) {} | 112 : host_pair_(host_pair) {} |
| 113 |
115 virtual Value* ToValue() const { | 114 virtual Value* ToValue() const { |
116 DictionaryValue* dict = new DictionaryValue(); | 115 DictionaryValue* dict = new DictionaryValue(); |
117 dict->Set("host", new StringValue(host_pair_.first.ToString())); | 116 dict->Set("host", new StringValue(host_pair_.first.ToString())); |
118 dict->Set("proxy", new StringValue(host_pair_.second.ToPacString())); | 117 dict->Set("proxy", new StringValue(host_pair_.second.ToPacString())); |
119 return dict; | 118 return dict; |
120 } | 119 } |
| 120 |
121 private: | 121 private: |
| 122 virtual ~NetLogSpdySessionParameter() {} |
| 123 |
122 const HostPortProxyPair host_pair_; | 124 const HostPortProxyPair host_pair_; |
123 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionParameter); | 125 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionParameter); |
124 }; | 126 }; |
125 | 127 |
126 class NetLogSpdySettingParameter : public NetLog::EventParameters { | 128 class NetLogSpdySettingParameter : public NetLog::EventParameters { |
127 public: | 129 public: |
128 explicit NetLogSpdySettingParameter(SpdySettingsIds id, | 130 explicit NetLogSpdySettingParameter(SpdySettingsIds id, |
129 SpdySettingsFlags flags, | 131 SpdySettingsFlags flags, |
130 uint32 value) | 132 uint32 value) |
131 : id_(id), | 133 : id_(id), |
132 flags_(flags), | 134 flags_(flags), |
133 value_(value) { | 135 value_(value) { |
134 } | 136 } |
135 | 137 |
136 virtual Value* ToValue() const { | 138 virtual Value* ToValue() const { |
137 DictionaryValue* dict = new DictionaryValue(); | 139 DictionaryValue* dict = new DictionaryValue(); |
138 dict->SetInteger("id", id_); | 140 dict->SetInteger("id", id_); |
139 dict->SetInteger("flags", flags_); | 141 dict->SetInteger("flags", flags_); |
140 dict->SetInteger("value", value_); | 142 dict->SetInteger("value", value_); |
141 return dict; | 143 return dict; |
142 } | 144 } |
143 | 145 |
144 private: | 146 private: |
145 ~NetLogSpdySettingParameter() {} | 147 virtual ~NetLogSpdySettingParameter() {} |
| 148 |
146 const SpdySettingsIds id_; | 149 const SpdySettingsIds id_; |
147 const SpdySettingsFlags flags_; | 150 const SpdySettingsFlags flags_; |
148 const uint32 value_; | 151 const uint32 value_; |
149 | 152 |
150 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySettingParameter); | 153 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySettingParameter); |
151 }; | 154 }; |
152 | 155 |
153 class NetLogSpdySettingsParameter : public NetLog::EventParameters { | 156 class NetLogSpdySettingsParameter : public NetLog::EventParameters { |
154 public: | 157 public: |
155 explicit NetLogSpdySettingsParameter(const SettingsMap& settings) | 158 explicit NetLogSpdySettingsParameter(const SettingsMap& settings) |
(...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 SSLClientSocket* SpdySession::GetSSLClientSocket() const { | 1987 SSLClientSocket* SpdySession::GetSSLClientSocket() const { |
1985 if (!is_secure_) | 1988 if (!is_secure_) |
1986 return NULL; | 1989 return NULL; |
1987 SSLClientSocket* ssl_socket = | 1990 SSLClientSocket* ssl_socket = |
1988 reinterpret_cast<SSLClientSocket*>(connection_->socket()); | 1991 reinterpret_cast<SSLClientSocket*>(connection_->socket()); |
1989 DCHECK(ssl_socket); | 1992 DCHECK(ssl_socket); |
1990 return ssl_socket; | 1993 return ssl_socket; |
1991 } | 1994 } |
1992 | 1995 |
1993 } // namespace net | 1996 } // namespace net |
OLD | NEW |