diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 01:06:06 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 01:06:06 +0000 |
commit | 512d03f78c442cf31bae077d93ecc4882a46b286 (patch) | |
tree | 428c50889d8a1ded265b3dd90775cb300f12e2ae /remoting | |
parent | 8c672de7d601eba2b337446bb869f08dece73633 (diff) | |
download | chromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.zip chromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.tar.gz chromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.tar.bz2 |
RefCounted types should not have public destructors, delegate cleanup
For Delegate/Observer-type classes that specify an
interface but do not have any particular lifetime
requirements, make their destructors protected. This is to
allow their interfaces to be implemented safely by
RefCounted types. With public destructors, it's possible to
do "scoped_ptr<Delegate> foo", and then assign a
RefCountedDelegateImpl, which would lead to a double free.
As none of these Delegates actually need public destructors
(ownership of the Delegate* is not transferred during a
function call / class constructor), mark the destructors
protected so that it becomes a compile warning to try to
delete them via the Delegate*.
BUG=123295
TEST=it compiles
Review URL: https://chromiumcodereview.appspot.com/10383262
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/client/frame_consumer.h | 7 | ||||
-rw-r--r-- | remoting/client/frame_producer.h | 4 | ||||
-rw-r--r-- | remoting/host/client_session.h | 5 | ||||
-rw-r--r-- | remoting/protocol/session_manager.h | 10 |
4 files changed, 16 insertions, 10 deletions
diff --git a/remoting/client/frame_consumer.h b/remoting/client/frame_consumer.h index ce852b4..22701f4 100644 --- a/remoting/client/frame_consumer.h +++ b/remoting/client/frame_consumer.h @@ -17,9 +17,6 @@ namespace remoting { class FrameConsumer { public: - FrameConsumer() {} - virtual ~FrameConsumer() {} - // Accepts a buffer to be painted to the screen. The buffer's dimensions and // relative position within the frame are specified by |clip_area|. Only // pixels falling within |region| and the current clipping area are painted. @@ -41,6 +38,10 @@ class FrameConsumer { // Set the dimension of the entire host screen. virtual void SetSourceSize(const SkISize& source_size) = 0; + protected: + FrameConsumer() {} + virtual ~FrameConsumer() {} + private: DISALLOW_COPY_AND_ASSIGN(FrameConsumer); }; diff --git a/remoting/client/frame_producer.h b/remoting/client/frame_producer.h index c7976c5..340fbb59 100644 --- a/remoting/client/frame_producer.h +++ b/remoting/client/frame_producer.h @@ -19,7 +19,6 @@ namespace remoting { class FrameProducer { public: FrameProducer() {} - virtual ~FrameProducer() {} // Adds an image buffer to the pool of pending buffers for subsequent drawing. // Once drawing is completed the buffer will be returned to the consumer via @@ -43,6 +42,9 @@ class FrameProducer { virtual void SetOutputSizeAndClip(const SkISize& view_size, const SkIRect& clip_area) = 0; + protected: + virtual ~FrameProducer() {} + private: DISALLOW_COPY_AND_ASSIGN(FrameProducer); }; diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index 0fb8532..397beff 100644 --- a/remoting/host/client_session.h +++ b/remoting/host/client_session.h @@ -36,8 +36,6 @@ class ClientSession : public protocol::HostEventStub, // Callback interface for passing events to the ChromotingHost. class EventHandler { public: - virtual ~EventHandler() {} - // Called after authentication has finished successfully. virtual void OnSessionAuthenticated(ClientSession* client) = 0; @@ -63,6 +61,9 @@ class ClientSession : public protocol::HostEventStub, ClientSession* client, const std::string& channel_name, const protocol::TransportRoute& route) = 0; + + protected: + virtual ~EventHandler() {} }; ClientSession(EventHandler* event_handler, diff --git a/remoting/protocol/session_manager.h b/remoting/protocol/session_manager.h index eb0c9db..fc9645c 100644 --- a/remoting/protocol/session_manager.h +++ b/remoting/protocol/session_manager.h @@ -76,8 +76,8 @@ class AuthenticatorFactory; // client side and one for the host side. class SessionManager : public base::NonThreadSafe { public: - SessionManager() { } - virtual ~SessionManager() { } + SessionManager() {} + virtual ~SessionManager() {} enum IncomingSessionResponse { // Accept the session. @@ -97,8 +97,7 @@ class SessionManager : public base::NonThreadSafe { class Listener { public: - Listener() { } - ~Listener() { } + Listener() {} // Called when the session manager is ready to create outgoing // sessions. May be called from Init() or after Init() @@ -115,6 +114,9 @@ class SessionManager : public base::NonThreadSafe { // The callback must take ownership of the |session| if it ACCEPTs it. virtual void OnIncomingSession(Session* session, IncomingSessionResponse* response) = 0; + + protected: + ~Listener() {} }; // Initializes the session client. Caller retains ownership of the |