Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: net/spdy/spdy_session_pool_unittest.cc

Issue 2623803002: Avoid creating MemoryAllocatorDump for individual sockets (Closed)
Patch Set: Address Eric's comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "net/spdy/spdy_session_pool.h" 5 #include "net/spdy/spdy_session_pool.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 process_memory_dump->CreateAllocatorDump("parent"); 700 process_memory_dump->CreateAllocatorDump("parent");
701 spdy_session_pool_->DumpMemoryStats(process_memory_dump.get(), 701 spdy_session_pool_->DumpMemoryStats(process_memory_dump.get(),
702 parent_dump->absolute_name()); 702 parent_dump->absolute_name());
703 703
704 // Whether SpdySession::DumpMemoryStats() is invoked. 704 // Whether SpdySession::DumpMemoryStats() is invoked.
705 bool did_dump = false; 705 bool did_dump = false;
706 const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap& 706 const base::trace_event::ProcessMemoryDump::AllocatorDumpsMap&
707 allocator_dumps = process_memory_dump->allocator_dumps(); 707 allocator_dumps = process_memory_dump->allocator_dumps();
708 for (const auto& pair : allocator_dumps) { 708 for (const auto& pair : allocator_dumps) {
709 const std::string& dump_name = pair.first; 709 const std::string& dump_name = pair.first;
710 if (dump_name.find("spdy_session_pool/session") == std::string::npos) 710 if (dump_name.find("spdy_session_pool") == std::string::npos)
711 continue; 711 continue;
712 std::unique_ptr<base::Value> raw_attrs = 712 std::unique_ptr<base::Value> raw_attrs =
713 pair.second->attributes_for_testing()->ToBaseValue(); 713 pair.second->attributes_for_testing()->ToBaseValue();
714 base::DictionaryValue* attrs; 714 base::DictionaryValue* attrs;
715 ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs)); 715 ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs));
716 base::DictionaryValue* is_active_attrs; 716 base::DictionaryValue* active_session_count_attr;
717 ASSERT_TRUE(attrs->GetDictionary("active", &is_active_attrs)); 717 ASSERT_TRUE(attrs->GetDictionary("active_session_count",
718 std::string is_active; 718 &active_session_count_attr));
719 ASSERT_TRUE(is_active_attrs->GetString("value", &is_active)); 719 std::string active_session_count;
720 ASSERT_TRUE(
721 active_session_count_attr->GetString("value", &active_session_count));
720 // No created stream so the session should be idle. 722 // No created stream so the session should be idle.
721 ASSERT_EQ("0", is_active); 723 ASSERT_EQ("0", active_session_count);
722 did_dump = true; 724 did_dump = true;
723 } 725 }
724 EXPECT_TRUE(did_dump); 726 EXPECT_TRUE(did_dump);
725 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED); 727 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED);
726 } 728 }
727 729
728 } // namespace net 730 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698