| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_manager/task_manager_worker_resource_provider.h" | 5 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void UpdateProcessHandle(base::ProcessHandle handle); | 45 void UpdateProcessHandle(base::ProcessHandle handle); |
| 46 base::ProcessHandle handle() const { return handle_; } | 46 base::ProcessHandle handle() const { return handle_; } |
| 47 int process_id() const { return process_id_; } | 47 int process_id() const { return process_id_; } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 // TaskManager::Resource methods: | 50 // TaskManager::Resource methods: |
| 51 virtual string16 GetTitle() const OVERRIDE; | 51 virtual string16 GetTitle() const OVERRIDE; |
| 52 virtual string16 GetProfileName() const OVERRIDE; | 52 virtual string16 GetProfileName() const OVERRIDE; |
| 53 virtual SkBitmap GetIcon() const OVERRIDE; | 53 virtual SkBitmap GetIcon() const OVERRIDE; |
| 54 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 54 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 55 virtual int GetUniqueChildProcessId() const OVERRIDE; |
| 55 virtual Type GetType() const OVERRIDE; | 56 virtual Type GetType() const OVERRIDE; |
| 56 virtual bool CanInspect() const OVERRIDE; | 57 virtual bool CanInspect() const OVERRIDE; |
| 57 virtual void Inspect() const OVERRIDE; | 58 virtual void Inspect() const OVERRIDE; |
| 58 | 59 |
| 59 virtual bool SupportNetworkUsage() const OVERRIDE; | 60 virtual bool SupportNetworkUsage() const OVERRIDE; |
| 60 virtual void SetSupportNetworkUsage() OVERRIDE; | 61 virtual void SetSupportNetworkUsage() OVERRIDE; |
| 61 | 62 |
| 62 int process_id_; | 63 int process_id_; |
| 63 int routing_id_; | 64 int routing_id_; |
| 64 string16 title_; | 65 string16 title_; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); | 113 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); |
| 113 // TODO(jabdelmalek): use different icon for web workers. | 114 // TODO(jabdelmalek): use different icon for web workers. |
| 114 } | 115 } |
| 115 return *default_icon_; | 116 return *default_icon_; |
| 116 } | 117 } |
| 117 | 118 |
| 118 base::ProcessHandle TaskManagerSharedWorkerResource::GetProcess() const { | 119 base::ProcessHandle TaskManagerSharedWorkerResource::GetProcess() const { |
| 119 return handle_; | 120 return handle_; |
| 120 } | 121 } |
| 121 | 122 |
| 123 int TaskManagerSharedWorkerResource::GetUniqueChildProcessId() const { |
| 124 return process_id_; |
| 125 } |
| 126 |
| 122 TaskManager::Resource::Type TaskManagerSharedWorkerResource::GetType() const { | 127 TaskManager::Resource::Type TaskManagerSharedWorkerResource::GetType() const { |
| 123 return WORKER; | 128 return WORKER; |
| 124 } | 129 } |
| 125 | 130 |
| 126 bool TaskManagerSharedWorkerResource::CanInspect() const { | 131 bool TaskManagerSharedWorkerResource::CanInspect() const { |
| 127 return true; | 132 return true; |
| 128 } | 133 } |
| 129 | 134 |
| 130 void TaskManagerSharedWorkerResource::Inspect() const { | 135 void TaskManagerSharedWorkerResource::Inspect() const { |
| 131 // TODO(yurys): would be better to get profile from one of the tabs connected | 136 // TODO(yurys): would be better to get profile from one of the tabs connected |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 int process_id = resource->process_id(); | 355 int process_id = resource->process_id(); |
| 351 launching_workers_[process_id].push_back(resource); | 356 launching_workers_[process_id].push_back(resource); |
| 352 } else { | 357 } else { |
| 353 task_manager_->AddResource(resource); | 358 task_manager_->AddResource(resource); |
| 354 } | 359 } |
| 355 } | 360 } |
| 356 | 361 |
| 357 void TaskManagerWorkerResourceProvider::DeleteAllResources() { | 362 void TaskManagerWorkerResourceProvider::DeleteAllResources() { |
| 358 STLDeleteElements(&resources_); | 363 STLDeleteElements(&resources_); |
| 359 } | 364 } |
| OLD | NEW |