Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: ipc/ipc_channel.h

Issue 10383262: RefCounted types should not have public destructors, delegate cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IPC_IPC_CHANNEL_H_ 5 #ifndef IPC_IPC_CHANNEL_H_
6 #define IPC_IPC_CHANNEL_H_ 6 #define IPC_IPC_CHANNEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 22 matching lines...) Expand all
33 // currently used by automation and service processes. 33 // currently used by automation and service processes.
34 34
35 class IPC_EXPORT Channel : public Message::Sender { 35 class IPC_EXPORT Channel : public Message::Sender {
36 // Security tests need access to the pipe handle. 36 // Security tests need access to the pipe handle.
37 friend class ChannelTest; 37 friend class ChannelTest;
38 38
39 public: 39 public:
40 // Implemented by consumers of a Channel to receive messages. 40 // Implemented by consumers of a Channel to receive messages.
41 class IPC_EXPORT Listener { 41 class IPC_EXPORT Listener {
42 public: 42 public:
43 virtual ~Listener() {}
44
45 // Called when a message is received. Returns true iff the message was 43 // Called when a message is received. Returns true iff the message was
46 // handled. 44 // handled.
47 virtual bool OnMessageReceived(const Message& message) = 0; 45 virtual bool OnMessageReceived(const Message& message) = 0;
48 46
49 // Called when the channel is connected and we have received the internal 47 // Called when the channel is connected and we have received the internal
50 // Hello message from the peer. 48 // Hello message from the peer.
51 virtual void OnChannelConnected(int32 peer_pid) {} 49 virtual void OnChannelConnected(int32 peer_pid) {}
52 50
53 // Called when an error is detected that causes the channel to close. 51 // Called when an error is detected that causes the channel to close.
54 // This method is not called when a channel is closed normally. 52 // This method is not called when a channel is closed normally.
55 virtual void OnChannelError() {} 53 virtual void OnChannelError() {}
56 54
57 #if defined(OS_POSIX) 55 #if defined(OS_POSIX)
58 // Called on the server side when a channel that listens for connections 56 // Called on the server side when a channel that listens for connections
59 // denies an attempt to connect. 57 // denies an attempt to connect.
60 virtual void OnChannelDenied() {} 58 virtual void OnChannelDenied() {}
61 59
62 // Called on the server side when a channel that listens for connections 60 // Called on the server side when a channel that listens for connections
63 // has an error that causes the listening channel to close. 61 // has an error that causes the listening channel to close.
64 virtual void OnChannelListenError() {} 62 virtual void OnChannelListenError() {}
65 #endif // OS_POSIX 63 #endif // OS_POSIX
64
65 protected:
66 virtual ~Listener() {}
66 }; 67 };
67 68
68 // Flags to test modes 69 // Flags to test modes
69 enum ModeFlags { 70 enum ModeFlags {
70 MODE_NO_FLAG = 0x0, 71 MODE_NO_FLAG = 0x0,
71 MODE_SERVER_FLAG = 0x1, 72 MODE_SERVER_FLAG = 0x1,
72 MODE_CLIENT_FLAG = 0x2, 73 MODE_CLIENT_FLAG = 0x2,
73 MODE_NAMED_FLAG = 0x4, 74 MODE_NAMED_FLAG = 0x4,
74 #if defined(OS_POSIX) 75 #if defined(OS_POSIX)
75 MODE_OPEN_ACCESS_FLAG = 0x8, // Don't restrict access based on client UID. 76 MODE_OPEN_ACCESS_FLAG = 0x8, // Don't restrict access based on client UID.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 223
223 private: 224 private:
224 // PIMPL to which all channel calls are delegated. 225 // PIMPL to which all channel calls are delegated.
225 class ChannelImpl; 226 class ChannelImpl;
226 ChannelImpl *channel_impl_; 227 ChannelImpl *channel_impl_;
227 }; 228 };
228 229
229 } // namespace IPC 230 } // namespace IPC
230 231
231 #endif // IPC_IPC_CHANNEL_H_ 232 #endif // IPC_IPC_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698