| 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 #include "chrome/browser/task_management/providers/task.h" | 5 #include "chrome/browser/task_management/providers/task.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/profiles/profile_info_cache.h" | 9 #include "chrome/browser/profiles/profile_info_cache.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| 11 #include "chrome/browser/task_management/task_manager_observer.h" | 11 #include "chrome/browser/task_management/task_manager_observer.h" |
| 12 | 12 |
| 13 namespace task_management { | 13 namespace task_management { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // The last ID given to the previously created task. | 17 // The last ID given to the previously created task. |
| 18 int64 g_last_id = 0; | 18 int64 g_last_id = 0; |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 | 22 |
| 23 Task::Task(const base::string16& title, | 23 Task::Task(const base::string16& title, |
| 24 const std::string& rappor_sample, |
| 24 const gfx::ImageSkia* icon, | 25 const gfx::ImageSkia* icon, |
| 25 base::ProcessHandle handle) | 26 base::ProcessHandle handle) |
| 26 : task_id_(g_last_id++), | 27 : task_id_(g_last_id++), |
| 27 network_usage_(-1), | 28 network_usage_(-1), |
| 28 current_byte_count_(-1), | 29 current_byte_count_(-1), |
| 29 title_(title), | 30 title_(title), |
| 31 rappor_sample_name_(rappor_sample), |
| 30 icon_(icon ? *icon : gfx::ImageSkia()), | 32 icon_(icon ? *icon : gfx::ImageSkia()), |
| 31 process_handle_(handle), | 33 process_handle_(handle), |
| 32 process_id_(base::GetProcId(handle)) { | 34 process_id_(base::GetProcId(handle)) { |
| 33 } | 35 } |
| 34 | 36 |
| 35 Task::~Task() { | 37 Task::~Task() { |
| 36 } | 38 } |
| 37 | 39 |
| 38 // static | 40 // static |
| 39 base::string16 Task::GetProfileNameFromProfile(Profile* profile) { | 41 base::string16 Task::GetProfileNameFromProfile(Profile* profile) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 105 |
| 104 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const { | 106 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const { |
| 105 return blink::WebCache::ResourceTypeStats(); | 107 return blink::WebCache::ResourceTypeStats(); |
| 106 } | 108 } |
| 107 | 109 |
| 108 bool Task::ReportsNetworkUsage() const { | 110 bool Task::ReportsNetworkUsage() const { |
| 109 return network_usage_ != -1; | 111 return network_usage_ != -1; |
| 110 } | 112 } |
| 111 | 113 |
| 112 } // namespace task_management | 114 } // namespace task_management |
| OLD | NEW |