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