diff options
author | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 09:08:19 +0000 |
---|---|---|
committer | hans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 09:08:19 +0000 |
commit | 3690ebe09a8c3cea0fd7d9ece8f5b8d8ebc65c19 (patch) | |
tree | b26f7f81e48a95473eb4af5304301e9d8cd22fb8 /net | |
parent | eef99b6591d82399096abdcee07dd67359eec036 (diff) | |
download | chromium_src-3690ebe09a8c3cea0fd7d9ece8f5b8d8ebc65c19.zip chromium_src-3690ebe09a8c3cea0fd7d9ece8f5b8d8ebc65c19.tar.gz chromium_src-3690ebe09a8c3cea0fd7d9ece8f5b8d8ebc65c19.tar.bz2 |
Virtual destructors should have virtual keyword.
Make sure user-declared virtual destructors always have the virtual keyword.
The Clang style-check plugin will check for this soon.
No functionality change: virtual is only added
to destructors that are already implicitly virtual.
Also fix a couple of in-line destructor definitions.
BUG=83408
TEST=none
Review URL: http://codereview.chromium.org/7064033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
35 files changed, 50 insertions, 48 deletions
diff --git a/net/base/cert_verifier.h b/net/base/cert_verifier.h index 2546d7c..145fb59 100644 --- a/net/base/cert_verifier.h +++ b/net/base/cert_verifier.h @@ -71,7 +71,7 @@ class NET_API CertVerifier : NON_EXPORTED_BASE(public base::NonThreadSafe), // When the verifier is destroyed, all certificate verifications requests are // canceled, and their completion callbacks will not be called. - ~CertVerifier(); + virtual ~CertVerifier(); // Verifies the given certificate against the given hostname. Returns OK if // successful or an error code upon failure. diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index 58b13d4..c3943ac 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -341,7 +341,7 @@ class NET_API CookieMonster : public CookieStore { // Record statistics every kRecordStatisticsIntervalSeconds of uptime. static const int kRecordStatisticsIntervalSeconds = 10 * 60; - ~CookieMonster(); + virtual ~CookieMonster(); bool SetCookieWithCreationTime(const GURL& url, const std::string& cookie_line, diff --git a/net/base/dnsrr_resolver.h b/net/base/dnsrr_resolver.h index 4c47f8c..aca6a2e 100644 --- a/net/base/dnsrr_resolver.h +++ b/net/base/dnsrr_resolver.h @@ -83,7 +83,7 @@ class NET_API DnsRRResolver : NON_EXPORTED_BASE(public base::NonThreadSafe), }; DnsRRResolver(); - ~DnsRRResolver(); + virtual ~DnsRRResolver(); uint64 requests() const { return requests_; } uint64 cache_hits() const { return cache_hits_; } diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h index 44667f4..b9e2f28 100644 --- a/net/base/mock_host_resolver.h +++ b/net/base/mock_host_resolver.h @@ -95,7 +95,7 @@ class MockHostResolver : public MockHostResolverBase { class MockCachingHostResolver : public MockHostResolverBase { public: MockCachingHostResolver() : MockHostResolverBase(true /*use_caching*/) {} - ~MockCachingHostResolver() {} + virtual ~MockCachingHostResolver() {} }; // RuleBasedHostResolverProc applies a set of rules to map a host string to @@ -147,7 +147,7 @@ class NET_TEST RuleBasedHostResolverProc : public HostResolverProc { struct Rule; typedef std::list<Rule> RuleList; - ~RuleBasedHostResolverProc(); + virtual ~RuleBasedHostResolverProc(); RuleList rules_; }; diff --git a/net/base/ssl_client_auth_cache.h b/net/base/ssl_client_auth_cache.h index fe4d310..4321e22 100644 --- a/net/base/ssl_client_auth_cache.h +++ b/net/base/ssl_client_auth_cache.h @@ -27,7 +27,7 @@ class X509Certificate; class NET_TEST SSLClientAuthCache : public CertDatabase::Observer { public: SSLClientAuthCache(); - ~SSLClientAuthCache(); + virtual ~SSLClientAuthCache(); // Checks for a client certificate preference for SSL server at |server|. // Returns true if a preference is found, and sets |*certificate| to the diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index e66fb4b..cbf6b86 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -47,7 +47,7 @@ class NET_TEST BackendImpl : public Backend { // mask can be used to limit the usable size of the hash table, for testing. BackendImpl(const FilePath& path, uint32 mask, base::MessageLoopProxy* cache_thread, net::NetLog* net_log); - ~BackendImpl(); + virtual ~BackendImpl(); // Returns a new backend with the desired flags. See the declaration of // CreateCacheBackend(). diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h index 59901a8..830d426 100644 --- a/net/disk_cache/entry_impl.h +++ b/net/disk_cache/entry_impl.h @@ -152,7 +152,7 @@ class NET_TEST EntryImpl : public Entry, public base::RefCounted<EntryImpl> { }; class UserBuffer; - ~EntryImpl(); + virtual ~EntryImpl(); // Do all the work for ReadDataImpl and WriteDataImpl. Implemented as // separate functions to make logging of results simpler. diff --git a/net/disk_cache/file_lock.cc b/net/disk_cache/file_lock.cc index 949c645..6e9d949 100644 --- a/net/disk_cache/file_lock.cc +++ b/net/disk_cache/file_lock.cc @@ -12,6 +12,10 @@ FileLock::FileLock(BlockFileHeader* header) { acquired_ = true; } +FileLock::~FileLock() { + Unlock(); +} + void FileLock::Lock() { if (acquired_) return; diff --git a/net/disk_cache/file_lock.h b/net/disk_cache/file_lock.h index 48f872a..9823292 100644 --- a/net/disk_cache/file_lock.h +++ b/net/disk_cache/file_lock.h @@ -31,9 +31,8 @@ namespace disk_cache { class NET_TEST FileLock { public: explicit FileLock(BlockFileHeader* header); - virtual ~FileLock() { - Unlock(); - } + virtual ~FileLock(); + // Virtual to make sure the compiler never inlines the calls. virtual void Lock(); virtual void Unlock(); diff --git a/net/disk_cache/in_flight_backend_io.h b/net/disk_cache/in_flight_backend_io.h index 89fe3c1..659a33a 100644 --- a/net/disk_cache/in_flight_backend_io.h +++ b/net/disk_cache/in_flight_backend_io.h @@ -103,7 +103,7 @@ class BackendIO : public BackgroundIO { OP_IS_READY }; - ~BackendIO(); + virtual ~BackendIO(); void ExecuteBackendOperation(); void ExecuteEntryOperation(); @@ -139,7 +139,7 @@ class InFlightBackendIO : public InFlightIO { public: InFlightBackendIO(BackendImpl* backend, base::MessageLoopProxy* background_thread); - ~InFlightBackendIO(); + virtual ~InFlightBackendIO(); // The operations we proxy: void Init(net::CompletionCallback* callback); diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h index dae4289..52a78f6 100644 --- a/net/disk_cache/mem_backend_impl.h +++ b/net/disk_cache/mem_backend_impl.h @@ -26,7 +26,7 @@ class MemEntryImpl; class NET_TEST MemBackendImpl : public Backend { public: explicit MemBackendImpl(net::NetLog* net_log); - ~MemBackendImpl(); + virtual ~MemBackendImpl(); // Returns an instance of a Backend implemented only in memory. The returned // object should be deleted when not needed anymore. max_bytes is the maximum diff --git a/net/disk_cache/mem_entry_impl.h b/net/disk_cache/mem_entry_impl.h index c3872dd..db46c4d 100644 --- a/net/disk_cache/mem_entry_impl.h +++ b/net/disk_cache/mem_entry_impl.h @@ -120,7 +120,7 @@ class MemEntryImpl : public Entry { NUM_STREAMS = 3 }; - ~MemEntryImpl(); + virtual ~MemEntryImpl(); // Do all the work for corresponding public functions. Implemented as // separate functions to make logging of results simpler. diff --git a/net/disk_cache/stats_histogram.h b/net/disk_cache/stats_histogram.h index 83d359c..7f513ce 100644 --- a/net/disk_cache/stats_histogram.h +++ b/net/disk_cache/stats_histogram.h @@ -33,7 +33,7 @@ class StatsHistogram : public base::Histogram { explicit StatsHistogram(const std::string& name, Sample minimum, Sample maximum, size_t bucket_count) : Histogram(name, minimum, maximum, bucket_count), init_(false) {} - ~StatsHistogram(); + virtual ~StatsHistogram(); static StatsHistogram* StatsHistogramFactoryGet(const std::string& name); diff --git a/net/ftp/ftp_network_layer.h b/net/ftp/ftp_network_layer.h index 91a3e608..de55192 100644 --- a/net/ftp/ftp_network_layer.h +++ b/net/ftp/ftp_network_layer.h @@ -18,7 +18,7 @@ class HostResolver; class NET_API FtpNetworkLayer : public FtpTransactionFactory { public: explicit FtpNetworkLayer(HostResolver* host_resolver); - ~FtpNetworkLayer(); + virtual ~FtpNetworkLayer(); static FtpTransactionFactory* CreateFactory(HostResolver* host_resolver); diff --git a/net/http/http_auth_handler_basic.h b/net/http/http_auth_handler_basic.h index b98c7fd..5c747c9 100644 --- a/net/http/http_auth_handler_basic.h +++ b/net/http/http_auth_handler_basic.h @@ -45,7 +45,7 @@ class NET_TEST HttpAuthHandlerBasic : public HttpAuthHandler { std::string* auth_token); private: - ~HttpAuthHandlerBasic() {} + virtual ~HttpAuthHandlerBasic() {} bool ParseChallenge(HttpAuth::ChallengeTokenizer* challenge); }; diff --git a/net/http/http_auth_handler_digest.h b/net/http/http_auth_handler_digest.h index a9bf0ec..7b0f120 100644 --- a/net/http/http_auth_handler_digest.h +++ b/net/http/http_auth_handler_digest.h @@ -122,7 +122,7 @@ class NET_TEST HttpAuthHandlerDigest : public HttpAuthHandler { // the handler. The lifetime of the |nonce_generator| must exceed that of this // handler. HttpAuthHandlerDigest(int nonce_count, const NonceGenerator* nonce_generator); - ~HttpAuthHandlerDigest(); + virtual ~HttpAuthHandlerDigest(); // Parse the challenge, saving the results into this instance. // Returns true on success. diff --git a/net/http/http_auth_handler_ntlm.h b/net/http/http_auth_handler_ntlm.h index ae7c78b..c5050af 100644 --- a/net/http/http_auth_handler_ntlm.h +++ b/net/http/http_auth_handler_ntlm.h @@ -127,7 +127,7 @@ class HttpAuthHandlerNTLM : public HttpAuthHandler { std::string* auth_token); private: - ~HttpAuthHandlerNTLM(); + virtual ~HttpAuthHandlerNTLM(); #if defined(NTLM_PORTABLE) // For unit tests to override the GenerateRandom and GetHostName functions. diff --git a/net/http/http_cache.h b/net/http/http_cache.h index 3fbb5e1..861d36b 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h @@ -144,7 +144,7 @@ class NET_API HttpCache : public HttpTransactionFactory, NetLog* net_log, BackendFactory* backend_factory); - ~HttpCache(); + virtual ~HttpCache(); HttpTransactionFactory* network_layer() { return network_layer_.get(); } diff --git a/net/http/http_stream_parser.h b/net/http/http_stream_parser.h index 2192eff..40a4a0a 100644 --- a/net/http/http_stream_parser.h +++ b/net/http/http_stream_parser.h @@ -37,7 +37,7 @@ class HttpStreamParser : public ChunkCallback { const HttpRequestInfo* request, GrowableIOBuffer* read_buffer, const BoundNetLog& net_log); - ~HttpStreamParser(); + virtual ~HttpStreamParser(); // These functions implement the interface described in HttpStream with // some additional functionality diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index eb9d2a2..a5defdf 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -219,7 +219,7 @@ class NET_TEST ClientSocketPoolBaseHelper base::TimeDelta used_idle_socket_timeout, ConnectJobFactory* connect_job_factory); - ~ClientSocketPoolBaseHelper(); + virtual ~ClientSocketPoolBaseHelper(); // See ClientSocketPool::RequestSocket for documentation on this function. // ClientSocketPoolBaseHelper takes ownership of |request|, which must be diff --git a/net/socket/client_socket_pool_manager.h b/net/socket/client_socket_pool_manager.h index 35c82a1..d798420 100644 --- a/net/socket/client_socket_pool_manager.h +++ b/net/socket/client_socket_pool_manager.h @@ -78,7 +78,7 @@ class ClientSocketPoolManager : public base::NonThreadSafe, SSLHostInfoFactory* ssl_host_info_factory, ProxyService* proxy_service, SSLConfigService* ssl_config_service); - ~ClientSocketPoolManager(); + virtual ~ClientSocketPoolManager(); void FlushSocketPools(); void CloseIdleSockets(); diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 6e18a7e..bfb4ab2 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -281,7 +281,7 @@ class DelayedSocketData : public StaticSocketDataProvider, DelayedSocketData(const MockConnect& connect, int write_delay, MockRead* reads, size_t reads_count, MockWrite* writes, size_t writes_count); - ~DelayedSocketData(); + virtual ~DelayedSocketData(); void ForceNextRead(); diff --git a/net/socket/ssl_client_socket_mac.h b/net/socket/ssl_client_socket_mac.h index 0a69286..4dbffe6 100644 --- a/net/socket/ssl_client_socket_mac.h +++ b/net/socket/ssl_client_socket_mac.h @@ -38,7 +38,7 @@ class SSLClientSocketMac : public SSLClientSocket { const HostPortPair& host_and_port, const SSLConfig& ssl_config, CertVerifier* cert_verifier); - ~SSLClientSocketMac(); + virtual ~SSLClientSocketMac(); // SSLClientSocket methods: virtual void GetSSLInfo(SSLInfo* ssl_info); diff --git a/net/socket/ssl_client_socket_nss.h b/net/socket/ssl_client_socket_nss.h index 3b6f6ad..2f2e81c 100644 --- a/net/socket/ssl_client_socket_nss.h +++ b/net/socket/ssl_client_socket_nss.h @@ -53,7 +53,7 @@ class SSLClientSocketNSS : public SSLClientSocket { SSLHostInfo* ssl_host_info, CertVerifier* cert_verifier, DnsCertProvenanceChecker* dnsrr_resolver); - ~SSLClientSocketNSS(); + virtual ~SSLClientSocketNSS(); // For tests static void ClearSessionCache(); diff --git a/net/socket/tcp_server_socket_libevent.h b/net/socket/tcp_server_socket_libevent.h index 41dd40e..360ec09 100644 --- a/net/socket/tcp_server_socket_libevent.h +++ b/net/socket/tcp_server_socket_libevent.h @@ -22,7 +22,7 @@ class TCPServerSocketLibevent : public ServerSocket, public: TCPServerSocketLibevent(net::NetLog* net_log, const net::NetLog::Source& source); - ~TCPServerSocketLibevent(); + virtual ~TCPServerSocketLibevent(); // net::ServerSocket implementation. virtual int Listen(const net::IPEndPoint& address, int backlog); diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h index 18042e0..0b1bc10 100644 --- a/net/socket_stream/socket_stream.h +++ b/net/socket_stream/socket_stream.h @@ -189,7 +189,7 @@ class NET_API SocketStream : public base::RefCountedThreadSafe<SocketStream> { std::string headers_; private: - ~RequestHeaders() { data_ = NULL; } + virtual ~RequestHeaders() { data_ = NULL; } }; class ResponseHeaders : public IOBuffer { @@ -202,7 +202,7 @@ class NET_API SocketStream : public base::RefCountedThreadSafe<SocketStream> { void Realloc(size_t new_size); private: - ~ResponseHeaders(); + virtual ~ResponseHeaders(); scoped_ptr_malloc<char> headers_; }; diff --git a/net/tools/flip_server/acceptor_thread.h b/net/tools/flip_server/acceptor_thread.h index 8a30532..b378e4d 100644 --- a/net/tools/flip_server/acceptor_thread.h +++ b/net/tools/flip_server/acceptor_thread.h @@ -46,7 +46,7 @@ class SMAcceptorThread : public base::SimpleThread, public SMConnectionPoolInterface { public: SMAcceptorThread(FlipAcceptor *acceptor, MemoryCache* memory_cache); - ~SMAcceptorThread(); + virtual ~SMAcceptorThread(); // EpollCallbackInteface interface virtual void OnRegistration(EpollServer* eps, int fd, int event_mask) {} @@ -92,4 +92,3 @@ class SMAcceptorThread : public base::SimpleThread, } // namespace net #endif // NET_TOOLS_FLIP_SERVER_ACCEPTOR_THREAD_H_ - diff --git a/net/tools/flip_server/simple_buffer.cc b/net/tools/flip_server/simple_buffer.cc index 569e505..d94153b 100644 --- a/net/tools/flip_server/simple_buffer.cc +++ b/net/tools/flip_server/simple_buffer.cc @@ -37,6 +37,11 @@ SimpleBuffer::SimpleBuffer(int size) storage_ = new char[size]; } +SimpleBuffer::~SimpleBuffer() { + delete[] storage_; +} + + //////////////////////////////////////////////////////////////////////////////// int SimpleBuffer::ReadableBytes() const { @@ -201,4 +206,3 @@ inline void SimpleBuffer::AdvanceWritablePtr(int amount_to_advance) { } } // namespace net - diff --git a/net/tools/flip_server/simple_buffer.h b/net/tools/flip_server/simple_buffer.h index fee7d4b..831531d 100644 --- a/net/tools/flip_server/simple_buffer.h +++ b/net/tools/flip_server/simple_buffer.h @@ -16,9 +16,7 @@ class SimpleBuffer : public BufferInterface { public: SimpleBuffer(); explicit SimpleBuffer(int size); - virtual ~SimpleBuffer() { - delete[] storage_; - } + virtual ~SimpleBuffer(); std::string str() const; @@ -92,4 +90,3 @@ class SimpleBuffer : public BufferInterface { } // namespace net #endif // NET_TOOLS_FLIP_SERVER_SIMPLE_BUFFER_H__ - diff --git a/net/tools/flip_server/sm_connection.cc b/net/tools/flip_server/sm_connection.cc index b57c5a9..f47b502 100644 --- a/net/tools/flip_server/sm_connection.cc +++ b/net/tools/flip_server/sm_connection.cc @@ -23,6 +23,11 @@ namespace net { // static bool SMConnection::force_spdy_ = false; +DataFrame::~DataFrame() { + if (delete_when_done) + delete[] data; +} + SMConnection::SMConnection(EpollServer* epoll_server, SSLState* ssl_state, MemoryCache* memory_cache, @@ -659,5 +664,3 @@ SMConnection* SMConnection::NewSMConnection(EpollServer* epoll_server, } } // namespace net - - diff --git a/net/tools/flip_server/sm_connection.h b/net/tools/flip_server/sm_connection.h index 044f311..aa91890 100644 --- a/net/tools/flip_server/sm_connection.h +++ b/net/tools/flip_server/sm_connection.h @@ -32,10 +32,7 @@ class DataFrame { bool delete_when_done; size_t index; DataFrame() : data(NULL), size(0), delete_when_done(false), index(0) {} - virtual ~DataFrame() { - if (delete_when_done) - delete[] data; - } + virtual ~DataFrame(); }; typedef std::list<DataFrame*> OutputList; @@ -160,4 +157,3 @@ class SMConnection : public SMConnectionInterface, } // namespace net #endif // NET_TOOLS_FLIP_SERVER_SM_CONNECTION_H_ - diff --git a/net/url_request/https_prober.h b/net/url_request/https_prober.h index b461fa8..d152e76 100644 --- a/net/url_request/https_prober.h +++ b/net/url_request/https_prober.h @@ -66,7 +66,7 @@ class HTTPSProber : public URLRequest::Delegate { friend struct DefaultSingletonTraits<HTTPSProber>; HTTPSProber(); - ~HTTPSProber(); + virtual ~HTTPSProber(); void Success(URLRequest* request); void Failure(URLRequest* request); diff --git a/net/url_request/url_request_data_job.h b/net/url_request/url_request_data_job.h index 766296f..3880241 100644 --- a/net/url_request/url_request_data_job.h +++ b/net/url_request/url_request_data_job.h @@ -27,7 +27,7 @@ class URLRequestDataJob : public URLRequestSimpleJob { std::string* data) const; private: - ~URLRequestDataJob(); + virtual ~URLRequestDataJob(); DISALLOW_COPY_AND_ASSIGN(URLRequestDataJob); }; diff --git a/net/url_request/url_request_error_job.h b/net/url_request/url_request_error_job.h index 31cb384..404a6a1 100644 --- a/net/url_request/url_request_error_job.h +++ b/net/url_request/url_request_error_job.h @@ -21,7 +21,7 @@ class URLRequestErrorJob : public URLRequestJob { virtual void Start(); private: - ~URLRequestErrorJob(); + virtual ~URLRequestErrorJob(); void StartAsync(); diff --git a/net/url_request/url_request_simple_job.h b/net/url_request/url_request_simple_job.h index 879319c..8ba9104 100644 --- a/net/url_request/url_request_simple_job.h +++ b/net/url_request/url_request_simple_job.h @@ -25,7 +25,7 @@ class URLRequestSimpleJob : public URLRequestJob { virtual bool GetCharset(std::string* charset); protected: - ~URLRequestSimpleJob(); + virtual ~URLRequestSimpleJob(); // subclasses must override the way response data is determined. virtual bool GetData(std::string* mime_type, |