OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_COMMON_CHILD_THREAD_H_ | 5 #ifndef CHROME_COMMON_CHILD_THREAD_H_ |
6 #define CHROME_COMMON_CHILD_THREAD_H_ | 6 #define CHROME_COMMON_CHILD_THREAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // Returns the one child thread. | 68 // Returns the one child thread. |
69 static ChildThread* current(); | 69 static ChildThread* current(); |
70 | 70 |
71 protected: | 71 protected: |
72 friend class ChildProcess; | 72 friend class ChildProcess; |
73 | 73 |
74 // Called when the process refcount is 0. | 74 // Called when the process refcount is 0. |
75 void OnProcessFinalRelease(); | 75 void OnProcessFinalRelease(); |
76 | 76 |
77 virtual void OnControlMessageReceived(const IPC::Message& msg) { } | 77 virtual bool OnControlMessageReceived(const IPC::Message& msg) { |
| 78 return false; |
| 79 } |
78 virtual void OnAskBeforeShutdown(); | 80 virtual void OnAskBeforeShutdown(); |
79 virtual void OnShutdown(); | 81 virtual void OnShutdown(); |
80 | 82 |
81 #ifdef IPC_MESSAGE_LOG_ENABLED | 83 #ifdef IPC_MESSAGE_LOG_ENABLED |
82 virtual void OnSetIPCLoggingEnabled(bool enable); | 84 virtual void OnSetIPCLoggingEnabled(bool enable); |
83 #endif | 85 #endif |
84 | 86 |
85 IPC::SyncChannel* channel() { return channel_.get(); } | 87 IPC::SyncChannel* channel() { return channel_.get(); } |
86 | 88 |
87 void set_on_channel_error_called(bool on_channel_error_called) { | 89 void set_on_channel_error_called(bool on_channel_error_called) { |
88 on_channel_error_called_ = on_channel_error_called; | 90 on_channel_error_called_ = on_channel_error_called; |
89 } | 91 } |
90 | 92 |
91 private: | 93 private: |
92 void Init(); | 94 void Init(); |
93 | 95 |
94 // IPC::Channel::Listener implementation: | 96 // IPC::Channel::Listener implementation: |
95 virtual void OnMessageReceived(const IPC::Message& msg); | 97 virtual bool OnMessageReceived(const IPC::Message& msg); |
96 virtual void OnChannelError(); | 98 virtual void OnChannelError(); |
97 | 99 |
98 std::string channel_name_; | 100 std::string channel_name_; |
99 scoped_ptr<IPC::SyncChannel> channel_; | 101 scoped_ptr<IPC::SyncChannel> channel_; |
100 | 102 |
101 // Allows threads other than the main thread to send sync messages. | 103 // Allows threads other than the main thread to send sync messages. |
102 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; | 104 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; |
103 | 105 |
104 // Implements message routing functionality to the consumers of ChildThread. | 106 // Implements message routing functionality to the consumers of ChildThread. |
105 MessageRouter router_; | 107 MessageRouter router_; |
(...skipping 16 matching lines...) Expand all Loading... |
122 MessageLoop* message_loop_; | 124 MessageLoop* message_loop_; |
123 | 125 |
124 scoped_ptr<NotificationService> notification_service_; | 126 scoped_ptr<NotificationService> notification_service_; |
125 | 127 |
126 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; | 128 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; |
127 | 129 |
128 DISALLOW_COPY_AND_ASSIGN(ChildThread); | 130 DISALLOW_COPY_AND_ASSIGN(ChildThread); |
129 }; | 131 }; |
130 | 132 |
131 #endif // CHROME_COMMON_CHILD_THREAD_H_ | 133 #endif // CHROME_COMMON_CHILD_THREAD_H_ |
OLD | NEW |