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

Side by Side Diff: net/socket/socket_bio_adapter.cc

Issue 2541093003: Instrument SSL sockets using MemoryDumpProvider (Closed)
Patch Set: rebased Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/socket/socket_bio_adapter.h" 5 #include "net/socket/socket_bio_adapter.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 SocketBIOAdapter::~SocketBIOAdapter() { 46 SocketBIOAdapter::~SocketBIOAdapter() {
47 // BIOs are reference-counted and may outlive the adapter. Clear the pointer 47 // BIOs are reference-counted and may outlive the adapter. Clear the pointer
48 // so future operations fail. 48 // so future operations fail.
49 bio_->ptr = nullptr; 49 bio_->ptr = nullptr;
50 } 50 }
51 51
52 bool SocketBIOAdapter::HasPendingReadData() { 52 bool SocketBIOAdapter::HasPendingReadData() {
53 return read_result_ > 0; 53 return read_result_ > 0;
54 } 54 }
55 55
56 size_t SocketBIOAdapter::GetAllocationSize() const {
57 size_t effective_size = 0;
Primiano Tucci (use gerrit) 2016/12/06 17:06:28 just a super minor comment: in memory-infra contex
xunjieli 2016/12/06 18:36:08 Done.
58 if (read_buffer_)
59 effective_size += read_buffer_capacity_;
60
61 if (write_buffer_)
62 effective_size += write_buffer_capacity_;
63 return effective_size;
64 }
65
56 int SocketBIOAdapter::BIORead(char* out, int len) { 66 int SocketBIOAdapter::BIORead(char* out, int len) {
57 if (len <= 0) 67 if (len <= 0)
58 return len; 68 return len;
59 69
60 // If there is no result available synchronously, report any Write() errors 70 // If there is no result available synchronously, report any Write() errors
61 // that were observed. Otherwise the application may have encountered a socket 71 // that were observed. Otherwise the application may have encountered a socket
62 // error while writing that would otherwise not be reported until the 72 // error while writing that would otherwise not be reported until the
63 // application attempted to write again - which it may never do. See 73 // application attempted to write again - which it may never do. See
64 // https://crbug.com/249848. 74 // https://crbug.com/249848.
65 if (write_error_ != OK && write_error_ != ERR_IO_PENDING && 75 if (write_error_ != OK && write_error_ != ERR_IO_PENDING &&
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 SocketBIOAdapter::BIOReadWrapper, 341 SocketBIOAdapter::BIOReadWrapper,
332 nullptr, // puts 342 nullptr, // puts
333 nullptr, // gets 343 nullptr, // gets
334 SocketBIOAdapter::BIOCtrlWrapper, 344 SocketBIOAdapter::BIOCtrlWrapper,
335 nullptr, // create 345 nullptr, // create
336 nullptr, // destroy 346 nullptr, // destroy
337 nullptr, // callback_ctrl 347 nullptr, // callback_ctrl
338 }; 348 };
339 349
340 } // namespace net 350 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698