| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_CHILD_PROCESS_TASK_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_CHILD_PROCESS_TASK_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_CHILD_PROCESS_TASK_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_CHILD_PROCESS_TASK_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 8 #include "chrome/browser/task_management/providers/task.h" | 11 #include "chrome/browser/task_management/providers/task.h" |
| 9 | 12 |
| 10 class ProcessResourceUsage; | 13 class ProcessResourceUsage; |
| 11 | 14 |
| 12 namespace content { | 15 namespace content { |
| 13 struct ChildProcessData; | 16 struct ChildProcessData; |
| 14 } // namespace content | 17 } // namespace content |
| 15 | 18 |
| 16 namespace task_management { | 19 namespace task_management { |
| 17 | 20 |
| 18 // Represents several types of the browser's child processes such as | 21 // Represents several types of the browser's child processes such as |
| 19 // a plugin or a GPU process, ... etc. | 22 // a plugin or a GPU process, ... etc. |
| 20 class ChildProcessTask : public Task { | 23 class ChildProcessTask : public Task { |
| 21 public: | 24 public: |
| 22 // Creates a child process task given its |data| which is | 25 // Creates a child process task given its |data| which is |
| 23 // received from observing |content::BrowserChildProcessObserver|. | 26 // received from observing |content::BrowserChildProcessObserver|. |
| 24 explicit ChildProcessTask(const content::ChildProcessData& data); | 27 explicit ChildProcessTask(const content::ChildProcessData& data); |
| 25 | 28 |
| 26 ~ChildProcessTask() override; | 29 ~ChildProcessTask() override; |
| 27 | 30 |
| 28 // task_management::Task: | 31 // task_management::Task: |
| 29 void Refresh(const base::TimeDelta& update_interval, | 32 void Refresh(const base::TimeDelta& update_interval, |
| 30 int64 refresh_flags) override; | 33 int64_t refresh_flags) override; |
| 31 Type GetType() const override; | 34 Type GetType() const override; |
| 32 int GetChildProcessUniqueID() const override; | 35 int GetChildProcessUniqueID() const override; |
| 33 bool ReportsV8Memory() const; | 36 bool ReportsV8Memory() const; |
| 34 int64 GetV8MemoryAllocated() const override; | 37 int64_t GetV8MemoryAllocated() const override; |
| 35 int64 GetV8MemoryUsed() const override; | 38 int64_t GetV8MemoryUsed() const override; |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 // The Mojo service wrapper that will provide us with the V8 memory usage of | 41 // The Mojo service wrapper that will provide us with the V8 memory usage of |
| 39 // the browser child process represented by this object. | 42 // the browser child process represented by this object. |
| 40 scoped_ptr<ProcessResourceUsage> process_resources_sampler_; | 43 scoped_ptr<ProcessResourceUsage> process_resources_sampler_; |
| 41 | 44 |
| 42 // The allocated and used V8 memory (in bytes). | 45 // The allocated and used V8 memory (in bytes). |
| 43 int64 v8_memory_allocated_; | 46 int64_t v8_memory_allocated_; |
| 44 int64 v8_memory_used_; | 47 int64_t v8_memory_used_; |
| 45 | 48 |
| 46 // The unique ID of the child process. It is not the PID of the process. | 49 // The unique ID of the child process. It is not the PID of the process. |
| 47 // See |content::ChildProcessData::id|. | 50 // See |content::ChildProcessData::id|. |
| 48 const int unique_child_process_id_; | 51 const int unique_child_process_id_; |
| 49 | 52 |
| 50 // The type of the child process. See |content::ProcessType| and | 53 // The type of the child process. See |content::ProcessType| and |
| 51 // |NaClTrustedProcessType|. | 54 // |NaClTrustedProcessType|. |
| 52 const int process_type_; | 55 const int process_type_; |
| 53 | 56 |
| 54 // Depending on the |process_type_|, determines whether this task uses V8 | 57 // Depending on the |process_type_|, determines whether this task uses V8 |
| 55 // memory or not. | 58 // memory or not. |
| 56 const bool uses_v8_memory_; | 59 const bool uses_v8_memory_; |
| 57 | 60 |
| 58 DISALLOW_COPY_AND_ASSIGN(ChildProcessTask); | 61 DISALLOW_COPY_AND_ASSIGN(ChildProcessTask); |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 } // namespace task_management | 64 } // namespace task_management |
| 62 | 65 |
| 63 | 66 |
| 64 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_CHILD_PROCESS_TASK_H_ | 67 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_CHILD_PROCESS_TASK_H_ |
| OLD | NEW |