• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "stream_socket_handle.h"
6 
7 #include <memory>
8 
9 #include "net/base/load_timing_info.h"
10 #include "net/log/net_log_with_source.h"
11 #include "net/socket/stream_socket.h"
12 
13 namespace net {
14 
15 StreamSocketHandle::StreamSocketHandle() = default;
16 
17 StreamSocketHandle::~StreamSocketHandle() = default;
18 
SetSocket(std::unique_ptr<StreamSocket> socket)19 void StreamSocketHandle::SetSocket(std::unique_ptr<StreamSocket> socket) {
20   socket_ = std::move(socket);
21 }
22 
PassSocket()23 std::unique_ptr<StreamSocket> StreamSocketHandle::PassSocket() {
24   return std::move(socket_);
25 }
26 
GetLoadTimingInfo(bool is_reused,LoadTimingInfo * load_timing_info) const27 bool StreamSocketHandle::GetLoadTimingInfo(
28     bool is_reused,
29     LoadTimingInfo* load_timing_info) const {
30   if (socket_) {
31     load_timing_info->socket_log_id = socket_->NetLog().source().id;
32   } else {
33     // Only return load timing information when there's a socket.
34     return false;
35   }
36 
37   load_timing_info->socket_reused = is_reused;
38 
39   // No times if the socket is reused.
40   if (is_reused) {
41     return true;
42   }
43 
44   load_timing_info->connect_timing = connect_timing_;
45   return true;
46 }
47 
AddHigherLayeredPool(HigherLayeredPool * pool)48 void StreamSocketHandle::AddHigherLayeredPool(HigherLayeredPool* pool) {}
49 
RemoveHigherLayeredPool(HigherLayeredPool * pool)50 void StreamSocketHandle::RemoveHigherLayeredPool(HigherLayeredPool* pool) {}
51 
52 }  // namespace net
53