Rewrite most `Foo* field_` pointer fields to `raw_ptr<Foo> field_`.
DO NOT REVERT (unless absolutely necessary)! Report build breaks to keishi@(APAC)/glazunov@(EMEA)/sebmarchand@(NA) as soon as you see them. Fixes are expected to be trivial.
This commit was generated automatically, by running the following script: tools/clang/rewrite_raw_ptr_fields/rewrite-multiple-platforms.sh on commit fe74bc434e5b7e92d13a328362fcb6df15d8847e
For more information, see MiraclePtr One Pager [1], the PSA at chromium-dev@ [2], and the raw_ptr documentation in //base/memory/raw_ptr.md.
FYI This CL does not enable MiraclePtr protection and we expect no behavior change from this.
[1] https://docs.google.com/document/d/1pnnOAIz_DMWDI4oIOFoMAqLnf_MZ2GsrJNb_dbQ3ZBg/edit?usp=sharing
[2] https://groups.google.com/a/chromium.org/g/chromium-dev/c/vAEeVifyf78/m/SkBUc6PhBAAJ
Binary-Size: Increase of around 500kb was approved for MiraclePtr
Include-Ci-Only-Tests: true
No-Tree-Checks: true
No-Presubmit: true
Bug: 1272324, 1073933
Change-Id: I05c86a83bbb4b3f4b017f361dd7f4e7437697f69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3305132
Commit-Queue: Keishi Hattori <[email protected]>
Reviewed-by: Bartek Nowierski <[email protected]>
Owners-Override: Bartek Nowierski <[email protected]>
Cr-Commit-Position: refs/heads/main@{#945735}
diff --git a/net/socket/client_socket_handle.h b/net/socket/client_socket_handle.h
index a96c0dfd9..e62b9e15 100644
--- a/net/socket/client_socket_handle.h
+++ b/net/socket/client_socket_handle.h
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/check.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "net/base/ip_endpoint.h"
@@ -230,8 +231,8 @@
void ResetErrorState();
bool is_initialized_;
- ClientSocketPool* pool_;
- HigherLayeredPool* higher_pool_;
+ raw_ptr<ClientSocketPool> pool_;
+ raw_ptr<HigherLayeredPool> higher_pool_;
std::unique_ptr<StreamSocket> socket_;
ClientSocketPool::GroupId group_id_;
SocketReuseType reuse_type_;
diff --git a/net/socket/client_socket_pool.h b/net/socket/client_socket_pool.h
index 63695a0..7556425d 100644
--- a/net/socket/client_socket_pool.h
+++ b/net/socket/client_socket_pool.h
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "net/base/completion_once_callback.h"
@@ -356,7 +357,7 @@
private:
const bool is_for_websockets_;
- const CommonConnectJobParams* const common_connect_job_params_;
+ const raw_ptr<const CommonConnectJobParams> common_connect_job_params_;
const std::unique_ptr<ConnectJobFactory> connect_job_factory_;
};
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index ad72beb..e70d2ee 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/memory/raw_ptr.h"
#include "net/socket/transport_client_socket_pool.h"
#include <stdint.h>
@@ -535,7 +536,7 @@
bool waiting_success_;
const JobType job_type_;
- MockClientSocketFactory* const client_socket_factory_;
+ const raw_ptr<MockClientSocketFactory> client_socket_factory_;
LoadState load_state_;
bool has_established_connection_;
bool store_additional_error_state_;
@@ -594,9 +595,9 @@
private:
TestConnectJob::JobType job_type_ = TestConnectJob::kMockJob;
- std::list<TestConnectJob::JobType>* job_types_ = nullptr;
+ raw_ptr<std::list<TestConnectJob::JobType>> job_types_ = nullptr;
base::TimeDelta timeout_duration_;
- MockClientSocketFactory* const client_socket_factory_;
+ const raw_ptr<MockClientSocketFactory> client_socket_factory_;
};
} // namespace
@@ -737,7 +738,7 @@
nullptr /* websocket_endpoint_lock_manager */};
bool connect_backup_jobs_enabled_;
MockClientSocketFactory client_socket_factory_;
- TestConnectJobFactory* connect_job_factory_;
+ raw_ptr<TestConnectJobFactory> connect_job_factory_;
RecordingNetLogObserver net_log_observer_;
// These parameters are never actually used to create a TransportConnectJob.
scoped_refptr<ClientSocketPool::SocketParams> params_;
@@ -2934,7 +2935,7 @@
ClientSocketPool::ProxyAuthCallback(), pool_, NetLogWithSource()));
}
- TransportClientSocketPool* const pool_;
+ const raw_ptr<TransportClientSocketPool> pool_;
int expected_result_;
bool reset_releasing_handle_;
ClientSocketHandle handle_;
@@ -3068,7 +3069,7 @@
const ClientSocketPool::GroupId group_id_;
const scoped_refptr<ClientSocketPool::SocketParams> params_;
- TransportClientSocketPool* const pool_;
+ const raw_ptr<TransportClientSocketPool> pool_;
ClientSocketHandle handle_;
TestCompletionCallback nested_callback_;
};
@@ -4835,7 +4836,7 @@
MOCK_METHOD0(CloseOneIdleConnection, bool());
private:
- TransportClientSocketPool* const pool_;
+ const raw_ptr<TransportClientSocketPool> pool_;
ClientSocketHandle handle_;
TestCompletionCallback callback_;
const ClientSocketPool::GroupId group_id_;
diff --git a/net/socket/connect_job.h b/net/socket/connect_job.h
index 52e20921..44c3017e 100644
--- a/net/socket/connect_job.h
+++ b/net/socket/connect_job.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/callback_forward.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -74,22 +75,22 @@
CommonConnectJobParams& operator=(const CommonConnectJobParams& other);
- ClientSocketFactory* client_socket_factory;
- HostResolver* host_resolver;
- HttpAuthCache* http_auth_cache;
- HttpAuthHandlerFactory* http_auth_handler_factory;
- SpdySessionPool* spdy_session_pool;
- const quic::ParsedQuicVersionVector* quic_supported_versions;
- QuicStreamFactory* quic_stream_factory;
- ProxyDelegate* proxy_delegate;
- const HttpUserAgentSettings* http_user_agent_settings;
- SSLClientContext* ssl_client_context;
- SocketPerformanceWatcherFactory* socket_performance_watcher_factory;
- NetworkQualityEstimator* network_quality_estimator;
- NetLog* net_log;
+ raw_ptr<ClientSocketFactory> client_socket_factory;
+ raw_ptr<HostResolver> host_resolver;
+ raw_ptr<HttpAuthCache> http_auth_cache;
+ raw_ptr<HttpAuthHandlerFactory> http_auth_handler_factory;
+ raw_ptr<SpdySessionPool> spdy_session_pool;
+ raw_ptr<const quic::ParsedQuicVersionVector> quic_supported_versions;
+ raw_ptr<QuicStreamFactory> quic_stream_factory;
+ raw_ptr<ProxyDelegate> proxy_delegate;
+ raw_ptr<const HttpUserAgentSettings> http_user_agent_settings;
+ raw_ptr<SSLClientContext> ssl_client_context;
+ raw_ptr<SocketPerformanceWatcherFactory> socket_performance_watcher_factory;
+ raw_ptr<NetworkQualityEstimator> network_quality_estimator;
+ raw_ptr<NetLog> net_log;
// This must only be non-null for WebSockets.
- WebSocketEndpointLockManager* websocket_endpoint_lock_manager;
+ raw_ptr<WebSocketEndpointLockManager> websocket_endpoint_lock_manager;
};
// When a host resolution completes, OnHostResolutionCallback() is invoked. If
@@ -301,10 +302,10 @@
const base::TimeDelta timeout_duration_;
RequestPriority priority_;
const SocketTag socket_tag_;
- const CommonConnectJobParams* common_connect_job_params_;
+ raw_ptr<const CommonConnectJobParams> common_connect_job_params_;
// Timer to abort jobs that take too long.
base::OneShotTimer timer_;
- Delegate* delegate_;
+ raw_ptr<Delegate> delegate_;
std::unique_ptr<StreamSocket> socket_;
// Indicates if this is the topmost ConnectJob. The topmost ConnectJob logs an
// extra begin and end event, to allow callers to log extra data before the
diff --git a/net/socket/connect_job_factory_unittest.cc b/net/socket/connect_job_factory_unittest.cc
index d29a873..33e10343 100644
--- a/net/socket/connect_job_factory_unittest.cc
+++ b/net/socket/connect_job_factory_unittest.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <vector>
+#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "net/base/host_port_pair.h"
#include "net/base/network_isolation_key.h"
@@ -216,11 +217,11 @@
/*websocket_endpoint_lock_manager=*/nullptr};
TestConnectJobDelegate delegate_;
- TestHttpProxyConnectJobFactory* http_proxy_job_factory_;
- TestSocksConnectJobFactory* socks_job_factory_;
- TestSslConnectJobFactory* ssl_job_factory_;
- TestTransportConnectJobFactory* transport_job_factory_;
- TestWebsocketConnectJobFactory* websocket_job_factory_;
+ raw_ptr<TestHttpProxyConnectJobFactory> http_proxy_job_factory_;
+ raw_ptr<TestSocksConnectJobFactory> socks_job_factory_;
+ raw_ptr<TestSslConnectJobFactory> ssl_job_factory_;
+ raw_ptr<TestTransportConnectJobFactory> transport_job_factory_;
+ raw_ptr<TestWebsocketConnectJobFactory> websocket_job_factory_;
std::unique_ptr<ConnectJobFactory> factory_;
};
diff --git a/net/socket/sequenced_socket_data_unittest.cc b/net/socket/sequenced_socket_data_unittest.cc
index 49a42b9..32fbd49 100644
--- a/net/socket/sequenced_socket_data_unittest.cc
+++ b/net/socket/sequenced_socket_data_unittest.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/cxx17_backports.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "net/base/completion_once_callback.h"
@@ -133,7 +134,7 @@
}
}
- StreamSocket* socket_;
+ raw_ptr<StreamSocket> socket_;
bool verify_read_;
scoped_refptr<IOBuffer> first_read_buf_;
diff --git a/net/socket/socket_bio_adapter.h b/net/socket/socket_bio_adapter.h
index 600da8c..f5fed240 100644
--- a/net/socket/socket_bio_adapter.h
+++ b/net/socket/socket_bio_adapter.h
@@ -5,6 +5,7 @@
#ifndef NET_SOCKET_SOCKET_BIO_ADAPTER_H_
#define NET_SOCKET_SOCKET_BIO_ADAPTER_H_
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "net/base/completion_repeating_callback.h"
@@ -108,7 +109,7 @@
// The pointer is non-owning so this class may be used with both
// ClientSocketHandles and raw StreamSockets.
- StreamSocket* socket_;
+ raw_ptr<StreamSocket> socket_;
CompletionRepeatingCallback read_callback_;
CompletionRepeatingCallback write_callback_;
@@ -138,7 +139,7 @@
// have failed.
int write_error_;
- Delegate* delegate_;
+ raw_ptr<Delegate> delegate_;
base::WeakPtrFactory<SocketBIOAdapter> weak_factory_{this};
};
diff --git a/net/socket/socket_bio_adapter_unittest.cc b/net/socket/socket_bio_adapter_unittest.cc
index 9871e79c..bf99850 100644
--- a/net/socket/socket_bio_adapter_unittest.cc
+++ b/net/socket/socket_bio_adapter_unittest.cc
@@ -11,6 +11,7 @@
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/location.h"
+#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "crypto/openssl_util.h"
#include "net/base/address_list.h"
@@ -153,7 +154,7 @@
bool expect_read_ready_ = false;
bool expect_write_ready_ = false;
MockClientSocketFactory factory_;
- std::unique_ptr<SocketBIOAdapter>* reset_on_write_ready_ = nullptr;
+ raw_ptr<std::unique_ptr<SocketBIOAdapter>> reset_on_write_ready_ = nullptr;
};
INSTANTIATE_TEST_SUITE_P(All,
diff --git a/net/socket/socket_posix.h b/net/socket/socket_posix.h
index 2e2ee09..29b0209 100644
--- a/net/socket/socket_posix.h
+++ b/net/socket/socket_posix.h
@@ -8,6 +8,7 @@
#include <memory>
#include "base/compiler_specific.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_pump_for_io.h"
#include "base/threading/thread_checker.h"
@@ -129,7 +130,7 @@
SocketDescriptor socket_fd_;
base::MessagePumpForIO::FdWatchController accept_socket_watcher_;
- std::unique_ptr<SocketPosix>* accept_socket_;
+ raw_ptr<std::unique_ptr<SocketPosix>> accept_socket_;
CompletionOnceCallback accept_callback_;
base::MessagePumpForIO::FdWatchController read_socket_watcher_;
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index f418cfb..82a6f75c 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -19,6 +19,7 @@
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/memory/ptr_util.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
@@ -315,7 +316,7 @@
virtual void Reset() = 0;
MockConnect connect_;
- AsyncSocket* socket_ = nullptr;
+ raw_ptr<AsyncSocket> socket_ = nullptr;
int receive_buffer_size_ = -1;
int send_buffer_size_ = -1;
@@ -595,7 +596,7 @@
void MaybePostWriteCompleteTask();
StaticSocketDataHelper helper_;
- SocketDataPrinter* printer_ = nullptr;
+ raw_ptr<SocketDataPrinter> printer_ = nullptr;
int sequence_number_;
IoState read_state_;
IoState write_state_;
@@ -863,7 +864,7 @@
AddressList addresses_;
- SocketDataProvider* data_;
+ raw_ptr<SocketDataProvider> data_;
int read_offset_;
MockRead read_data_;
bool need_read_data_;
@@ -955,7 +956,7 @@
NetLogWithSource net_log_;
std::unique_ptr<StreamSocket> socket_;
- ProxyClientSocketDataProvider* data_;
+ raw_ptr<ProxyClientSocketDataProvider> data_;
scoped_refptr<HttpAuthController> auth_controller_;
base::WeakPtrFactory<MockProxyClientSocket> weak_factory_{this};
@@ -1043,7 +1044,7 @@
bool in_confirm_handshake_ = false;
NetLogWithSource net_log_;
std::unique_ptr<StreamSocket> stream_socket_;
- SSLSocketDataProvider* data_;
+ raw_ptr<SSLSocketDataProvider> data_;
// Address of the "remote" peer we're connected to.
IPEndPoint peer_addr_;
@@ -1133,7 +1134,7 @@
void RunCallback(CompletionOnceCallback callback, int result);
bool connected_;
- SocketDataProvider* data_;
+ raw_ptr<SocketDataProvider> data_;
int read_offset_;
MockRead read_data_;
bool need_read_data_;
@@ -1184,8 +1185,8 @@
void OnComplete(int result);
ClientSocketHandle handle_;
- std::vector<TestSocketRequest*>* request_order_;
- size_t* completion_count_;
+ raw_ptr<std::vector<TestSocketRequest*>> request_order_;
+ raw_ptr<size_t> completion_count_;
};
class ClientSocketPoolTest {
@@ -1295,7 +1296,7 @@
void OnConnect(int rv);
std::unique_ptr<StreamSocket> socket_;
- ClientSocketHandle* handle_;
+ raw_ptr<ClientSocketHandle> handle_;
const SocketTag socket_tag_;
CompletionOnceCallback user_callback_;
RequestPriority priority_;
@@ -1346,7 +1347,7 @@
int64_t generation) override;
private:
- ClientSocketFactory* client_socket_factory_;
+ raw_ptr<ClientSocketFactory> client_socket_factory_;
std::vector<std::unique_ptr<MockConnectJob>> job_list_;
RequestPriority last_request_priority_;
int release_count_;
@@ -1461,8 +1462,8 @@
MockUDPClientSocket* GetLastProducedUDPSocket() const { return udp_socket_; }
private:
- MockTaggingStreamSocket* tcp_socket_ = nullptr;
- MockUDPClientSocket* udp_socket_ = nullptr;
+ raw_ptr<MockTaggingStreamSocket> tcp_socket_ = nullptr;
+ raw_ptr<MockUDPClientSocket> udp_socket_ = nullptr;
};
// Host / port used for SOCKS4 test strings.
diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc
index 1c9cdb5..71db31c 100644
--- a/net/socket/socks5_client_socket_unittest.cc
+++ b/net/socket/socks5_client_socket_unittest.cc
@@ -13,6 +13,7 @@
#include "base/containers/span.h"
#include "base/cxx17_backports.h"
#include "base/memory/ptr_util.h"
+#include "base/memory/raw_ptr.h"
#include "base/sys_byteorder.h"
#include "build/build_config.h"
#include "net/base/address_list.h"
@@ -67,7 +68,7 @@
AddressList address_list_;
// Filled in by BuildMockSocket() and owned by its return value
// (which |user_sock| is set to).
- StreamSocket* tcp_sock_;
+ raw_ptr<StreamSocket> tcp_sock_;
TestCompletionCallback callback_;
std::unique_ptr<SocketDataProvider> data_;
};
@@ -102,7 +103,7 @@
// The SOCKS5ClientSocket takes ownership of |tcp_sock_|, but keep a
// non-owning pointer to it.
- return std::make_unique<SOCKS5ClientSocket>(base::WrapUnique(tcp_sock_),
+ return std::make_unique<SOCKS5ClientSocket>(base::WrapUnique(tcp_sock_.get()),
HostPortPair(hostname, port),
TRAFFIC_ANNOTATION_FOR_TESTS);
}
diff --git a/net/socket/socks_client_socket.h b/net/socket/socks_client_socket.h
index 8fba2b80..e05db2f 100644
--- a/net/socket/socks_client_socket.h
+++ b/net/socket/socks_client_socket.h
@@ -12,6 +12,7 @@
#include <string>
#include "base/gtest_prod_util.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "net/base/address_list.h"
#include "net/base/completion_once_callback.h"
@@ -145,7 +146,7 @@
bool was_ever_used_;
// Used to resolve the hostname to which the SOCKS proxy will connect.
- HostResolver* host_resolver_;
+ raw_ptr<HostResolver> host_resolver_;
SecureDnsPolicy secure_dns_policy_;
std::unique_ptr<HostResolver::ResolveHostRequest> resolve_host_request_;
const HostPortPair destination_;
diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc
index fab104b..57aa86a 100644
--- a/net/socket/socks_client_socket_unittest.cc
+++ b/net/socket/socks_client_socket_unittest.cc
@@ -9,6 +9,7 @@
#include "base/containers/span.h"
#include "base/cxx17_backports.h"
+#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "net/base/address_list.h"
#include "net/base/test_completion_callback.h"
@@ -56,7 +57,7 @@
AddressList address_list_;
// Filled in by BuildMockSocket() and owned by its return value
// (which |user_sock| is set to).
- StreamSocket* tcp_sock_;
+ raw_ptr<StreamSocket> tcp_sock_;
TestCompletionCallback callback_;
std::unique_ptr<MockHostResolver> host_resolver_;
std::unique_ptr<SocketDataProvider> data_;
diff --git a/net/socket/socks_connect_job.h b/net/socket/socks_connect_job.h
index 17f53ad1..1d6e7db4 100644
--- a/net/socket/socks_connect_job.h
+++ b/net/socket/socks_connect_job.h
@@ -7,6 +7,7 @@
#include <memory>
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "net/base/completion_once_callback.h"
@@ -141,7 +142,7 @@
State next_state_;
std::unique_ptr<ConnectJob> transport_connect_job_;
std::unique_ptr<StreamSocket> socket_;
- SOCKSClientSocket* socks_socket_ptr_;
+ raw_ptr<SOCKSClientSocket> socks_socket_ptr_;
ResolveErrorInfo resolve_error_info_;
};
diff --git a/net/socket/ssl_client_socket.h b/net/socket/ssl_client_socket.h
index a7468e2b..2863e2e 100644
--- a/net/socket/ssl_client_socket.h
+++ b/net/socket/ssl_client_socket.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/gtest_prod_util.h"
+#include "base/memory/raw_ptr.h"
#include "base/observer_list.h"
#include "net/base/net_export.h"
#include "net/cert/cert_database.h"
@@ -189,12 +190,12 @@
SSLContextConfig config_;
- SSLConfigService* ssl_config_service_;
- CertVerifier* cert_verifier_;
- TransportSecurityState* transport_security_state_;
- CTPolicyEnforcer* ct_policy_enforcer_;
- SSLClientSessionCache* ssl_client_session_cache_;
- SCTAuditingDelegate* sct_auditing_delegate_;
+ raw_ptr<SSLConfigService> ssl_config_service_;
+ raw_ptr<CertVerifier> cert_verifier_;
+ raw_ptr<TransportSecurityState> transport_security_state_;
+ raw_ptr<CTPolicyEnforcer> ct_policy_enforcer_;
+ raw_ptr<SSLClientSessionCache> ssl_client_session_cache_;
+ raw_ptr<SCTAuditingDelegate> sct_auditing_delegate_;
SSLClientAuthCache ssl_client_auth_cache_;
diff --git a/net/socket/ssl_client_socket_impl.h b/net/socket/ssl_client_socket_impl.h
index e00b70c..60a3464 100644
--- a/net/socket/ssl_client_socket_impl.h
+++ b/net/socket/ssl_client_socket_impl.h
@@ -14,6 +14,7 @@
#include "base/compiler_specific.h"
#include "base/containers/lru_cache.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "net/base/completion_once_callback.h"
@@ -254,7 +255,7 @@
// network.
bool was_ever_used_;
- SSLClientContext* const context_;
+ const raw_ptr<SSLClientContext> context_;
std::unique_ptr<CertVerifier::Request> cert_verifier_request_;
base::TimeTicks start_cert_verification_time_;
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index 2708956..aa18ad9 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -17,6 +17,7 @@
#include "base/cxx17_backports.h"
#include "base/files/file_util.h"
#include "base/location.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
@@ -585,7 +586,7 @@
SetResult(result);
}
- StreamSocket* socket_;
+ raw_ptr<StreamSocket> socket_;
};
// A mock ExpectCTReporter that remembers the latest violation that was
@@ -634,8 +635,8 @@
HostPortPair host_port_pair_;
GURL report_uri_;
uint32_t num_failures_;
- const X509Certificate* served_certificate_chain_;
- const X509Certificate* validated_certificate_chain_;
+ raw_ptr<const X509Certificate> served_certificate_chain_;
+ raw_ptr<const X509Certificate> validated_certificate_chain_;
SignedCertificateTimestampAndStatusList signed_certificate_timestamps_;
NetworkIsolationKey network_isolation_key_;
};
@@ -882,7 +883,7 @@
}
RecordingNetLogObserver log_observer_;
- ClientSocketFactory* socket_factory_;
+ raw_ptr<ClientSocketFactory> socket_factory_;
std::unique_ptr<TestSSLConfigService> ssl_config_service_;
std::unique_ptr<MockCertVerifier> cert_verifier_;
std::unique_ptr<TransportSecurityState> transport_security_state_;
@@ -996,7 +997,7 @@
}
private:
- ClientSocketFactory* const factory_;
+ const raw_ptr<ClientSocketFactory> factory_;
};
std::vector<uint16_t> GetTLSVersions() {
@@ -1448,7 +1449,7 @@
~HangingRequest() override { verifier_->num_active_requests_--; }
private:
- HangingCertVerifier* verifier_;
+ raw_ptr<HangingCertVerifier> verifier_;
};
base::RunLoop run_loop_;
diff --git a/net/socket/ssl_server_socket_impl.cc b/net/socket/ssl_server_socket_impl.cc
index 272066d..69354e5 100644
--- a/net/socket/ssl_server_socket_impl.cc
+++ b/net/socket/ssl_server_socket_impl.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/logging.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_util.h"
#include "crypto/openssl_util.h"
@@ -168,7 +169,7 @@
int Init();
void ExtractClientCert();
- SSLServerContextImpl* context_;
+ raw_ptr<SSLServerContextImpl> context_;
NetLogWithSource net_log_;
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc
index f2ec43b..47571e2 100644
--- a/net/socket/ssl_server_socket_unittest.cc
+++ b/net/socket/ssl_server_socket_unittest.cc
@@ -30,6 +30,7 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/location.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "base/run_loop.h"
@@ -301,8 +302,8 @@
private:
NetLogWithSource net_log_;
- FakeDataChannel* incoming_;
- FakeDataChannel* outgoing_;
+ raw_ptr<FakeDataChannel> incoming_;
+ raw_ptr<FakeDataChannel> outgoing_;
};
} // namespace
diff --git a/net/socket/tcp_client_socket.h b/net/socket/tcp_client_socket.h
index 4062e51..64acd7a 100644
--- a/net/socket/tcp_client_socket.h
+++ b/net/socket/tcp_client_socket.h
@@ -10,6 +10,7 @@
#include <memory>
#include "base/compiler_specific.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/power_monitor/power_observer.h"
#include "base/timer/timer.h"
@@ -230,7 +231,7 @@
// The NetworkQualityEstimator for the context this socket is associated with.
// Can be nullptr.
- NetworkQualityEstimator* network_quality_estimator_;
+ raw_ptr<NetworkQualityEstimator> network_quality_estimator_;
base::OneShotTimer connect_attempt_timer_;
diff --git a/net/socket/tcp_socket_win.cc b/net/socket/tcp_socket_win.cc
index bcdc4f69..e8fd9d95 100644
--- a/net/socket/tcp_socket_win.cc
+++ b/net/socket/tcp_socket_win.cc
@@ -16,6 +16,7 @@
#include "base/check_op.h"
#include "base/files/file_util.h"
#include "base/logging.h"
+#include "base/memory/raw_ptr.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
@@ -149,7 +150,7 @@
void OnObjectSignaled(HANDLE object) override;
private:
- Core* const core_;
+ const raw_ptr<Core> core_;
};
class WriteDelegate : public base::win::ObjectWatcher::Delegate {
@@ -161,13 +162,13 @@
void OnObjectSignaled(HANDLE object) override;
private:
- Core* const core_;
+ const raw_ptr<Core> core_;
};
~Core();
// The socket that created this object.
- TCPSocketWin* socket_;
+ raw_ptr<TCPSocketWin> socket_;
// |reader_| handles the signals from |read_watcher_|.
ReadDelegate reader_;
diff --git a/net/socket/tcp_socket_win.h b/net/socket/tcp_socket_win.h
index 8c65c86..eda785e 100644
--- a/net/socket/tcp_socket_win.h
+++ b/net/socket/tcp_socket_win.h
@@ -11,6 +11,7 @@
#include <memory>
#include "base/compiler_specific.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/threading/thread_checker.h"
#include "base/win/object_watcher.h"
@@ -168,8 +169,8 @@
HANDLE accept_event_;
base::win::ObjectWatcher accept_watcher_;
- std::unique_ptr<TCPSocketWin>* accept_socket_;
- IPEndPoint* accept_address_;
+ raw_ptr<std::unique_ptr<TCPSocketWin>> accept_socket_;
+ raw_ptr<IPEndPoint> accept_address_;
CompletionOnceCallback accept_callback_;
// The various states that the socket could be in.
diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h
index 9de173b..3da85ad0 100644
--- a/net/socket/transport_client_socket_pool.h
+++ b/net/socket/transport_client_socket_pool.h
@@ -16,6 +16,7 @@
#include <utility>
#include <vector>
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
@@ -132,7 +133,7 @@
ConnectJob* ReleaseJob();
private:
- ClientSocketHandle* const handle_;
+ const raw_ptr<ClientSocketHandle> handle_;
CompletionOnceCallback callback_;
const ProxyAuthCallback proxy_auth_callback_;
RequestPriority priority_;
@@ -142,7 +143,7 @@
const absl::optional<NetworkTrafficAnnotationTag> proxy_annotation_tag_;
const NetLogWithSource net_log_;
const SocketTag socket_tag_;
- ConnectJob* job_;
+ raw_ptr<ConnectJob> job_;
};
TransportClientSocketPool(
@@ -536,7 +537,7 @@
void SanityCheck() const;
const GroupId group_id_;
- TransportClientSocketPool* const client_socket_pool_;
+ const raw_ptr<TransportClientSocketPool> client_socket_pool_;
// Total number of ConnectJobs that have never been assigned to a Request.
// Since jobs use late binding to requests, which ConnectJobs have or have
@@ -793,7 +794,7 @@
// their idle sockets when it stalls. Must be empty on destruction.
std::set<HigherLayeredPool*> higher_pools_;
- SSLClientContext* const ssl_client_context_;
+ const raw_ptr<SSLClientContext> ssl_client_context_;
base::WeakPtrFactory<TransportClientSocketPool> weak_factory_{this};
};
diff --git a/net/socket/transport_client_socket_pool_test_util.h b/net/socket/transport_client_socket_pool_test_util.h
index 00e9498..6e915bbd 100644
--- a/net/socket/transport_client_socket_pool_test_util.h
+++ b/net/socket/transport_client_socket_pool_test_util.h
@@ -15,6 +15,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/containers/queue.h"
+#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "net/base/address_list.h"
#include "net/socket/client_socket_factory.h"
@@ -131,10 +132,10 @@
base::OnceClosure WaitForTriggerableSocketCreation();
private:
- NetLog* net_log_;
+ raw_ptr<NetLog> net_log_;
int allocation_count_;
ClientSocketType client_socket_type_;
- ClientSocketType* client_socket_types_;
+ raw_ptr<ClientSocketType> client_socket_types_;
int client_socket_index_;
int client_socket_index_max_;
base::TimeDelta delay_;
diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc
index 2560b3c..70fa911 100644
--- a/net/socket/transport_client_socket_pool_unittest.cc
+++ b/net/socket/transport_client_socket_pool_unittest.cc
@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/cxx17_backports.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
@@ -898,8 +899,8 @@
const ClientSocketPool::GroupId group_id_;
scoped_refptr<ClientSocketPool::SocketParams> socket_params_;
- ClientSocketHandle* const handle_;
- TransportClientSocketPool* const pool_;
+ const raw_ptr<ClientSocketHandle> handle_;
+ const raw_ptr<TransportClientSocketPool> pool_;
bool within_callback_;
};
diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc
index ba922cb..96fbfb93a 100644
--- a/net/socket/transport_client_socket_unittest.cc
+++ b/net/socket/transport_client_socket_unittest.cc
@@ -6,6 +6,7 @@
#include <string>
#include "base/bind.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "net/base/address_list.h"
@@ -92,7 +93,7 @@
base::RunLoop connect_loop_;
uint16_t listen_port_;
RecordingNetLogObserver net_log_observer_;
- ClientSocketFactory* const socket_factory_;
+ const raw_ptr<ClientSocketFactory> socket_factory_;
std::unique_ptr<StreamSocket> sock_;
std::unique_ptr<StreamSocket> connected_sock_;
diff --git a/net/socket/udp_socket_posix.h b/net/socket/udp_socket_posix.h
index 0fed793..f5b0e0b 100644
--- a/net/socket/udp_socket_posix.h
+++ b/net/socket/udp_socket_posix.h
@@ -12,6 +12,7 @@
#include <memory>
#include "base/logging.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_pump_for_io.h"
#include "base/threading/thread_checker.h"
@@ -403,7 +404,7 @@
bool watching() { return watching_; }
private:
- UDPSocketPosix* const socket_;
+ const raw_ptr<UDPSocketPosix> socket_;
bool watching_;
};
@@ -447,7 +448,7 @@
void OnFileCanWriteWithoutBlocking(int /* fd */) override {}
private:
- UDPSocketPosix* const socket_;
+ const raw_ptr<UDPSocketPosix> socket_;
};
class WriteWatcher : public base::MessagePumpForIO::FdWatcher {
@@ -464,7 +465,7 @@
void OnFileCanWriteWithoutBlocking(int /* fd */) override;
private:
- UDPSocketPosix* const socket_;
+ const raw_ptr<UDPSocketPosix> socket_;
};
int InternalWriteAsync(CompletionOnceCallback callback,
@@ -593,7 +594,7 @@
// The buffer used by InternalRead() to retry Read requests
scoped_refptr<IOBuffer> read_buf_;
int read_buf_len_;
- IPEndPoint* recv_from_address_;
+ raw_ptr<IPEndPoint> recv_from_address_;
// The buffer used by InternalWrite() to retry Write requests
scoped_refptr<IOBuffer> write_buf_;
diff --git a/net/socket/udp_socket_unittest.cc b/net/socket/udp_socket_unittest.cc
index 4ac5590c..d77fcaa1 100644
--- a/net/socket/udp_socket_unittest.cc
+++ b/net/socket/udp_socket_unittest.cc
@@ -10,6 +10,7 @@
#include "base/containers/circular_deque.h"
#include "base/cxx17_backports.h"
#include "base/location.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/scoped_clear_last_error.h"
@@ -858,7 +859,7 @@
QwaveApi* GetQwaveApi() const override { return qos_; }
private:
- QwaveApi* qos_;
+ raw_ptr<QwaveApi> qos_;
};
class MockQwaveApi : public QwaveApi {
diff --git a/net/socket/udp_socket_win.cc b/net/socket/udp_socket_win.cc
index 06f2d14f..85f1e4e5 100644
--- a/net/socket/udp_socket_win.cc
+++ b/net/socket/udp_socket_win.cc
@@ -13,6 +13,7 @@
#include "base/callback.h"
#include "base/check_op.h"
#include "base/lazy_instance.h"
+#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
@@ -82,7 +83,7 @@
void OnObjectSignaled(HANDLE object) override;
private:
- Core* const core_;
+ const raw_ptr<Core> core_;
};
class WriteDelegate : public base::win::ObjectWatcher::Delegate {
@@ -94,13 +95,13 @@
void OnObjectSignaled(HANDLE object) override;
private:
- Core* const core_;
+ const raw_ptr<Core> core_;
};
~Core();
// The socket that created this object.
- UDPSocketWin* socket_;
+ raw_ptr<UDPSocketWin> socket_;
// |reader_| handles the signals from |read_watcher_|.
ReadDelegate reader_;
diff --git a/net/socket/udp_socket_win.h b/net/socket/udp_socket_win.h
index 15aeeb83..a7a6609 100644
--- a/net/socket/udp_socket_win.h
+++ b/net/socket/udp_socket_win.h
@@ -14,6 +14,7 @@
#include <set>
#include "base/gtest_prod_util.h"
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
@@ -141,7 +142,7 @@
base::WeakPtr<DscpManager> dscp_manager,
HANDLE handle);
- QwaveApi* const api_;
+ const raw_ptr<QwaveApi> api_;
const SOCKET socket_;
DiffServCodePoint dscp_value_ = DSCP_NO_CHANGE;
@@ -473,7 +474,7 @@
int read_iobuffer_len_;
int write_iobuffer_len_;
- IPEndPoint* recv_from_address_;
+ raw_ptr<IPEndPoint> recv_from_address_;
// Cached copy of the current address we're sending to, if any. Used for
// logging.
diff --git a/net/socket/websocket_endpoint_lock_manager.h b/net/socket/websocket_endpoint_lock_manager.h
index bc5e2e23..b8fcc83 100644
--- a/net/socket/websocket_endpoint_lock_manager.h
+++ b/net/socket/websocket_endpoint_lock_manager.h
@@ -11,6 +11,7 @@
#include <memory>
#include "base/containers/linked_list.h"
+#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_export.h"
@@ -60,7 +61,7 @@
// This is null if UnlockEndpoint() has been called before this object was
// destroyed.
- WebSocketEndpointLockManager* websocket_endpoint_lock_manager_;
+ raw_ptr<WebSocketEndpointLockManager> websocket_endpoint_lock_manager_;
const IPEndPoint endpoint_;
};
@@ -111,7 +112,7 @@
// This pointer is non-NULL if a LockReleaser object has been constructed
// since the last call to UnlockEndpoint().
- LockReleaser* lock_releaser;
+ raw_ptr<LockReleaser> lock_releaser;
};
// SocketLockInfoMap requires std::map iterator semantics for LockInfoMap
diff --git a/net/socket/websocket_transport_client_socket_pool.h b/net/socket/websocket_transport_client_socket_pool.h
index db23a18..4901813d 100644
--- a/net/socket/websocket_transport_client_socket_pool.h
+++ b/net/socket/websocket_transport_client_socket_pool.h
@@ -12,6 +12,7 @@
#include <string>
#include <utility>
+#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
@@ -129,11 +130,11 @@
const NetLogWithSource& connect_job_net_log();
private:
- WebSocketTransportClientSocketPool* owner_;
+ raw_ptr<WebSocketTransportClientSocketPool> owner_;
CompletionOnceCallback callback_;
std::unique_ptr<ConnectJob> connect_job_;
- ClientSocketHandle* const socket_handle_;
+ const raw_ptr<ClientSocketHandle> socket_handle_;
const NetLogWithSource request_net_log_;
};
@@ -156,7 +157,7 @@
const scoped_refptr<SocketParams> params;
const absl::optional<NetworkTrafficAnnotationTag> proxy_annotation_tag;
const RequestPriority priority;
- ClientSocketHandle* const handle;
+ const raw_ptr<ClientSocketHandle> handle;
CompletionOnceCallback callback;
ProxyAuthCallback proxy_auth_callback;
const NetLogWithSource net_log;
diff --git a/net/socket/websocket_transport_connect_sub_job.h b/net/socket/websocket_transport_connect_sub_job.h
index 9ad5292..cc5d759 100644
--- a/net/socket/websocket_transport_connect_sub_job.h
+++ b/net/socket/websocket_transport_connect_sub_job.h
@@ -11,6 +11,7 @@
#include <utility>
#include "base/compiler_specific.h"
+#include "base/memory/raw_ptr.h"
#include "net/base/address_list.h"
#include "net/base/load_states.h"
#include "net/socket/websocket_endpoint_lock_manager.h"
@@ -85,14 +86,14 @@
int DoTransportConnect();
int DoTransportConnectComplete(int result);
- WebSocketTransportConnectJob* const parent_job_;
+ const raw_ptr<WebSocketTransportConnectJob> parent_job_;
const AddressList addresses_;
size_t current_address_index_;
State next_state_;
const SubJobType type_;
- WebSocketEndpointLockManager* const websocket_endpoint_lock_manager_;
+ const raw_ptr<WebSocketEndpointLockManager> websocket_endpoint_lock_manager_;
std::unique_ptr<StreamSocket> transport_socket_;
};