| OLD | NEW |
| 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 CONTENT_CHILD_CHILD_THREAD_H_ | 5 #ifndef CONTENT_CHILD_CHILD_THREAD_H_ |
| 6 #define CONTENT_CHILD_CHILD_THREAD_H_ | 6 #define CONTENT_CHILD_CHILD_THREAD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 explicit ChildThread(const Options& options); | 69 explicit ChildThread(const Options& options); |
| 70 // ChildProcess::main_thread() is reset after Shutdown(), and before the | 70 // ChildProcess::main_thread() is reset after Shutdown(), and before the |
| 71 // destructor, so any subsystem that relies on ChildProcess::main_thread() | 71 // destructor, so any subsystem that relies on ChildProcess::main_thread() |
| 72 // must be terminated before Shutdown returns. In particular, if a subsystem | 72 // must be terminated before Shutdown returns. In particular, if a subsystem |
| 73 // has a thread that post tasks to ChildProcess::main_thread(), that thread | 73 // has a thread that post tasks to ChildProcess::main_thread(), that thread |
| 74 // should be joined in Shutdown(). | 74 // should be joined in Shutdown(). |
| 75 virtual ~ChildThread(); | 75 virtual ~ChildThread(); |
| 76 virtual void Shutdown(); | 76 virtual void Shutdown(); |
| 77 | 77 |
| 78 // IPC::Sender implementation: | 78 // IPC::Sender implementation: |
| 79 virtual bool Send(IPC::Message* msg) OVERRIDE; | 79 virtual bool Send(IPC::Message* msg) override; |
| 80 | 80 |
| 81 IPC::SyncChannel* channel() { return channel_.get(); } | 81 IPC::SyncChannel* channel() { return channel_.get(); } |
| 82 | 82 |
| 83 MessageRouter* GetRouter(); | 83 MessageRouter* GetRouter(); |
| 84 | 84 |
| 85 // Allocates a block of shared memory of the given size and | 85 // Allocates a block of shared memory of the given size and |
| 86 // maps in into the address space. Returns NULL of failure. | 86 // maps in into the address space. Returns NULL of failure. |
| 87 // Note: On posix, this requires a sync IPC to the browser process, | 87 // Note: On posix, this requires a sync IPC to the browser process, |
| 88 // but on windows the child process directly allocates the block. | 88 // but on windows the child process directly allocates the block. |
| 89 base::SharedMemory* AllocateSharedMemory(size_t buf_size); | 89 base::SharedMemory* AllocateSharedMemory(size_t buf_size); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Called when the process refcount is 0. | 161 // Called when the process refcount is 0. |
| 162 void OnProcessFinalRelease(); | 162 void OnProcessFinalRelease(); |
| 163 | 163 |
| 164 virtual bool OnControlMessageReceived(const IPC::Message& msg); | 164 virtual bool OnControlMessageReceived(const IPC::Message& msg); |
| 165 | 165 |
| 166 void set_on_channel_error_called(bool on_channel_error_called) { | 166 void set_on_channel_error_called(bool on_channel_error_called) { |
| 167 on_channel_error_called_ = on_channel_error_called; | 167 on_channel_error_called_ = on_channel_error_called; |
| 168 } | 168 } |
| 169 | 169 |
| 170 // IPC::Listener implementation: | 170 // IPC::Listener implementation: |
| 171 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 171 virtual bool OnMessageReceived(const IPC::Message& msg) override; |
| 172 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 172 virtual void OnChannelConnected(int32 peer_pid) override; |
| 173 virtual void OnChannelError() OVERRIDE; | 173 virtual void OnChannelError() override; |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 class ChildThreadMessageRouter : public MessageRouter { | 176 class ChildThreadMessageRouter : public MessageRouter { |
| 177 public: | 177 public: |
| 178 // |sender| must outlive this object. | 178 // |sender| must outlive this object. |
| 179 explicit ChildThreadMessageRouter(IPC::Sender* sender); | 179 explicit ChildThreadMessageRouter(IPC::Sender* sender); |
| 180 virtual bool Send(IPC::Message* msg) OVERRIDE; | 180 virtual bool Send(IPC::Message* msg) override; |
| 181 | 181 |
| 182 private: | 182 private: |
| 183 IPC::Sender* const sender_; | 183 IPC::Sender* const sender_; |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 void Init(const Options& options); | 186 void Init(const Options& options); |
| 187 scoped_ptr<IPC::SyncChannel> CreateChannel(bool use_mojo_channel); | 187 scoped_ptr<IPC::SyncChannel> CreateChannel(bool use_mojo_channel); |
| 188 | 188 |
| 189 // IPC message handlers. | 189 // IPC message handlers. |
| 190 void OnShutdown(); | 190 void OnShutdown(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 bool in_browser_process_; | 253 bool in_browser_process_; |
| 254 | 254 |
| 255 base::WeakPtrFactory<ChildThread> channel_connected_factory_; | 255 base::WeakPtrFactory<ChildThread> channel_connected_factory_; |
| 256 | 256 |
| 257 DISALLOW_COPY_AND_ASSIGN(ChildThread); | 257 DISALLOW_COPY_AND_ASSIGN(ChildThread); |
| 258 }; | 258 }; |
| 259 | 259 |
| 260 } // namespace content | 260 } // namespace content |
| 261 | 261 |
| 262 #endif // CONTENT_CHILD_CHILD_THREAD_H_ | 262 #endif // CONTENT_CHILD_CHILD_THREAD_H_ |
| OLD | NEW |