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

Unified Diff: net/socket/stream_socket.h

Issue 2623803002: Avoid creating MemoryAllocatorDump for individual sockets (Closed)
Patch Set: Add NET_EXPORT_PRIVATE to fix WIN compile 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
Index: net/socket/stream_socket.h
diff --git a/net/socket/stream_socket.h b/net/socket/stream_socket.h
index a55859ddd5e9ea1014c36e6b6c45dbd6661dbce2..a75cd7fa68d7cfde8f0bda25daa1565b28b8ece7 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| and not increment them. Default implementation does nothing.
eroman 2017/01/11 22:15:14 nit: can omit the phrasing about "not increment th
xunjieli 2017/01/11 23:19:24 Done.
+ virtual void DumpMemoryStats(SocketMemoryStats* stats) const {}
protected:
// The following class is only used to gather statistics about the history of

Powered by Google App Engine
This is Rietveld 408576698