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

Side by Side Diff: content/common/child_process_host.h

Issue 7661031: Tag IPC::Channel::Listener implementations with OVERRIDE (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CONTENT_COMMON_CHILD_PROCESS_HOST_H_ 5 #ifndef CONTENT_COMMON_CHILD_PROCESS_HOST_H_
6 #define CONTENT_COMMON_CHILD_PROCESS_HOST_H_ 6 #define CONTENT_COMMON_CHILD_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // Does not check if CanShutdown is true. 73 // Does not check if CanShutdown is true.
74 virtual void ForceShutdown(); 74 virtual void ForceShutdown();
75 75
76 // Creates the IPC channel. Returns true iff it succeeded. 76 // Creates the IPC channel. Returns true iff it succeeded.
77 virtual bool CreateChannel(); 77 virtual bool CreateChannel();
78 78
79 // Notifies us that an instance has been created on this child process. 79 // Notifies us that an instance has been created on this child process.
80 virtual void InstanceCreated(); 80 virtual void InstanceCreated();
81 81
82 // IPC::Channel::Listener implementation: 82 // IPC::Channel::Listener implementation:
83 virtual bool OnMessageReceived(const IPC::Message& msg); 83 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
84 virtual void OnChannelConnected(int32 peer_pid); 84 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
85 virtual void OnChannelError(); 85 virtual void OnChannelError() OVERRIDE;
86 86
87 bool opening_channel() { return opening_channel_; } 87 bool opening_channel() { return opening_channel_; }
88 const std::string& channel_id() { return channel_id_; } 88 const std::string& channel_id() { return channel_id_; }
89 IPC::Channel* channel() { return channel_.get(); } 89 IPC::Channel* channel() { return channel_.get(); }
90 90
91 // Called when the child process goes away. 91 // Called when the child process goes away.
92 virtual void OnChildDied(); 92 virtual void OnChildDied();
93 // Notifies the derived class that we told the child process to kill itself. 93 // Notifies the derived class that we told the child process to kill itself.
94 virtual void ShutdownStarted(); 94 virtual void ShutdownStarted();
95 // Subclasses can implement specific notification methods. 95 // Subclasses can implement specific notification methods.
96 virtual void Notify(int type); 96 virtual void Notify(int type);
97 97
98 private: 98 private:
99 // By using an internal class as the IPC::Channel::Listener, we can intercept 99 // By using an internal class as the IPC::Channel::Listener, we can intercept
100 // OnMessageReceived/OnChannelConnected and do our own processing before 100 // OnMessageReceived/OnChannelConnected and do our own processing before
101 // calling the subclass' implementation. 101 // calling the subclass' implementation.
102 class ListenerHook : public IPC::Channel::Listener { 102 class ListenerHook : public IPC::Channel::Listener {
103 public: 103 public:
104 explicit ListenerHook(ChildProcessHost* host); 104 explicit ListenerHook(ChildProcessHost* host);
105 virtual bool OnMessageReceived(const IPC::Message& msg); 105 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
106 virtual void OnChannelConnected(int32 peer_pid); 106 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
107 virtual void OnChannelError(); 107 virtual void OnChannelError() OVERRIDE;
108 private: 108 private:
109 ChildProcessHost* host_; 109 ChildProcessHost* host_;
110 }; 110 };
111 111
112 ListenerHook listener_; 112 ListenerHook listener_;
113 113
114 bool opening_channel_; // True while we're waiting the channel to be opened. 114 bool opening_channel_; // True while we're waiting the channel to be opened.
115 scoped_ptr<IPC::Channel> channel_; 115 scoped_ptr<IPC::Channel> channel_;
116 std::string channel_id_; 116 std::string channel_id_;
117 117
118 // Holds all the IPC message filters. Since this object lives on the IO 118 // Holds all the IPC message filters. Since this object lives on the IO
119 // thread, we don't have a IPC::ChannelProxy and so we manage filters 119 // thread, we don't have a IPC::ChannelProxy and so we manage filters
120 // manually. 120 // manually.
121 std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_; 121 std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_;
122 122
123 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); 123 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost);
124 }; 124 };
125 125
126 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_H_ 126 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/mock_render_process_host.h ('k') | content/common/gpu/gpu_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698