| 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/core/spdy_header_block.h" | 5 #include "net/spdy/core/spdy_header_block.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 SpdyHeaderBlock::Storage* SpdyHeaderBlock::GetStorage() { | 324 SpdyHeaderBlock::Storage* SpdyHeaderBlock::GetStorage() { |
| 325 if (storage_ == nullptr) { | 325 if (storage_ == nullptr) { |
| 326 storage_ = SpdyMakeUnique<Storage>(); | 326 storage_ = SpdyMakeUnique<Storage>(); |
| 327 } | 327 } |
| 328 return storage_.get(); | 328 return storage_.get(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 std::unique_ptr<base::Value> SpdyHeaderBlockNetLogCallback( | 331 std::unique_ptr<base::Value> SpdyHeaderBlockNetLogCallback( |
| 332 const SpdyHeaderBlock* headers, | 332 const SpdyHeaderBlock* headers, |
| 333 NetLogCaptureMode capture_mode) { | 333 NetLogCaptureMode capture_mode) { |
| 334 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 334 auto dict = base::MakeUnique<base::DictionaryValue>(); |
| 335 base::DictionaryValue* headers_dict = new base::DictionaryValue(); | 335 auto headers_dict = base::MakeUnique<base::DictionaryValue>(); |
| 336 for (SpdyHeaderBlock::const_iterator it = headers->begin(); | 336 for (SpdyHeaderBlock::const_iterator it = headers->begin(); |
| 337 it != headers->end(); ++it) { | 337 it != headers->end(); ++it) { |
| 338 headers_dict->SetWithoutPathExpansion( | 338 headers_dict->SetStringWithoutPathExpansion( |
| 339 it->first.as_string(), | 339 it->first.as_string(), |
| 340 new base::Value(ElideHeaderValueForNetLog( | 340 ElideHeaderValueForNetLog(capture_mode, it->first.as_string(), |
| 341 capture_mode, it->first.as_string(), it->second.as_string()))); | 341 it->second.as_string())); |
| 342 } | 342 } |
| 343 dict->Set("headers", headers_dict); | 343 dict->Set("headers", std::move(headers_dict)); |
| 344 return std::move(dict); | 344 return std::move(dict); |
| 345 } | 345 } |
| 346 | 346 |
| 347 bool SpdyHeaderBlockFromNetLogParam( | 347 bool SpdyHeaderBlockFromNetLogParam( |
| 348 const base::Value* event_param, | 348 const base::Value* event_param, |
| 349 SpdyHeaderBlock* headers) { | 349 SpdyHeaderBlock* headers) { |
| 350 headers->clear(); | 350 headers->clear(); |
| 351 | 351 |
| 352 const base::DictionaryValue* dict = NULL; | 352 const base::DictionaryValue* dict = NULL; |
| 353 const base::DictionaryValue* header_dict = NULL; | 353 const base::DictionaryValue* header_dict = NULL; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 for (++it; it != fragments.end(); ++it) { | 391 for (++it; it != fragments.end(); ++it) { |
| 392 memcpy(dst, separator.data(), separator.size()); | 392 memcpy(dst, separator.data(), separator.size()); |
| 393 dst += separator.size(); | 393 dst += separator.size(); |
| 394 memcpy(dst, it->data(), it->size()); | 394 memcpy(dst, it->data(), it->size()); |
| 395 dst += it->size(); | 395 dst += it->size(); |
| 396 } | 396 } |
| 397 return dst - original_dst; | 397 return dst - original_dst; |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace net | 400 } // namespace net |
| OLD | NEW |