diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 23:34:24 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 23:34:24 +0000 |
commit | 5389bc7ba5360633af04b9cf15497d56ce640ead (patch) | |
tree | 4518c05f3bad18a5b2f4739fc1a1c187651f9799 /net/base | |
parent | 4070a6b1efcb2dbea12508a0b912cfa3bc86f47e (diff) | |
download | chromium_src-5389bc7ba5360633af04b9cf15497d56ce640ead.zip chromium_src-5389bc7ba5360633af04b9cf15497d56ce640ead.tar.gz chromium_src-5389bc7ba5360633af04b9cf15497d56ce640ead.tar.bz2 |
Second patch in making destructors of refcounted objects private.
BUG=26749
Review URL: http://codereview.chromium.org/368001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
29 files changed, 137 insertions, 59 deletions
diff --git a/net/base/address_list.h b/net/base/address_list.h index 165086c..3087472 100644 --- a/net/base/address_list.h +++ b/net/base/address_list.h @@ -54,11 +54,15 @@ class AddressList { struct Data : public base::RefCountedThreadSafe<Data> { Data(struct addrinfo* ai, bool is_system_created) : head(ai), is_system_created(is_system_created) {} - ~Data(); struct addrinfo* head; // Indicates which free function to use for |head|. bool is_system_created; + + private: + friend class base::RefCountedThreadSafe<Data>; + + ~Data(); }; explicit AddressList(Data* data) : data_(data) {} diff --git a/net/base/cert_verifier.cc b/net/base/cert_verifier.cc index 70be229..703ecfe 100644 --- a/net/base/cert_verifier.cc +++ b/net/base/cert_verifier.cc @@ -35,8 +35,6 @@ class CertVerifier::Request : error_(OK) { } - ~Request() {} - void DoVerify() { // Running on the worker thread error_ = cert_->Verify(hostname_, flags_, &result_); @@ -92,6 +90,10 @@ class CertVerifier::Request : } private: + friend class base::RefCountedThreadSafe<CertVerifier::Request>; + + ~Request() {} + // Set on the origin thread, read on the worker thread. scoped_refptr<X509Certificate> cert_; std::string hostname_; diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index 7b8362d..18ebe25 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -69,8 +69,6 @@ class CookieMonster : public CookieStore { } #endif - ~CookieMonster(); - // Parse the string with the cookie time (very forgivingly). static base::Time ParseCookieTime(const std::string& time_string); @@ -136,6 +134,8 @@ class CookieMonster : public CookieStore { static bool enable_file_scheme_; private: + ~CookieMonster(); + // Called by all non-static functions to ensure that the cookies store has // been initialized. This is not done during creating so it doesn't block // the window showing. diff --git a/net/base/cookie_monster_perftest.cc b/net/base/cookie_monster_perftest.cc index ebdc2da..9e76ac8 100644 --- a/net/base/cookie_monster_perftest.cc +++ b/net/base/cookie_monster_perftest.cc @@ -40,7 +40,7 @@ TEST(ParsedCookieTest, TestParseBigCookies) { static const GURL kUrlGoogle("http://www.google.izzle"); TEST(CookieMonsterTest, TestAddCookiesOnSingleHost) { - net::CookieMonster cm; + scoped_refptr<net::CookieMonster> cm(new net::CookieMonster); std::vector<std::string> cookies; for (int i = 0; i < kNumCookies; i++) { cookies.push_back(StringPrintf("a%03d=b", i)); @@ -50,24 +50,24 @@ TEST(CookieMonsterTest, TestAddCookiesOnSingleHost) { PerfTimeLogger timer("Cookie_monster_add_single_host"); for (std::vector<std::string>::const_iterator it = cookies.begin(); it != cookies.end(); ++it) { - EXPECT_TRUE(cm.SetCookie(kUrlGoogle, *it)); + EXPECT_TRUE(cm->SetCookie(kUrlGoogle, *it)); } timer.Done(); PerfTimeLogger timer2("Cookie_monster_query_single_host"); for (std::vector<std::string>::const_iterator it = cookies.begin(); it != cookies.end(); ++it) { - cm.GetCookies(kUrlGoogle); + cm->GetCookies(kUrlGoogle); } timer2.Done(); PerfTimeLogger timer3("Cookie_monster_deleteall_single_host"); - cm.DeleteAll(false); + cm->DeleteAll(false); timer3.Done(); } TEST(CookieMonsterTest, TestAddCookieOnManyHosts) { - net::CookieMonster cm; + scoped_refptr<net::CookieMonster> cm(new net::CookieMonster); std::string cookie(kCookieLine); std::vector<GURL> gurls; // just wanna have ffffuunnn for (int i = 0; i < kNumCookies; ++i) { @@ -78,18 +78,18 @@ TEST(CookieMonsterTest, TestAddCookieOnManyHosts) { PerfTimeLogger timer("Cookie_monster_add_many_hosts"); for (std::vector<GURL>::const_iterator it = gurls.begin(); it != gurls.end(); ++it) { - EXPECT_TRUE(cm.SetCookie(*it, cookie)); + EXPECT_TRUE(cm->SetCookie(*it, cookie)); } timer.Done(); PerfTimeLogger timer2("Cookie_monster_query_many_hosts"); for (std::vector<GURL>::const_iterator it = gurls.begin(); it != gurls.end(); ++it) { - cm.GetCookies(*it); + cm->GetCookies(*it); } timer2.Done(); PerfTimeLogger timer3("Cookie_monster_deleteall_many_hosts"); - cm.DeleteAll(false); + cm->DeleteAll(false); timer3.Done(); } diff --git a/net/base/cookie_store.h b/net/base/cookie_store.h index b1dd5ab..e4d9b5d 100644 --- a/net/base/cookie_store.h +++ b/net/base/cookie_store.h @@ -24,8 +24,6 @@ class CookieMonster; // be thread safe as its methods can be accessed from IO as well as UI threads. class CookieStore : public base::RefCountedThreadSafe<CookieStore> { public: - virtual ~CookieStore() {} - // Set a single cookie. Expects a cookie line, like "a=1; domain=b.com". virtual bool SetCookie(const GURL& url, const std::string& cookie_line) = 0; virtual bool SetCookieWithOptions(const GURL& url, @@ -60,6 +58,10 @@ class CookieStore : public base::RefCountedThreadSafe<CookieStore> { virtual CookieMonster* GetCookieMonster() { return NULL; }; + + protected: + friend class base::RefCountedThreadSafe<CookieStore>; + virtual ~CookieStore() {} }; } // namespace net diff --git a/net/base/directory_lister.h b/net/base/directory_lister.h index 27204b6..83dc1ef 100644 --- a/net/base/directory_lister.h +++ b/net/base/directory_lister.h @@ -35,7 +35,6 @@ class DirectoryLister : public base::RefCountedThreadSafe<DirectoryLister>, }; DirectoryLister(const FilePath& dir, DirectoryListerDelegate* delegate); - ~DirectoryLister(); // Call this method to start the directory enumeration thread. bool Start(); @@ -53,8 +52,11 @@ class DirectoryLister : public base::RefCountedThreadSafe<DirectoryLister>, void ThreadMain(); private: + friend class base::RefCountedThreadSafe<DirectoryLister>; friend class DirectoryDataEvent; + ~DirectoryLister(); + void OnReceivedData(const file_util::FileEnumerator::FindInfo* data, int count); void OnDone(int error); diff --git a/net/base/fixed_host_resolver.h b/net/base/fixed_host_resolver.h index cf1bd74..3ae3209 100644 --- a/net/base/fixed_host_resolver.h +++ b/net/base/fixed_host_resolver.h @@ -32,6 +32,8 @@ class FixedHostResolver : public HostResolver { virtual void Shutdown() {} private: + ~FixedHostResolver() {} + AddressList address_; bool initialized_; }; diff --git a/net/base/host_cache.h b/net/base/host_cache.h index b36af35..c7127b0 100644 --- a/net/base/host_cache.h +++ b/net/base/host_cache.h @@ -22,7 +22,6 @@ class HostCache { // Stores the latest address list that was looked up for a hostname. struct Entry : public base::RefCounted<Entry> { Entry(int error, const AddressList& addrlist, base::TimeTicks expiration); - ~Entry(); // The resolve results for this entry. int error; @@ -30,6 +29,11 @@ class HostCache { // The time when this entry expires. base::TimeTicks expiration; + + private: + friend class base::RefCounted<Entry>; + + ~Entry(); }; struct Key { diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index 9534e03..baaf2ac 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -104,11 +104,6 @@ class HostResolver : public base::RefCountedThreadSafe<HostResolver> { // Opaque type used to cancel a request. typedef void* RequestHandle; - // If any completion callbacks are pending when the resolver is destroyed, - // the host resolutions are cancelled, and the completion callbacks will not - // be called. - virtual ~HostResolver() {} - // Resolves the given hostname (or IP address literal), filling out the // |addresses| object upon success. The |info.port| parameter will be set as // the sin(6)_port field of the sockaddr_in{6} struct. Returns OK if @@ -157,8 +152,15 @@ class HostResolver : public base::RefCountedThreadSafe<HostResolver> { virtual void SetDefaultAddressFamily(AddressFamily address_family) {} protected: + friend class base::RefCountedThreadSafe<HostResolver>; + HostResolver() { } + // If any completion callbacks are pending when the resolver is destroyed, + // the host resolutions are cancelled, and the completion callbacks will not + // be called. + virtual ~HostResolver() {} + private: DISALLOW_COPY_AND_ASSIGN(HostResolver); }; diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 557d42a..15ab7e8 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -149,11 +149,6 @@ class HostResolverImpl::Job error_(OK) { } - ~Job() { - // Free the requests attached to this job. - STLDeleteElements(&requests_); - } - // Attaches a request to this job. The job takes ownership of |req| and will // take care to delete it. void AddRequest(Request* req) { @@ -215,6 +210,13 @@ class HostResolverImpl::Job } private: + friend class base::RefCountedThreadSafe<HostResolverImpl::Job>; + + ~Job() { + // Free the requests attached to this job. + STLDeleteElements(&requests_); + } + void DoLookup() { // Running on the worker thread error_ = ResolveAddrInfo(resolver_proc_, diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h index 5399e69..9dad6f8 100644 --- a/net/base/host_resolver_impl.h +++ b/net/base/host_resolver_impl.h @@ -51,11 +51,6 @@ class HostResolverImpl : public HostResolver { int max_cache_entries, int cache_duration_ms); - // If any completion callbacks are pending when the resolver is destroyed, - // the host resolutions are cancelled, and the completion callbacks will not - // be called. - virtual ~HostResolverImpl(); - // HostResolver methods: virtual int Resolve(const RequestInfo& info, AddressList* addresses, @@ -82,6 +77,11 @@ class HostResolverImpl : public HostResolver { typedef std::map<Key, scoped_refptr<Job> > JobMap; typedef std::vector<Observer*> ObserversList; + // If any completion callbacks are pending when the resolver is destroyed, + // the host resolutions are cancelled, and the completion callbacks will not + // be called. + virtual ~HostResolverImpl(); + // Returns the HostResolverProc to use for this instance. HostResolverProc* effective_resolver_proc() const { return resolver_proc_ ? diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc index eee6fd1..63e06a7 100644 --- a/net/base/host_resolver_impl_unittest.cc +++ b/net/base/host_resolver_impl_unittest.cc @@ -67,6 +67,8 @@ class CapturingHostResolverProc : public HostResolverProc { } private: + ~CapturingHostResolverProc() {} + std::vector<std::string> capture_list_; mutable Lock lock_; base::WaitableEvent event_; diff --git a/net/base/host_resolver_proc.h b/net/base/host_resolver_proc.h index 8507e03..f2bff25 100644 --- a/net/base/host_resolver_proc.h +++ b/net/base/host_resolver_proc.h @@ -24,7 +24,6 @@ class AddressList; class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> { public: explicit HostResolverProc(HostResolverProc* previous); - virtual ~HostResolverProc() {} // Resolves |host| to an address list, restricting the results to addresses // in |address_family|. If successful returns OK and fills |addrlist| with @@ -34,6 +33,10 @@ class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> { AddressList* addrlist) = 0; protected: + friend class base::RefCountedThreadSafe<HostResolverProc>; + + virtual ~HostResolverProc() {} + // Asks the fallback procedure (if set) to do the resolve. int ResolveUsingPrevious(const std::string& host, AddressFamily address_family, diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h index e301df8..adcf698 100644 --- a/net/base/io_buffer.h +++ b/net/base/io_buffer.h @@ -18,16 +18,20 @@ class IOBuffer : public base::RefCountedThreadSafe<IOBuffer> { public: IOBuffer() : data_(NULL) {} explicit IOBuffer(int buffer_size); - virtual ~IOBuffer() { - delete[] data_; - } char* data() { return data_; } protected: + friend class base::RefCountedThreadSafe<IOBuffer>; + // Only allow derived classes to specify data_. // In all other cases, we own data_, and must delete it at destruction time. explicit IOBuffer(char* data) : data_(data) {} + + virtual ~IOBuffer() { + delete[] data_; + } + char* data_; }; @@ -38,11 +42,12 @@ class IOBuffer : public base::RefCountedThreadSafe<IOBuffer> { class IOBufferWithSize : public IOBuffer { public: explicit IOBufferWithSize(int size) : IOBuffer(size), size_(size) {} - ~IOBufferWithSize() {} int size() const { return size_; } private: + ~IOBufferWithSize() {} + int size_; }; @@ -55,15 +60,16 @@ class StringIOBuffer : public IOBuffer { string_data_(s) { data_ = const_cast<char*>(string_data_.data()); } + + int size() const { return string_data_.size(); } + + private: ~StringIOBuffer() { // We haven't allocated the buffer, so remove it before the base class // destructor tries to delete[] it. data_ = NULL; } - int size() const { return string_data_.size(); } - - private: std::string string_data_; }; @@ -73,10 +79,6 @@ class DrainableIOBuffer : public IOBuffer { public: DrainableIOBuffer(IOBuffer* base, int size) : IOBuffer(base->data()), base_(base), size_(size), used_(0) {} - ~DrainableIOBuffer() { - // The buffer is owned by the |base_| instance. - data_ = NULL; - } // DidConsume() changes the |data_| pointer so that |data_| always points // to the first unconsumed byte. @@ -95,6 +97,11 @@ class DrainableIOBuffer : public IOBuffer { int size() const { return size_; } private: + ~DrainableIOBuffer() { + // The buffer is owned by the |base_| instance. + data_ = NULL; + } + scoped_refptr<IOBuffer> base_; int size_; int used_; @@ -104,7 +111,6 @@ class DrainableIOBuffer : public IOBuffer { class GrowableIOBuffer : public IOBuffer { public: GrowableIOBuffer() : IOBuffer(), capacity_(0), offset_(0) {} - ~GrowableIOBuffer() { data_ = NULL; } // realloc memory to the specified capacity. Returns true on success. // On failure, the capacity and buffer are unchanged. @@ -119,6 +125,8 @@ class GrowableIOBuffer : public IOBuffer { char* StartOfBuffer() { return real_data_.get(); } private: + ~GrowableIOBuffer() { data_ = NULL; } + scoped_ptr_malloc<char> real_data_; int capacity_; int offset_; @@ -133,6 +141,8 @@ class WrappedIOBuffer : public IOBuffer { public: explicit WrappedIOBuffer(const char* data) : IOBuffer(const_cast<char*>(data)) {} + + protected: ~WrappedIOBuffer() { data_ = NULL; } diff --git a/net/base/listen_socket.h b/net/base/listen_socket.h index 9ed30b6..585a094 100644 --- a/net/base/listen_socket.h +++ b/net/base/listen_socket.h @@ -59,7 +59,6 @@ class ListenSocket : public base::RefCountedThreadSafe<ListenSocket>, // accept local connections. static ListenSocket* Listen(std::string ip, int port, ListenSocketDelegate* del); - virtual ~ListenSocket(); // Send data to the socket. void Send(const char* bytes, int len, bool append_linefeed = false); @@ -72,10 +71,13 @@ class ListenSocket : public base::RefCountedThreadSafe<ListenSocket>, void ResumeReads(); protected: + friend class base::RefCountedThreadSafe<ListenSocket>; + static const SOCKET kInvalidSocket; static const int kSocketError; ListenSocket(SOCKET s, ListenSocketDelegate* del); + virtual ~ListenSocket(); static SOCKET Listen(std::string ip, int port); // if valid, returned SOCKET is non-blocking static SOCKET Accept(SOCKET s); diff --git a/net/base/listen_socket_unittest.h b/net/base/listen_socket_unittest.h index f9a9e0e..81cbb95 100644 --- a/net/base/listen_socket_unittest.h +++ b/net/base/listen_socket_unittest.h @@ -67,6 +67,10 @@ class ListenSocketTester : public base::RefCountedThreadSafe<ListenSocketTester> { protected: + friend class base::RefCountedThreadSafe<ListenSocketTester>; + + virtual ~ListenSocketTester() {} + virtual ListenSocket* DoListen(); public: @@ -77,9 +81,6 @@ class ListenSocketTester : connection_(NULL){ } - virtual ~ListenSocketTester() { - } - virtual void SetUp(); virtual void TearDown(); diff --git a/net/base/load_log.h b/net/base/load_log.h index 46f5530..7ee5185 100644 --- a/net/base/load_log.h +++ b/net/base/load_log.h @@ -106,6 +106,10 @@ class LoadLog : public base::RefCountedThreadSafe<LoadLog> { void Append(const LoadLog* log); private: + friend class base::RefCountedThreadSafe<LoadLog>; + + ~LoadLog() {} + EventList events_; }; diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h index eee005c..72f10b4 100644 --- a/net/base/mock_host_resolver.h +++ b/net/base/mock_host_resolver.h @@ -38,8 +38,6 @@ class RuleBasedHostResolverProc; // Base class shared by MockHostResolver and MockCachingHostResolver. class MockHostResolverBase : public HostResolver { public: - virtual ~MockHostResolverBase() {} - // HostResolver methods: virtual int Resolve(const RequestInfo& info, AddressList* addresses, @@ -65,8 +63,8 @@ class MockHostResolverBase : public HostResolver { protected: MockHostResolverBase(bool use_caching); + virtual ~MockHostResolverBase() {} - private: scoped_refptr<HostResolverImpl> impl_; scoped_refptr<RuleBasedHostResolverProc> rules_; bool synchronous_mode_; @@ -76,6 +74,9 @@ class MockHostResolverBase : public HostResolver { class MockHostResolver : public MockHostResolverBase { public: MockHostResolver() : MockHostResolverBase(false /*use_caching*/) {} + + private: + virtual ~MockHostResolver() {} }; // Same as MockHostResolver, except internally it uses a host-cache. @@ -86,6 +87,9 @@ class MockHostResolver : public MockHostResolverBase { class MockCachingHostResolver : public MockHostResolverBase { public: MockCachingHostResolver() : MockHostResolverBase(true /*use_caching*/) {} + + private: + ~MockCachingHostResolver() {} }; // RuleBasedHostResolverProc applies a set of rules to map a host string to @@ -95,7 +99,6 @@ class MockCachingHostResolver : public MockHostResolverBase { class RuleBasedHostResolverProc : public HostResolverProc { public: explicit RuleBasedHostResolverProc(HostResolverProc* previous); - ~RuleBasedHostResolverProc(); // Any hostname matching the given pattern will be replaced with the given // replacement value. Usually, replacement should be an IP address literal. @@ -131,6 +134,8 @@ class RuleBasedHostResolverProc : public HostResolverProc { AddressList* addrlist); private: + ~RuleBasedHostResolverProc(); + struct Rule; typedef std::list<Rule> RuleList; @@ -155,6 +160,9 @@ class WaitingHostResolverProc : public HostResolverProc { return ResolveUsingPrevious(host, address_family, addrlist); } + private: + ~WaitingHostResolverProc() {} + base::WaitableEvent event_; }; diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h index 5716da9..b5f9500 100644 --- a/net/base/sdch_manager.h +++ b/net/base/sdch_manager.h @@ -159,6 +159,7 @@ class SdchManager { const std::string& text() const { return text_; } private: + friend class base::RefCounted<Dictionary>; friend class SdchManager; // Only manager can construct an instance. FRIEND_TEST(SdchFilterTest, PathMatch); @@ -169,6 +170,7 @@ class SdchManager { const std::string& client_hash, const GURL& url, const std::string& domain, const std::string& path, const base::Time& expiration, const std::set<int> ports); + ~Dictionary() {} const GURL& url() const { return url_; } const std::string& client_hash() const { return client_hash_; } diff --git a/net/base/ssl_cert_request_info.h b/net/base/ssl_cert_request_info.h index 913a219..7946e17 100644 --- a/net/base/ssl_cert_request_info.h +++ b/net/base/ssl_cert_request_info.h @@ -37,6 +37,11 @@ class SSLCertRequestInfo // DistinguishedName certificate_authorities<3..2^16-1>; // } CertificateRequest; std::vector<scoped_refptr<X509Certificate> > client_certs; + + private: + friend class base::RefCountedThreadSafe<SSLCertRequestInfo>; + + ~SSLCertRequestInfo() {} }; } // namespace net diff --git a/net/base/ssl_config_service.h b/net/base/ssl_config_service.h index c8c0638..a4d3cb4 100644 --- a/net/base/ssl_config_service.h +++ b/net/base/ssl_config_service.h @@ -66,8 +66,6 @@ struct SSLConfig { // live longer than the configuration preferences. class SSLConfigService : public base::RefCountedThreadSafe<SSLConfigService> { public: - virtual ~SSLConfigService() {} - // Create an instance of SSLConfigService which retrieves the configuration // from the system SSL configuration, or an instance of // SSLConfigServiceDefaults if the current system does not have a system SSL @@ -77,6 +75,11 @@ class SSLConfigService : public base::RefCountedThreadSafe<SSLConfigService> { // May not be thread-safe, should only be called on the IO thread. virtual void GetSSLConfig(SSLConfig* config) = 0; + + protected: + friend class base::RefCountedThreadSafe<SSLConfigService>; + + virtual ~SSLConfigService() {} }; } // namespace net diff --git a/net/base/ssl_config_service_defaults.h b/net/base/ssl_config_service_defaults.h index 9360020..5425b27 100644 --- a/net/base/ssl_config_service_defaults.h +++ b/net/base/ssl_config_service_defaults.h @@ -15,7 +15,6 @@ namespace net { class SSLConfigServiceDefaults : public SSLConfigService { public: SSLConfigServiceDefaults() {} - virtual ~SSLConfigServiceDefaults() {} // Store default SSL config settings in |config|. virtual void GetSSLConfig(SSLConfig* config) { @@ -23,6 +22,8 @@ class SSLConfigServiceDefaults : public SSLConfigService { } private: + virtual ~SSLConfigServiceDefaults() {} + // Default value of prefs. const SSLConfig default_config_; diff --git a/net/base/ssl_config_service_mac.h b/net/base/ssl_config_service_mac.h index 4741034..5a60803 100644 --- a/net/base/ssl_config_service_mac.h +++ b/net/base/ssl_config_service_mac.h @@ -16,7 +16,6 @@ class SSLConfigServiceMac : public SSLConfigService { public: SSLConfigServiceMac(); explicit SSLConfigServiceMac(base::TimeTicks now); // Used for testing. - virtual ~SSLConfigServiceMac() {} // Get the current SSL configuration settings. Can be called on any // thread. @@ -40,6 +39,8 @@ class SSLConfigServiceMac : public SSLConfigService { void GetSSLConfigAt(SSLConfig* config, base::TimeTicks now); private: + virtual ~SSLConfigServiceMac() {} + void UpdateConfig(base::TimeTicks now); // We store the system SSL config and the time that we fetched it. diff --git a/net/base/ssl_config_service_win.h b/net/base/ssl_config_service_win.h index ef3346e..e7b77c7 100644 --- a/net/base/ssl_config_service_win.h +++ b/net/base/ssl_config_service_win.h @@ -23,7 +23,6 @@ class SSLConfigServiceWin : public SSLConfigService { public: SSLConfigServiceWin(); explicit SSLConfigServiceWin(base::TimeTicks now); // Used for testing. - virtual ~SSLConfigServiceWin() {} // Get the current SSL configuration settings. Can be called on any // thread. @@ -45,6 +44,8 @@ class SSLConfigServiceWin : public SSLConfigService { void GetSSLConfigAt(SSLConfig* config, base::TimeTicks now); private: + virtual ~SSLConfigServiceWin() {} + void UpdateConfig(base::TimeTicks now); // We store the IE SSL config and the time that we fetched it. diff --git a/net/base/strict_transport_security_state.h b/net/base/strict_transport_security_state.h index 463382c..de7d2b1 100644 --- a/net/base/strict_transport_security_state.h +++ b/net/base/strict_transport_security_state.h @@ -66,6 +66,10 @@ class StrictTransportSecurityState : bool Deserialise(const std::string& state); private: + friend class base::RefCountedThreadSafe<StrictTransportSecurityState>; + + ~StrictTransportSecurityState() {} + // If we have a callback configured, call it to let our serialiser know that // our state is dirty. void DirtyNotify(); diff --git a/net/base/telnet_server.h b/net/base/telnet_server.h index e1c9344..d8d21e8 100644 --- a/net/base/telnet_server.h +++ b/net/base/telnet_server.h @@ -14,7 +14,6 @@ class TelnetServer : public ListenSocket { public: static TelnetServer* Listen(std::string ip, int port, ListenSocketDelegate *del); - virtual ~TelnetServer(); protected: void Listen() { ListenSocket::Listen(); } @@ -45,6 +44,7 @@ private: }; TelnetServer(SOCKET s, ListenSocketDelegate* del); + virtual ~TelnetServer(); // telnet commands void SendIAC(int command, int option); diff --git a/net/base/telnet_server_unittest.cc b/net/base/telnet_server_unittest.cc index 0d5853b..483309c 100644 --- a/net/base/telnet_server_unittest.cc +++ b/net/base/telnet_server_unittest.cc @@ -33,6 +33,9 @@ public: } return false; } + +private: + ~TelnetServerTester() {} }; class TelnetServerTest: public PlatformTest { diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc index 1d333f7..c19aae0 100644 --- a/net/base/test_completion_callback_unittest.cc +++ b/net/base/test_completion_callback_unittest.cc @@ -47,6 +47,10 @@ class ExampleEmployer::ExampleWorker void DoWork(); void DoCallback(); private: + friend class base::RefCountedThreadSafe<ExampleWorker>; + + ~ExampleWorker() {} + // Only used on the origin thread (where DoSomething was called). ExampleEmployer* employer_; CompletionCallback* callback_; diff --git a/net/base/upload_data.h b/net/base/upload_data.h index f1d4369..02880d3 100644 --- a/net/base/upload_data.h +++ b/net/base/upload_data.h @@ -102,6 +102,10 @@ class UploadData : public base::RefCounted<UploadData> { int64 identifier() const { return identifier_; } private: + friend class base::RefCounted<UploadData>; + + ~UploadData() {} + std::vector<Element> elements_; int64 identifier_; }; |