Chromium Code Reviews| 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_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 // communication channel. There will generally be one RenderProcessHost per | 33 // communication channel. There will generally be one RenderProcessHost per |
| 34 // renderer process. | 34 // renderer process. |
| 35 class CONTENT_EXPORT RenderProcessHost : public IPC::Message::Sender, | 35 class CONTENT_EXPORT RenderProcessHost : public IPC::Message::Sender, |
| 36 public IPC::Channel::Listener { | 36 public IPC::Channel::Listener { |
| 37 public: | 37 public: |
| 38 typedef IDMap<RenderProcessHost>::iterator iterator; | 38 typedef IDMap<RenderProcessHost>::iterator iterator; |
| 39 typedef IDMap<RenderWidgetHost>::const_iterator RenderWidgetHostsIterator; | 39 typedef IDMap<RenderWidgetHost>::const_iterator RenderWidgetHostsIterator; |
| 40 | 40 |
| 41 // Details for RENDERER_PROCESS_CLOSED notifications. | 41 // Details for RENDERER_PROCESS_CLOSED notifications. |
| 42 struct RendererClosedDetails { | 42 struct RendererClosedDetails { |
| 43 RendererClosedDetails(base::ProcessHandle handle, | 43 RendererClosedDetails(base::ProcessHandle handle) { |
| 44 base::TerminationStatus status, | |
| 45 int exit_code, | |
| 46 bool was_alive) { | |
| 47 this->handle = handle; | 44 this->handle = handle; |
| 48 this->status = status; | 45 // default values should be updated by caller. |
| 49 this->exit_code = exit_code; | 46 status = base::TERMINATION_STATUS_NORMAL_TERMINATION; |
| 50 this->was_alive = was_alive; | 47 exit_code = 0; |
| 48 was_alive = false; | |
| 49 | |
| 50 #if defined(OS_WIN) | |
| 51 have_process_times = false; | |
| 52 FILETIME win_creation_time; | |
| 53 FILETIME win_exit_time; | |
| 54 FILETIME win_kernel_time; | |
| 55 FILETIME win_user_time; | |
| 56 if (!GetProcessTimes(handle, &win_creation_time, &win_exit_time, | |
| 57 &win_kernel_time, &win_user_time)) { | |
|
rvargas (doing something else)
2012/03/22 22:16:30
nit: indent under handle
jar (doing other things)
2012/03/22 22:42:58
Done.
| |
| 58 DWORD error = GetLastError(); | |
| 59 DLOG(ERROR) << "Error getting process data" << error; | |
| 60 return; | |
| 61 } | |
| 62 user_duration = base::Time::FromFileTime(win_user_time) - | |
| 63 base::Time::Time(); | |
| 64 kernel_duration = base::Time::FromFileTime(win_kernel_time) - | |
| 65 base::Time::Time(); | |
| 66 run_duration = base::Time::FromFileTime(win_exit_time) - | |
| 67 base::Time::FromFileTime(win_creation_time); | |
| 68 have_process_times = true; | |
| 69 #endif // OS_WIN | |
| 51 } | 70 } |
| 71 | |
| 72 #if defined(OS_WIN) | |
| 73 base::TimeDelta kernel_duration; | |
| 74 base::TimeDelta user_duration; | |
| 75 base::TimeDelta run_duration; | |
| 76 bool have_process_times; | |
| 77 #endif // OS_WIN | |
| 78 | |
| 52 base::ProcessHandle handle; | 79 base::ProcessHandle handle; |
| 53 base::TerminationStatus status; | 80 base::TerminationStatus status; |
| 54 int exit_code; | 81 int exit_code; |
| 55 bool was_alive; | 82 bool was_alive; |
| 56 }; | 83 }; |
| 57 | 84 |
| 58 virtual ~RenderProcessHost() {} | 85 virtual ~RenderProcessHost() {} |
| 59 | 86 |
| 60 // Initialize the new renderer process, returning true on success. This must | 87 // Initialize the new renderer process, returning true on success. This must |
| 61 // be called once before the object can be used, but can be called after | 88 // be called once before the object can be used, but can be called after |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 | 263 |
| 237 // Returns the current max number of renderer processes used by the content | 264 // Returns the current max number of renderer processes used by the content |
| 238 // module. | 265 // module. |
| 239 static size_t GetMaxRendererProcessCount(); | 266 static size_t GetMaxRendererProcessCount(); |
| 240 }; | 267 }; |
| 241 | 268 |
| 242 } // namespace content. | 269 } // namespace content. |
| 243 | 270 |
| 244 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 271 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
| 245 | 272 |
| OLD | NEW |