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

Unified Diff: net/socket/stream_socket.h

Issue 2623803002: Avoid creating MemoryAllocatorDump for individual sockets (Closed)
Patch Set: self review 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..7badc1df30196dd8784b6cc0aca792195240c526 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 SocketMemoryStats {
+ public:
+ SocketMemoryStats();
+ ~SocketMemoryStats();
+ // Estimated total memory usage of this Socket.
eroman 2017/01/11 02:19:58 It is worth mentioning somewhere that all of the "
xunjieli 2017/01/11 20:05:07 Done.
+ size_t total_size;
+ // Size of all buffers used by this Socket.
+ size_t buffer_size;
+ // Number of certs used this Socket.
ssid 2017/01/10 23:48:13 used by/in
xunjieli 2017/01/11 20:05:07 Done.
+ size_t cert_count;
+ // Total Size of certs used this Socket.
+ 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,9 @@ 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 int |stats|. Default implementation does
eroman 2017/01/11 02:19:58 Please clarify whether |stats| can be assumed as b
xunjieli 2017/01/11 20:05:07 Done.
+ // nothing.
+ 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