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

Unified Diff: net/socket/stream_socket.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/socket/stream_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/stream_socket.h
diff --git a/net/socket/stream_socket.h b/net/socket/stream_socket.h
index a55859ddd5e9ea1014c36e6b6c45dbd6661dbce2..fe2f0a6951a632fe31dae04d91627c7aa5f8b5f7 100644
--- a/net/socket/stream_socket.h
+++ b/net/socket/stream_socket.h
@@ -13,12 +13,6 @@
#include "net/socket/next_proto.h"
#include "net/socket/socket.h"
-namespace base {
-namespace trace_event {
-class ProcessMemoryDump;
-}
-}
-
namespace net {
class IPEndPoint;
@@ -27,6 +21,25 @@ class SSLInfo;
class NET_EXPORT_PRIVATE StreamSocket : public Socket {
public:
+ // This is used in DumpMemoryStats() to track the estimate of memory usage of
+ // a socket.
+ struct NET_EXPORT_PRIVATE SocketMemoryStats {
+ public:
+ SocketMemoryStats();
+ ~SocketMemoryStats();
+ // Estimated total memory usage of this socket in bytes.
+ size_t total_size;
+ // Size of all buffers used by this socket in bytes.
+ size_t buffer_size;
+ // Number of certs used by this socket.
+ size_t cert_count;
+ // Total size of certs used by this socket in bytes.
+ size_t serialized_cert_size;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SocketMemoryStats);
+ };
+
~StreamSocket() override {}
// Called to establish a connection. Returns OK if the connection could be
@@ -116,12 +129,10 @@ class NET_EXPORT_PRIVATE StreamSocket : public Socket {
// Disconnect() is called.
virtual int64_t GetTotalReceivedBytes() const = 0;
- // Dumps memory allocation stats. |parent_dump_absolute_name| is the name
- // used by the parent MemoryAllocatorDump in the memory dump hierarchy.
- // Default implementation does nothing.
- virtual void DumpMemoryStats(
- base::trace_event::ProcessMemoryDump* pmd,
- const std::string& parent_dump_absolute_name) const {};
+ // Dumps memory allocation stats into |stats|. |stats| can be assumed as being
+ // default initialized upon entry. Implementations should override fields in
+ // |stats|. Default implementation does nothing.
+ virtual void DumpMemoryStats(SocketMemoryStats* stats) const {}
protected:
// The following class is only used to gather statistics about the history of
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/socket/stream_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698