diff options
author | thakis <thakis@chromium.org> | 2015-05-01 18:28:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-02 01:29:23 +0000 |
commit | efa363a5b868a17049852fa9cd86679120041853 (patch) | |
tree | d51b9fcc4597a6b7536fa5d721b75fcf0625da39 | |
parent | 2045be86fa3510f263a5780903dacb96859ec890 (diff) | |
download | chromium_src-efa363a5b868a17049852fa9cd86679120041853.zip chromium_src-efa363a5b868a17049852fa9cd86679120041853.tar.gz chromium_src-efa363a5b868a17049852fa9cd86679120041853.tar.bz2 |
win: Ref-counted classes should have non-public destructors.
BUG=123295,467287
TBR=avi,rsleevi,kbr,grt
Review URL: https://codereview.chromium.org/1120203004
Cr-Commit-Position: refs/heads/master@{#328040}
-rw-r--r-- | content/common/font_cache_dispatcher_win.cc | 16 | ||||
-rw-r--r-- | content/common/font_cache_dispatcher_win.h | 3 | ||||
-rw-r--r-- | net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc | 6 | ||||
-rw-r--r-- | net/proxy/dhcp_proxy_script_adapter_fetcher_win.h | 4 | ||||
-rw-r--r-- | net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc | 3 | ||||
-rw-r--r-- | net/proxy/dhcp_proxy_script_fetcher_win.cc | 6 | ||||
-rw-r--r-- | net/proxy/dhcp_proxy_script_fetcher_win.h | 4 | ||||
-rw-r--r-- | net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc | 12 | ||||
-rw-r--r-- | ui/gl/gl_context_wgl.cc | 37 | ||||
-rw-r--r-- | ui/gl/gl_context_wgl.h | 3 | ||||
-rw-r--r-- | win8/viewer/metro_viewer_process_host.cc | 3 | ||||
-rw-r--r-- | win8/viewer/metro_viewer_process_host.h | 2 |
12 files changed, 57 insertions, 42 deletions
diff --git a/content/common/font_cache_dispatcher_win.cc b/content/common/font_cache_dispatcher_win.cc index 69aa7ae..880f0f4 100644 --- a/content/common/font_cache_dispatcher_win.cc +++ b/content/common/font_cache_dispatcher_win.cc @@ -143,6 +143,14 @@ FontCacheDispatcher::FontCacheDispatcher() : sender_(NULL) { } +bool FontCacheDispatcher::Send(IPC::Message* message) { + if (sender_) + return sender_->Send(message); + + delete message; + return false; +} + FontCacheDispatcher::~FontCacheDispatcher() { } @@ -165,14 +173,6 @@ void FontCacheDispatcher::OnChannelClosing() { sender_ = NULL; } -bool FontCacheDispatcher::Send(IPC::Message* message) { - if (sender_) - return sender_->Send(message); - - delete message; - return false; -} - void FontCacheDispatcher::OnPreCacheFont(const LOGFONT& font) { // If a child process is running in a sandbox, GetTextMetrics() // can sometimes fail. If a font has not been loaded diff --git a/content/common/font_cache_dispatcher_win.h b/content/common/font_cache_dispatcher_win.h index 3d3d370..3c0faf8 100644 --- a/content/common/font_cache_dispatcher_win.h +++ b/content/common/font_cache_dispatcher_win.h @@ -20,12 +20,13 @@ namespace content { class FontCacheDispatcher : public IPC::MessageFilter, public IPC::Sender { public: FontCacheDispatcher(); - ~FontCacheDispatcher() override; // IPC::Sender implementation: bool Send(IPC::Message* message) override; private: + ~FontCacheDispatcher() override; + // IPC::MessageFilter implementation: void OnFilterAdded(IPC::Sender* sender) override; bool OnMessageReceived(const IPC::Message& message) override; diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc index 8d41d66..b8317cd 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc @@ -117,9 +117,6 @@ GURL DhcpProxyScriptAdapterFetcher::GetPacURL() const { DhcpProxyScriptAdapterFetcher::DhcpQuery::DhcpQuery() { } -DhcpProxyScriptAdapterFetcher::DhcpQuery::~DhcpQuery() { -} - void DhcpProxyScriptAdapterFetcher::DhcpQuery::GetPacURLForAdapter( const std::string& adapter_name) { url_ = ImplGetPacURLFromDhcp(adapter_name); @@ -135,6 +132,9 @@ std::string return DhcpProxyScriptAdapterFetcher::GetPacURLFromDhcp(adapter_name); } +DhcpProxyScriptAdapterFetcher::DhcpQuery::~DhcpQuery() { +} + void DhcpProxyScriptAdapterFetcher::OnDhcpQueryDone( scoped_refptr<DhcpQuery> dhcp_query) { DCHECK(CalledOnValidThread()); diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h index 70bc8e2d..30dcda2 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h @@ -120,7 +120,6 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptAdapterFetcher : public base::RefCountedThreadSafe<DhcpQuery> { public: DhcpQuery(); - virtual ~DhcpQuery(); // This method should run on a worker pool thread, via PostTaskAndReply. // After it has run, the |url()| method on this object will return the @@ -134,6 +133,9 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptAdapterFetcher // Virtual method introduced to allow unit testing. virtual std::string ImplGetPacURLFromDhcp(const std::string& adapter_name); + friend class base::RefCountedThreadSafe<DhcpQuery>; + virtual ~DhcpQuery(); + private: // The URL retrieved for the given adapter. std::string url_; diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc index 4a45e67..788d885 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc @@ -80,6 +80,9 @@ class MockDhcpProxyScriptAdapterFetcher base::WaitableEvent test_finished_event_; base::TimeDelta dhcp_delay_; std::string configured_url_; + + private: + ~DelayingDhcpQuery() {} }; DhcpQuery* ImplCreateDhcpQuery() override { diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.cc b/net/proxy/dhcp_proxy_script_fetcher_win.cc index 7147d67..5d1c37d 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win.cc @@ -350,9 +350,6 @@ bool DhcpProxyScriptFetcherWin::GetCandidateAdapterNames( DhcpProxyScriptFetcherWin::AdapterQuery::AdapterQuery() { } -DhcpProxyScriptFetcherWin::AdapterQuery::~AdapterQuery() { -} - void DhcpProxyScriptFetcherWin::AdapterQuery::GetCandidateAdapterNames() { // TODO(pkasting): Remove ScopedTracker below once crbug.com/476182 is fixed. tracked_objects::ScopedTracker tracking_profile( @@ -373,4 +370,7 @@ bool DhcpProxyScriptFetcherWin::AdapterQuery::ImplGetCandidateAdapterNames( return DhcpProxyScriptFetcherWin::GetCandidateAdapterNames(adapter_names); } +DhcpProxyScriptFetcherWin::AdapterQuery::~AdapterQuery() { +} + } // namespace net diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.h b/net/proxy/dhcp_proxy_script_fetcher_win.h index d490805..fbe4a61 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win.h +++ b/net/proxy/dhcp_proxy_script_fetcher_win.h @@ -63,7 +63,6 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptFetcherWin : public base::RefCountedThreadSafe<AdapterQuery> { public: AdapterQuery(); - virtual ~AdapterQuery(); // This is the method that runs on the worker pool thread. void GetCandidateAdapterNames(); @@ -77,6 +76,9 @@ class NET_EXPORT_PRIVATE DhcpProxyScriptFetcherWin virtual bool ImplGetCandidateAdapterNames( std::set<std::string>* adapter_names); + friend class base::RefCountedThreadSafe<AdapterQuery>; + virtual ~AdapterQuery(); + private: // This is constructed on the originating thread, then used on the // worker thread, then used again on the originating thread only when diff --git a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc index 1033126..59927dc 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc @@ -157,15 +157,16 @@ class DelayingDhcpProxyScriptAdapterFetcher class DelayingDhcpQuery : public DhcpQuery { public: - explicit DelayingDhcpQuery() - : DhcpQuery() { - } + explicit DelayingDhcpQuery() : DhcpQuery() {} std::string ImplGetPacURLFromDhcp( const std::string& adapter_name) override { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(20)); return DhcpQuery::ImplGetPacURLFromDhcp(adapter_name); } + + private: + ~DelayingDhcpQuery() override {} }; DhcpQuery* ImplCreateDhcpQuery() override { @@ -269,8 +270,6 @@ class MockDhcpProxyScriptFetcherWin : public DhcpProxyScriptFetcherWin { MockAdapterQuery() { } - ~MockAdapterQuery() override {} - bool ImplGetCandidateAdapterNames( std::set<std::string>* adapter_names) override { adapter_names->insert( @@ -279,6 +278,9 @@ class MockDhcpProxyScriptFetcherWin : public DhcpProxyScriptFetcherWin { } std::vector<std::string> mock_adapter_names_; + + private: + ~MockAdapterQuery() override {} }; MockDhcpProxyScriptFetcherWin(URLRequestContext* context) diff --git a/ui/gl/gl_context_wgl.cc b/ui/gl/gl_context_wgl.cc index fa7f706..8fd29e6 100644 --- a/ui/gl/gl_context_wgl.cc +++ b/ui/gl/gl_context_wgl.cc @@ -15,25 +15,7 @@ namespace gfx { GLContextWGL::GLContextWGL(GLShareGroup* share_group) - : GLContextReal(share_group), - context_(NULL) { -} - -GLContextWGL::~GLContextWGL() { - Destroy(); -} - -std::string GLContextWGL::GetExtensions() { - const char* extensions = NULL; - if (g_driver_wgl.fn.wglGetExtensionsStringARBFn) - extensions = wglGetExtensionsStringARB(GLSurfaceWGL::GetDisplayDC()); - else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) - extensions = wglGetExtensionsStringEXT(); - - if (extensions) - return GLContext::GetExtensions() + " " + extensions; - - return GLContext::GetExtensions(); + : GLContextReal(share_group), context_(NULL) { } bool GLContextWGL::Initialize( @@ -142,4 +124,21 @@ void GLContextWGL::OnSetSwapInterval(int interval) { } } +std::string GLContextWGL::GetExtensions() { + const char* extensions = NULL; + if (g_driver_wgl.fn.wglGetExtensionsStringARBFn) + extensions = wglGetExtensionsStringARB(GLSurfaceWGL::GetDisplayDC()); + else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) + extensions = wglGetExtensionsStringEXT(); + + if (extensions) + return GLContext::GetExtensions() + " " + extensions; + + return GLContext::GetExtensions(); +} + +GLContextWGL::~GLContextWGL() { + Destroy(); +} + } // namespace gfx diff --git a/ui/gl/gl_context_wgl.h b/ui/gl/gl_context_wgl.h index 7a0a437..ff0aae0 100644 --- a/ui/gl/gl_context_wgl.h +++ b/ui/gl/gl_context_wgl.h @@ -18,7 +18,6 @@ class GLSurface; class GLContextWGL : public GLContextReal { public: explicit GLContextWGL(GLShareGroup* share_group); - ~GLContextWGL() override; // Implement GLContext. bool Initialize(GLSurface* compatible_surface, @@ -32,6 +31,8 @@ class GLContextWGL : public GLContextReal { std::string GetExtensions() override; private: + ~GLContextWGL() override; + HGLRC context_; DISALLOW_COPY_AND_ASSIGN(GLContextWGL); diff --git a/win8/viewer/metro_viewer_process_host.cc b/win8/viewer/metro_viewer_process_host.cc index 61a776c..348dfda6 100644 --- a/win8/viewer/metro_viewer_process_host.cc +++ b/win8/viewer/metro_viewer_process_host.cc @@ -45,6 +45,9 @@ void MetroViewerProcessHost::InternalMessageFilter::OnChannelConnected( owner_->NotifyChannelConnected(); } +MetroViewerProcessHost::InternalMessageFilter::~InternalMessageFilter() { +} + MetroViewerProcessHost::MetroViewerProcessHost( const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { DCHECK(!instance_); diff --git a/win8/viewer/metro_viewer_process_host.h b/win8/viewer/metro_viewer_process_host.h index 12f4c88..1218a43 100644 --- a/win8/viewer/metro_viewer_process_host.h +++ b/win8/viewer/metro_viewer_process_host.h @@ -191,6 +191,8 @@ class METRO_VIEWER_EXPORT MetroViewerProcessHost : public IPC::Listener, void OnChannelConnected(int32 peer_pid) override; private: + ~InternalMessageFilter(); + MetroViewerProcessHost* owner_; DISALLOW_COPY_AND_ASSIGN(InternalMessageFilter); }; |