| 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 21 matching lines...) Expand all Loading... |
| 32 // communication channel. There will generally be one RenderProcessHost per | 32 // communication channel. There will generally be one RenderProcessHost per |
| 33 // renderer process. | 33 // renderer process. |
| 34 class CONTENT_EXPORT RenderProcessHost : public IPC::Message::Sender, | 34 class CONTENT_EXPORT RenderProcessHost : public IPC::Message::Sender, |
| 35 public IPC::Channel::Listener { | 35 public IPC::Channel::Listener { |
| 36 public: | 36 public: |
| 37 typedef IDMap<RenderProcessHost>::iterator iterator; | 37 typedef IDMap<RenderProcessHost>::iterator iterator; |
| 38 typedef IDMap<IPC::Channel::Listener>::const_iterator listeners_iterator; | 38 typedef IDMap<IPC::Channel::Listener>::const_iterator listeners_iterator; |
| 39 | 39 |
| 40 // Details for RENDERER_PROCESS_CLOSED notifications. | 40 // Details for RENDERER_PROCESS_CLOSED notifications. |
| 41 struct RendererClosedDetails { | 41 struct RendererClosedDetails { |
| 42 RendererClosedDetails(base::ProcessHandle handle, | 42 explicit RendererClosedDetails(base::ProcessHandle handle) { |
| 43 base::TerminationStatus status, | |
| 44 int exit_code, | |
| 45 bool was_alive) { | |
| 46 this->handle = handle; | 43 this->handle = handle; |
| 47 this->status = status; | 44 // default values should be updated by caller. |
| 48 this->exit_code = exit_code; | 45 status = base::TERMINATION_STATUS_NORMAL_TERMINATION; |
| 49 this->was_alive = was_alive; | 46 exit_code = 0; |
| 47 was_alive = false; |
| 48 |
| 49 #if defined(OS_WIN) |
| 50 have_process_times = false; |
| 51 FILETIME win_creation_time; |
| 52 FILETIME win_exit_time; |
| 53 FILETIME win_kernel_time; |
| 54 FILETIME win_user_time; |
| 55 if (!GetProcessTimes(handle, &win_creation_time, &win_exit_time, |
| 56 &win_kernel_time, &win_user_time)) { |
| 57 DWORD error = GetLastError(); |
| 58 DLOG(ERROR) << "Error getting process data" << error; |
| 59 return; |
| 60 } |
| 61 user_duration = base::Time::FromFileTime(win_user_time) - |
| 62 base::Time::Time(); |
| 63 kernel_duration = base::Time::FromFileTime(win_kernel_time) - |
| 64 base::Time::Time(); |
| 65 run_duration = base::Time::FromFileTime(win_exit_time) - |
| 66 base::Time::FromFileTime(win_creation_time); |
| 67 have_process_times = true; |
| 68 #endif // OS_WIN |
| 50 } | 69 } |
| 70 |
| 71 #if defined(OS_WIN) |
| 72 base::TimeDelta kernel_duration; |
| 73 base::TimeDelta user_duration; |
| 74 base::TimeDelta run_duration; |
| 75 bool have_process_times; |
| 76 #endif // OS_WIN |
| 77 |
| 51 base::ProcessHandle handle; | 78 base::ProcessHandle handle; |
| 52 base::TerminationStatus status; | 79 base::TerminationStatus status; |
| 53 int exit_code; | 80 int exit_code; |
| 54 bool was_alive; | 81 bool was_alive; |
| 55 }; | 82 }; |
| 56 | 83 |
| 57 virtual ~RenderProcessHost() {} | 84 virtual ~RenderProcessHost() {} |
| 58 | 85 |
| 59 // Initialize the new renderer process, returning true on success. This must | 86 // Initialize the new renderer process, returning true on success. This must |
| 60 // be called once before the object can be used, but can be called after | 87 // be called once before the object can be used, but can be called after |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // Overrides the default heuristic for limiting the max renderer process | 254 // Overrides the default heuristic for limiting the max renderer process |
| 228 // count. This is useful for unit testing process limit behaviors. | 255 // count. This is useful for unit testing process limit behaviors. |
| 229 // A value of zero means to use the default heuristic. | 256 // A value of zero means to use the default heuristic. |
| 230 static void SetMaxRendererProcessCountForTest(size_t count); | 257 static void SetMaxRendererProcessCountForTest(size_t count); |
| 231 }; | 258 }; |
| 232 | 259 |
| 233 } // namespace content. | 260 } // namespace content. |
| 234 | 261 |
| 235 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 262 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
| 236 | 263 |
| OLD | NEW |