| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child_process_resource_provider.h" | 5 #include "chrome/browser/task_manager/child_process_resource_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "chrome/browser/process_resource_usage.h" | 15 #include "chrome/browser/process_resource_usage.h" |
| 16 #include "chrome/browser/task_manager/resource_provider.h" | 16 #include "chrome/browser/task_manager/resource_provider.h" |
| 17 #include "chrome/browser/task_manager/task_manager.h" | 17 #include "chrome/browser/task_manager/task_manager.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "components/nacl/common/nacl_process_type.h" | 19 #include "components/nacl/common/nacl_process_type.h" |
| 20 #include "content/public/browser/browser_child_process_host.h" | 20 #include "content/public/browser/browser_child_process_host.h" |
| 21 #include "content/public/browser/browser_child_process_host_iterator.h" | 21 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/child_process_data.h" | 23 #include "content/public/browser/child_process_data.h" |
| 24 #include "content/public/common/service_registry.h" | |
| 25 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 25 #include "services/shell/public/cpp/interface_provider.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/gfx/image/image_skia.h" | 28 #include "ui/gfx/image/image_skia.h" |
| 29 | 29 |
| 30 using content::BrowserChildProcessHostIterator; | 30 using content::BrowserChildProcessHostIterator; |
| 31 using content::BrowserThread; | 31 using content::BrowserThread; |
| 32 using content::WebContents; | 32 using content::WebContents; |
| 33 | 33 |
| 34 namespace task_manager { | 34 namespace task_manager { |
| 35 | 35 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 gfx::ImageSkia* ChildProcessResource::default_icon_ = NULL; | 87 gfx::ImageSkia* ChildProcessResource::default_icon_ = NULL; |
| 88 | 88 |
| 89 // static | 89 // static |
| 90 void ChildProcessResource::ConnectResourceReporterOnIOThread( | 90 void ChildProcessResource::ConnectResourceReporterOnIOThread( |
| 91 int id, | 91 int id, |
| 92 mojo::InterfaceRequest<mojom::ResourceUsageReporter> req) { | 92 mojo::InterfaceRequest<mojom::ResourceUsageReporter> req) { |
| 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 94 content::BrowserChildProcessHost* host = | 94 content::BrowserChildProcessHost* host = |
| 95 content::BrowserChildProcessHost::FromID(id); | 95 content::BrowserChildProcessHost::FromID(id); |
| 96 if (!host) | 96 if (host) |
| 97 return; | 97 host->GetRemoteInterfaces()->GetInterface(std::move(req)); |
| 98 | |
| 99 content::ServiceRegistry* registry = host->GetServiceRegistry(); | |
| 100 if (!registry) | |
| 101 return; | |
| 102 | |
| 103 registry->ConnectToRemoteService(std::move(req)); | |
| 104 } | 98 } |
| 105 | 99 |
| 106 ChildProcessResource::ChildProcessResource(int process_type, | 100 ChildProcessResource::ChildProcessResource(int process_type, |
| 107 const base::string16& name, | 101 const base::string16& name, |
| 108 base::ProcessHandle handle, | 102 base::ProcessHandle handle, |
| 109 int unique_process_id) | 103 int unique_process_id) |
| 110 : process_type_(process_type), | 104 : process_type_(process_type), |
| 111 name_(name), | 105 name_(name), |
| 112 handle_(handle), | 106 handle_(handle), |
| 113 unique_process_id_(unique_process_id), | 107 unique_process_id_(unique_process_id), |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 // This is called on the UI thread. | 381 // This is called on the UI thread. |
| 388 void ChildProcessResourceProvider::ChildProcessDataRetreived( | 382 void ChildProcessResourceProvider::ChildProcessDataRetreived( |
| 389 const std::vector<content::ChildProcessData>& child_processes) { | 383 const std::vector<content::ChildProcessData>& child_processes) { |
| 390 for (size_t i = 0; i < child_processes.size(); ++i) | 384 for (size_t i = 0; i < child_processes.size(); ++i) |
| 391 AddToTaskManager(child_processes[i]); | 385 AddToTaskManager(child_processes[i]); |
| 392 | 386 |
| 393 task_manager_->model()->NotifyDataReady(); | 387 task_manager_->model()->NotifyDataReady(); |
| 394 } | 388 } |
| 395 | 389 |
| 396 } // namespace task_manager | 390 } // namespace task_manager |
| OLD | NEW |