| 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/macros.h" | 8 #include "base/macros.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 15 matching lines...) Expand all Loading... |
| 26 // 4. IO thread is stopped. | 26 // 4. IO thread is stopped. |
| 27 // 5. Main message loop exits. | 27 // 5. Main message loop exits. |
| 28 // 6. Child process is now fully stopped. | 28 // 6. Child process is now fully stopped. |
| 29 // | 29 // |
| 30 // Note: IO thread outlives the ChildThreadImpl object. | 30 // Note: IO thread outlives the ChildThreadImpl object. |
| 31 class CONTENT_EXPORT ChildProcess { | 31 class CONTENT_EXPORT ChildProcess { |
| 32 public: | 32 public: |
| 33 // Child processes should have an object that derives from this class. | 33 // Child processes should have an object that derives from this class. |
| 34 // Normally you would immediately call set_main_thread after construction. | 34 // Normally you would immediately call set_main_thread after construction. |
| 35 ChildProcess(); | 35 ChildProcess(); |
| 36 explicit ChildProcess(base::ThreadPriority io_thread_priority); |
| 36 virtual ~ChildProcess(); | 37 virtual ~ChildProcess(); |
| 37 | 38 |
| 38 // May be NULL if the main thread hasn't been set explicitly. | 39 // May be NULL if the main thread hasn't been set explicitly. |
| 39 ChildThreadImpl* main_thread(); | 40 ChildThreadImpl* main_thread(); |
| 40 | 41 |
| 41 // Sets the object associated with the main thread of this process. | 42 // Sets the object associated with the main thread of this process. |
| 42 // Takes ownership of the pointer. | 43 // Takes ownership of the pointer. |
| 43 void set_main_thread(ChildThreadImpl* thread); | 44 void set_main_thread(ChildThreadImpl* thread); |
| 44 | 45 |
| 45 base::MessageLoop* io_message_loop() { return io_thread_.message_loop(); } | 46 base::MessageLoop* io_message_loop() { return io_thread_.message_loop(); } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // it depends on it (indirectly through IPC::SyncChannel). Same for | 83 // it depends on it (indirectly through IPC::SyncChannel). Same for |
| 83 // io_thread_. | 84 // io_thread_. |
| 84 scoped_ptr<ChildThreadImpl> main_thread_; | 85 scoped_ptr<ChildThreadImpl> main_thread_; |
| 85 | 86 |
| 86 DISALLOW_COPY_AND_ASSIGN(ChildProcess); | 87 DISALLOW_COPY_AND_ASSIGN(ChildProcess); |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 } // namespace content | 90 } // namespace content |
| 90 | 91 |
| 91 #endif // CONTENT_CHILD_CHILD_PROCESS_H_ | 92 #endif // CONTENT_CHILD_CHILD_PROCESS_H_ |
| OLD | NEW |