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

Side by Side Diff: net/quic/chromium/quic_chromium_packet_reader.cc

Issue 2650943007: Track QuicChromiumClientSession in net/ MemoryDumpProvider (Closed)
Patch Set: address ssid comments Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/quic/chromium/quic_chromium_packet_reader.h" 5 #include "net/quic/chromium/quic_chromium_packet_reader.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Schedule the work through the message loop to 1) prevent infinite 59 // Schedule the work through the message loop to 1) prevent infinite
60 // recursion and 2) avoid blocking the thread for too long. 60 // recursion and 2) avoid blocking the thread for too long.
61 base::ThreadTaskRunnerHandle::Get()->PostTask( 61 base::ThreadTaskRunnerHandle::Get()->PostTask(
62 FROM_HERE, base::Bind(&QuicChromiumPacketReader::OnReadComplete, 62 FROM_HERE, base::Bind(&QuicChromiumPacketReader::OnReadComplete,
63 weak_factory_.GetWeakPtr(), rv)); 63 weak_factory_.GetWeakPtr(), rv));
64 } else { 64 } else {
65 OnReadComplete(rv); 65 OnReadComplete(rv);
66 } 66 }
67 } 67 }
68 68
69 size_t QuicChromiumPacketReader::EstimateMemoryUsage() const {
70 // Return the size of |read_buffer_|.
71 return kMaxPacketSize;
72 }
73
69 void QuicChromiumPacketReader::OnReadComplete(int result) { 74 void QuicChromiumPacketReader::OnReadComplete(int result) {
70 read_pending_ = false; 75 read_pending_ = false;
71 if (result == 0) 76 if (result == 0)
72 result = ERR_CONNECTION_CLOSED; 77 result = ERR_CONNECTION_CLOSED;
73 78
74 if (result < 0) { 79 if (result < 0) {
75 visitor_->OnReadError(result, socket_); 80 visitor_->OnReadError(result, socket_);
76 return; 81 return;
77 } 82 }
78 83
79 QuicReceivedPacket packet(read_buffer_->data(), result, clock_->Now()); 84 QuicReceivedPacket packet(read_buffer_->data(), result, clock_->Now());
80 IPEndPoint local_address; 85 IPEndPoint local_address;
81 IPEndPoint peer_address; 86 IPEndPoint peer_address;
82 socket_->GetLocalAddress(&local_address); 87 socket_->GetLocalAddress(&local_address);
83 socket_->GetPeerAddress(&peer_address); 88 socket_->GetPeerAddress(&peer_address);
84 if (!visitor_->OnPacket(packet, local_address, peer_address)) 89 if (!visitor_->OnPacket(packet, local_address, peer_address))
85 return; 90 return;
86 91
87 StartReading(); 92 StartReading();
88 } 93 }
89 94
90 } // namespace net 95 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698