| 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_IMPL_H_ | 5 #ifndef CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
| 6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/power_monitor/power_monitor.h" | 17 #include "base/power_monitor/power_monitor.h" |
| 18 #include "base/sequenced_task_runner.h" | 18 #include "base/sequenced_task_runner.h" |
| 19 #include "base/tracked_objects.h" | 19 #include "base/tracked_objects.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
| 22 #include "content/public/child/child_thread.h" | 22 #include "content/public/child/child_thread.h" |
| 23 #include "ipc/ipc.mojom.h" |
| 23 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. | 24 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. |
| 24 #include "ipc/ipc_platform_file.h" | 25 #include "ipc/ipc_platform_file.h" |
| 25 #include "ipc/message_router.h" | 26 #include "ipc/message_router.h" |
| 26 | 27 |
| 27 namespace base { | 28 namespace base { |
| 28 class MessageLoop; | 29 class MessageLoop; |
| 29 } // namespace base | 30 } // namespace base |
| 30 | 31 |
| 31 namespace IPC { | 32 namespace IPC { |
| 32 class MessageFilter; | 33 class MessageFilter; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 static ChildThreadImpl* current(); | 193 static ChildThreadImpl* current(); |
| 193 | 194 |
| 194 #if defined(OS_ANDROID) | 195 #if defined(OS_ANDROID) |
| 195 // Called on Android's service thread to shutdown the main thread of this | 196 // Called on Android's service thread to shutdown the main thread of this |
| 196 // process. | 197 // process. |
| 197 static void ShutdownThread(); | 198 static void ShutdownThread(); |
| 198 #endif | 199 #endif |
| 199 | 200 |
| 200 protected: | 201 protected: |
| 201 friend class ChildProcess; | 202 friend class ChildProcess; |
| 203 class ChildThreadConnectionFilter; |
| 202 | 204 |
| 203 // Called when the process refcount is 0. | 205 // Called when the process refcount is 0. |
| 204 void OnProcessFinalRelease(); | 206 void OnProcessFinalRelease(); |
| 205 | 207 |
| 206 // Called by subclasses to manually start the MojoShellConnection. Must only | 208 // Called by subclasses to manually start the MojoShellConnection. Must only |
| 207 // be called if ChildThreadImpl::Options::auto_start_mojo_shell_connection | 209 // be called if ChildThreadImpl::Options::auto_start_mojo_shell_connection |
| 208 // was set to |false| on ChildThreadImpl construction. | 210 // was set to |false| on ChildThreadImpl construction. |
| 209 void StartMojoShellConnection(); | 211 void StartMojoShellConnection(); |
| 210 | 212 |
| 211 virtual bool OnControlMessageReceived(const IPC::Message& msg); | 213 virtual bool OnControlMessageReceived(const IPC::Message& msg); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 232 | 234 |
| 233 private: | 235 private: |
| 234 IPC::Sender* const sender_; | 236 IPC::Sender* const sender_; |
| 235 }; | 237 }; |
| 236 | 238 |
| 237 void Init(const Options& options); | 239 void Init(const Options& options); |
| 238 | 240 |
| 239 // We create the channel first without connecting it so we can add filters | 241 // We create the channel first without connecting it so we can add filters |
| 240 // prior to any messages being received, then connect it afterwards. | 242 // prior to any messages being received, then connect it afterwards. |
| 241 void ConnectChannel(bool use_mojo_channel, const std::string& ipc_token); | 243 void ConnectChannel(bool use_mojo_channel, const std::string& ipc_token); |
| 244 void ConnectMojoChannel(IPC::mojom::BootstrapRequest request); |
| 242 | 245 |
| 243 // IPC message handlers. | 246 // IPC message handlers. |
| 244 void OnShutdown(); | 247 void OnShutdown(); |
| 245 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status); | 248 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status); |
| 246 void OnGetChildProfilerData(int sequence_number, int current_profiling_phase); | 249 void OnGetChildProfilerData(int sequence_number, int current_profiling_phase); |
| 247 void OnProfilingPhaseCompleted(int profiling_phase); | 250 void OnProfilingPhaseCompleted(int profiling_phase); |
| 248 #ifdef IPC_MESSAGE_LOG_ENABLED | 251 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 249 void OnSetIPCLoggingEnabled(bool enable); | 252 void OnSetIPCLoggingEnabled(bool enable); |
| 250 #endif | 253 #endif |
| 251 | 254 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 351 |
| 349 private: | 352 private: |
| 350 struct Options options_; | 353 struct Options options_; |
| 351 | 354 |
| 352 DISALLOW_COPY_AND_ASSIGN(Builder); | 355 DISALLOW_COPY_AND_ASSIGN(Builder); |
| 353 }; | 356 }; |
| 354 | 357 |
| 355 } // namespace content | 358 } // namespace content |
| 356 | 359 |
| 357 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 360 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
| OLD | NEW |