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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 struct RendererClosedDetails { | 42 struct RendererClosedDetails { |
| 43 RendererClosedDetails(base::ProcessHandle handle, | 43 RendererClosedDetails(base::ProcessHandle handle, |
| 44 base::TerminationStatus status, | 44 base::TerminationStatus status, |
| 45 int exit_code, | 45 int exit_code, |
| 46 bool was_alive) { | 46 bool was_alive) { |
| 47 this->handle = handle; | 47 this->handle = handle; |
| 48 this->status = status; | 48 this->status = status; |
| 49 this->exit_code = exit_code; | 49 this->exit_code = exit_code; |
| 50 this->was_alive = was_alive; | 50 this->was_alive = was_alive; |
| 51 } | 51 } |
| 52 | |
| 53 #if defined(OS_WIN) | |
| 54 void RecordProcessStats() { | |
| 55 have_process_times = false; | |
| 56 FILETIME win_creation_time; | |
| 57 FILETIME win_exit_time; | |
| 58 FILETIME win_kernel_time; | |
| 59 FILETIME win_user_time; | |
| 60 if (0 == GetProcessTimes(handle, &win_creation_time, &win_exit_time, | |
| 61 &win_kernel_time, &win_user_time)) { | |
| 62 DWORD error = GetLastError(); | |
| 63 DLOG(ERROR) << "Error getting process data" << error; | |
| 64 } | |
| 65 user_duration = base::Time::FromFileTime(win_user_time) - | |
| 66 base::Time::Time(); | |
| 67 kernel_duration = base::Time::FromFileTime(win_kernel_time) - | |
| 68 base::Time::Time(); | |
| 69 run_duration = base::Time::FromFileTime(win_exit_time) - | |
| 70 base::Time::FromFileTime(win_creation_time); | |
| 71 have_process_times = true; | |
|
rvargas (doing something else)
2012/03/22 01:59:32
We should not set this flag to true (or read the t
jar (doing other things)
2012/03/22 02:06:44
<doh!> I left out my planned early return.
Added
| |
| 72 } | |
| 73 | |
| 74 base::TimeDelta kernel_duration; | |
| 75 base::TimeDelta user_duration; | |
| 76 base::TimeDelta run_duration; | |
| 77 bool have_process_times; | |
| 78 #endif // OS_WIN | |
| 79 | |
| 52 base::ProcessHandle handle; | 80 base::ProcessHandle handle; |
| 53 base::TerminationStatus status; | 81 base::TerminationStatus status; |
| 54 int exit_code; | 82 int exit_code; |
| 55 bool was_alive; | 83 bool was_alive; |
| 56 }; | 84 }; |
| 57 | 85 |
| 58 virtual ~RenderProcessHost() {} | 86 virtual ~RenderProcessHost() {} |
| 59 | 87 |
| 60 // Initialize the new renderer process, returning true on success. This must | 88 // 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 | 89 // 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 | 264 |
| 237 // Returns the current max number of renderer processes used by the content | 265 // Returns the current max number of renderer processes used by the content |
| 238 // module. | 266 // module. |
| 239 static size_t GetMaxRendererProcessCount(); | 267 static size_t GetMaxRendererProcessCount(); |
| 240 }; | 268 }; |
| 241 | 269 |
| 242 } // namespace content. | 270 } // namespace content. |
| 243 | 271 |
| 244 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 272 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
| 245 | 273 |
| OLD | NEW |