Chromium Code Reviews| Index: chrome/browser/task_manager/providers/render_process_host_task_provider.h |
| diff --git a/chrome/browser/task_manager/providers/render_process_host_task_provider.h b/chrome/browser/task_manager/providers/render_process_host_task_provider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..09f00a21c7d5230e12221b8865681545773df222 |
| --- /dev/null |
| +++ b/chrome/browser/task_manager/providers/render_process_host_task_provider.h |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_TASK_MANAGER_PROVIDERS_RENDER_PROCESS_HOST_TASK_PROVIDER_H_ |
| +#define CHROME_BROWSER_TASK_MANAGER_PROVIDERS_RENDER_PROCESS_HOST_TASK_PROVIDER_H_ |
| + |
| +#include <map> |
| +#include <memory> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "chrome/browser/task_manager/providers/task_provider.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| +#include "content/public/browser/notification_service.h" |
| +#include "content/public/browser/render_process_host_observer.h" |
| + |
| +namespace content { |
| +struct ChildProcessData; |
| +} |
| + |
| +namespace task_manager { |
| + |
| +class ChildProcessTask; |
| + |
| +// Defines a provider to provide possibly redundant tasks that represent RPHs |
| +// that are active, this can track interstitial pages and tracks RPHs that have |
|
ncarter (slow)
2017/07/26 21:22:34
"active, this" -> "active. This"
cburn
2017/07/27 19:28:30
Done.
|
| +// service workers still alive in them. |
| +class RenderProcessHostTaskProvider : public TaskProvider, |
| + public content::NotificationObserver { |
| + public: |
| + RenderProcessHostTaskProvider(); |
| + ~RenderProcessHostTaskProvider() override; |
| + |
| + // task_manager::TaskProvider: |
| + Task* GetTaskOfUrlRequest(int origin_pid, |
| + int child_id, |
| + int route_id) override; |
| + |
| + // content::NotificationObserver: |
| + void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) override; |
| + |
| + private: |
| + // task_manager::TaskProvider: |
| + void StartUpdating() override; |
| + void StopUpdating() override; |
| + |
| + // Creates a RenderProcessHostTask from the given |data| and notifies the |
| + // observer of its addition. |
| + void CreateTask(const content::ChildProcessData& data); |
| + |
| + // Deletes a RenderProcessHostTask whose |render_process_host_ID| is provided |
| + // after notifying the observer of its deletion. |
| + void DeleteTask(const int render_process_host_ID); |
|
ncarter (slow)
2017/07/26 21:22:35
"host_ID" -> "host_id".
We lowercase acronyms & i
cburn
2017/07/27 19:28:30
Done.
|
| + |
| + std::map<base::ProcessId, ChildProcessTask*> tasks_by_pid_; |
| + |
| + std::map<int, std::unique_ptr<ChildProcessTask>> tasks_by_rph_id_; |
| + |
| + // Object for registering notification requests. |
| + content::NotificationRegistrar registrar_; |
| + |
| + // Always keep this the last member of this class to make sure it's the |
| + // first thing to be destructed. |
| + base::WeakPtrFactory<RenderProcessHostTaskProvider> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(RenderProcessHostTaskProvider); |
| +}; |
| + |
| +} // namespace task_manager |
| + |
| +#endif // CHROME_BROWSER_TASK_MANAGER_PROVIDERS_RENDER_PROCESS_HOST_TASK_PROVIDER_H_ |