| 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_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 | 10 |
| 11 #include "content/browser/child_process_launcher.h" | 11 #include "content/browser/child_process_launcher.h" |
| 12 #include "content/common/child_process_host.h" | 12 #include "content/common/child_process_host.h" |
| 13 #include "content/common/child_process_info.h" | 13 #include "content/common/child_process_info.h" |
| 14 #include "content/common/content_export.h" |
| 14 | 15 |
| 15 // Plugins/workers and other child processes that live on the IO thread should | 16 // Plugins/workers and other child processes that live on the IO thread should |
| 16 // derive from this class. | 17 // derive from this class. |
| 17 // | 18 // |
| 18 // [Browser]RenderProcessHost is the main exception that doesn't derive from | 19 // [Browser]RenderProcessHost is the main exception that doesn't derive from |
| 19 // this class. That project lives on the UI thread. | 20 // this class. That project lives on the UI thread. |
| 20 class BrowserChildProcessHost : public ChildProcessHost, | 21 class CONTENT_EXPORT BrowserChildProcessHost : |
| 21 public ChildProcessInfo, | 22 public ChildProcessHost, |
| 22 public ChildProcessLauncher::Client { | 23 public ChildProcessInfo, |
| 24 public ChildProcessLauncher::Client { |
| 23 public: | 25 public: |
| 24 virtual ~BrowserChildProcessHost(); | 26 virtual ~BrowserChildProcessHost(); |
| 25 | 27 |
| 26 // Terminates all child processes and deletes each ChildProcessHost instance. | 28 // Terminates all child processes and deletes each ChildProcessHost instance. |
| 27 static void TerminateAll(); | 29 static void TerminateAll(); |
| 28 | 30 |
| 29 // The Iterator class allows iteration through either all child processes, or | 31 // The Iterator class allows iteration through either all child processes, or |
| 30 // ones of a specific type, depending on which constructor is used. Note that | 32 // ones of a specific type, depending on which constructor is used. Note that |
| 31 // this should be done from the IO thread and that the iterator should not be | 33 // this should be done from the IO thread and that the iterator should not be |
| 32 // kept around as it may be invalidated on subsequent event processing in the | 34 // kept around as it may be invalidated on subsequent event processing in the |
| 33 // event loop. | 35 // event loop. |
| 34 class Iterator { | 36 class CONTENT_EXPORT Iterator { |
| 35 public: | 37 public: |
| 36 Iterator(); | 38 Iterator(); |
| 37 explicit Iterator(ChildProcessInfo::ProcessType type); | 39 explicit Iterator(ChildProcessInfo::ProcessType type); |
| 38 BrowserChildProcessHost* operator->() { return *iterator_; } | 40 BrowserChildProcessHost* operator->() { return *iterator_; } |
| 39 BrowserChildProcessHost* operator*() { return *iterator_; } | 41 BrowserChildProcessHost* operator*() { return *iterator_; } |
| 40 BrowserChildProcessHost* operator++(); | 42 BrowserChildProcessHost* operator++(); |
| 41 bool Done(); | 43 bool Done(); |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 bool all_; | 46 bool all_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 explicit ClientHook(BrowserChildProcessHost* host); | 107 explicit ClientHook(BrowserChildProcessHost* host); |
| 106 virtual void OnProcessLaunched(); | 108 virtual void OnProcessLaunched(); |
| 107 private: | 109 private: |
| 108 BrowserChildProcessHost* host_; | 110 BrowserChildProcessHost* host_; |
| 109 }; | 111 }; |
| 110 ClientHook client_; | 112 ClientHook client_; |
| 111 scoped_ptr<ChildProcessLauncher> child_process_; | 113 scoped_ptr<ChildProcessLauncher> child_process_; |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 116 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| OLD | NEW |