| 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/http/http_pipelined_host_impl.h" | 5 #include "net/http/http_pipelined_host_impl.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "net/http/http_pipelined_connection_impl.h" | 9 #include "net/http/http_pipelined_connection_impl.h" |
| 10 #include "net/http/http_pipelined_stream.h" | 10 #include "net/http/http_pipelined_stream.h" |
| 11 | 11 |
| 12 using base::DictionaryValue; | |
| 13 using base::ListValue; | |
| 14 using base::Value; | |
| 15 | |
| 16 namespace net { | 12 namespace net { |
| 17 | 13 |
| 18 // TODO(simonjam): Run experiments to see what value minimizes evictions without | 14 // TODO(simonjam): Run experiments to see what value minimizes evictions without |
| 19 // costing too much performance. Until then, this is just a bad guess. | 15 // costing too much performance. Until then, this is just a bad guess. |
| 20 static const int kNumKnownSuccessesThreshold = 3; | 16 static const int kNumKnownSuccessesThreshold = 3; |
| 21 | 17 |
| 22 HttpPipelinedHostImpl::HttpPipelinedHostImpl( | 18 HttpPipelinedHostImpl::HttpPipelinedHostImpl( |
| 23 HttpPipelinedHost::Delegate* delegate, | 19 HttpPipelinedHost::Delegate* delegate, |
| 24 const HttpPipelinedHost::Key& key, | 20 const HttpPipelinedHost::Key& key, |
| 25 HttpPipelinedConnection::Factory* factory, | 21 HttpPipelinedConnection::Factory* factory, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // deleting and removing entries from |pipelines_|. | 179 // deleting and removing entries from |pipelines_|. |
| 184 PipelineInfoMap pipelines_to_notify = pipelines_; | 180 PipelineInfoMap pipelines_to_notify = pipelines_; |
| 185 for (PipelineInfoMap::iterator it = pipelines_to_notify.begin(); | 181 for (PipelineInfoMap::iterator it = pipelines_to_notify.begin(); |
| 186 it != pipelines_to_notify.end(); ++it) { | 182 it != pipelines_to_notify.end(); ++it) { |
| 187 if (pipelines_.find(it->first) != pipelines_.end()) { | 183 if (pipelines_.find(it->first) != pipelines_.end()) { |
| 188 OnPipelineHasCapacity(it->first); | 184 OnPipelineHasCapacity(it->first); |
| 189 } | 185 } |
| 190 } | 186 } |
| 191 } | 187 } |
| 192 | 188 |
| 193 Value* HttpPipelinedHostImpl::PipelineInfoToValue() const { | 189 base::Value* HttpPipelinedHostImpl::PipelineInfoToValue() const { |
| 194 ListValue* list_value = new ListValue(); | 190 base::ListValue* list_value = new base::ListValue(); |
| 195 for (PipelineInfoMap::const_iterator it = pipelines_.begin(); | 191 for (PipelineInfoMap::const_iterator it = pipelines_.begin(); |
| 196 it != pipelines_.end(); ++it) { | 192 it != pipelines_.end(); ++it) { |
| 197 DictionaryValue* pipeline_dict = new DictionaryValue; | 193 base::DictionaryValue* pipeline_dict = new base::DictionaryValue; |
| 198 pipeline_dict->SetString("host", key_.origin().ToString()); | 194 pipeline_dict->SetString("host", key_.origin().ToString()); |
| 199 pipeline_dict->SetBoolean("forced", false); | 195 pipeline_dict->SetBoolean("forced", false); |
| 200 pipeline_dict->SetInteger("depth", it->first->depth()); | 196 pipeline_dict->SetInteger("depth", it->first->depth()); |
| 201 pipeline_dict->SetInteger("capacity", GetPipelineCapacity()); | 197 pipeline_dict->SetInteger("capacity", GetPipelineCapacity()); |
| 202 pipeline_dict->SetBoolean("usable", it->first->usable()); | 198 pipeline_dict->SetBoolean("usable", it->first->usable()); |
| 203 pipeline_dict->SetBoolean("active", it->first->active()); | 199 pipeline_dict->SetBoolean("active", it->first->active()); |
| 204 pipeline_dict->SetInteger("source_id", it->first->net_log().source().id); | 200 pipeline_dict->SetInteger("source_id", it->first->net_log().source().id); |
| 205 list_value->Append(pipeline_dict); | 201 list_value->Append(pipeline_dict); |
| 206 } | 202 } |
| 207 return list_value; | 203 return list_value; |
| 208 } | 204 } |
| 209 | 205 |
| 210 HttpPipelinedHostImpl::PipelineInfo::PipelineInfo() | 206 HttpPipelinedHostImpl::PipelineInfo::PipelineInfo() |
| 211 : num_successes(0) { | 207 : num_successes(0) { |
| 212 } | 208 } |
| 213 | 209 |
| 214 } // namespace net | 210 } // namespace net |
| OLD | NEW |