| OLD | NEW |
| 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_H_ | 5 #ifndef CONTENT_COMMON_CHILD_PROCESS_H_ |
| 6 #define CONTENT_COMMON_CHILD_PROCESS_H_ | 6 #define CONTENT_COMMON_CHILD_PROCESS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 base::WaitableEvent* GetShutDownEvent(); | 46 base::WaitableEvent* GetShutDownEvent(); |
| 47 | 47 |
| 48 // These are used for ref-counting the child process. The process shuts | 48 // These are used for ref-counting the child process. The process shuts |
| 49 // itself down when the ref count reaches 0. | 49 // itself down when the ref count reaches 0. |
| 50 // For example, in the renderer process, generally each tab managed by this | 50 // For example, in the renderer process, generally each tab managed by this |
| 51 // process will hold a reference to the process, and release when closed. | 51 // process will hold a reference to the process, and release when closed. |
| 52 void AddRefProcess(); | 52 void AddRefProcess(); |
| 53 void ReleaseProcess(); | 53 void ReleaseProcess(); |
| 54 | 54 |
| 55 // Getter for the one ChildProcess object for this process. | 55 // Getter for the one ChildProcess object for this process. |
| 56 static ChildProcess* current() { return child_process_; } | 56 static ChildProcess* current(); |
| 57 | 57 |
| 58 static void WaitForDebugger(const std::string& label); | 58 static void WaitForDebugger(const std::string& label); |
| 59 private: | 59 private: |
| 60 int ref_count_; | 60 int ref_count_; |
| 61 | 61 |
| 62 // An event that will be signalled when we shutdown. | 62 // An event that will be signalled when we shutdown. |
| 63 base::WaitableEvent shutdown_event_; | 63 base::WaitableEvent shutdown_event_; |
| 64 | 64 |
| 65 // The thread that handles IO events. | 65 // The thread that handles IO events. |
| 66 base::Thread io_thread_; | 66 base::Thread io_thread_; |
| 67 | 67 |
| 68 // NOTE: make sure that main_thread_ is listed after shutdown_event_, since | 68 // NOTE: make sure that main_thread_ is listed after shutdown_event_, since |
| 69 // it depends on it (indirectly through IPC::SyncChannel). Same for | 69 // it depends on it (indirectly through IPC::SyncChannel). Same for |
| 70 // io_thread_. | 70 // io_thread_. |
| 71 scoped_ptr<ChildThread> main_thread_; | 71 scoped_ptr<ChildThread> main_thread_; |
| 72 | 72 |
| 73 // The singleton instance for this process. | |
| 74 static ChildProcess* child_process_; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(ChildProcess); | 73 DISALLOW_COPY_AND_ASSIGN(ChildProcess); |
| 77 }; | 74 }; |
| 78 | 75 |
| 79 #endif // CONTENT_COMMON_CHILD_PROCESS_H_ | 76 #endif // CONTENT_COMMON_CHILD_PROCESS_H_ |
| OLD | NEW |