Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_TASK_MANAGER_PROVIDERS_RENDER_PROCESS_HOST_TASK_PROVIDER_ H_ | |
| 6 #define CHROME_BROWSER_TASK_MANAGER_PROVIDERS_RENDER_PROCESS_HOST_TASK_PROVIDER_ H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <memory> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "chrome/browser/task_manager/providers/task_provider.h" | |
| 15 #include "content/public/browser/notification_observer.h" | |
| 16 #include "content/public/browser/notification_registrar.h" | |
| 17 #include "content/public/browser/notification_service.h" | |
| 18 #include "content/public/browser/render_process_host_observer.h" | |
| 19 | |
| 20 namespace content { | |
| 21 struct ChildProcessData; | |
| 22 } | |
| 23 | |
| 24 namespace task_manager { | |
| 25 | |
| 26 class ChildProcessTask; | |
| 27 | |
| 28 // Defines a provider to provide possibly redundant tasks that represent RPHs | |
| 29 // 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.
| |
| 30 // service workers still alive in them. | |
| 31 class RenderProcessHostTaskProvider : public TaskProvider, | |
| 32 public content::NotificationObserver { | |
| 33 public: | |
| 34 RenderProcessHostTaskProvider(); | |
| 35 ~RenderProcessHostTaskProvider() override; | |
| 36 | |
| 37 // task_manager::TaskProvider: | |
| 38 Task* GetTaskOfUrlRequest(int origin_pid, | |
| 39 int child_id, | |
| 40 int route_id) override; | |
| 41 | |
| 42 // content::NotificationObserver: | |
| 43 void Observe(int type, | |
| 44 const content::NotificationSource& source, | |
| 45 const content::NotificationDetails& details) override; | |
| 46 | |
| 47 private: | |
| 48 // task_manager::TaskProvider: | |
| 49 void StartUpdating() override; | |
| 50 void StopUpdating() override; | |
| 51 | |
| 52 // Creates a RenderProcessHostTask from the given |data| and notifies the | |
| 53 // observer of its addition. | |
| 54 void CreateTask(const content::ChildProcessData& data); | |
| 55 | |
| 56 // Deletes a RenderProcessHostTask whose |render_process_host_ID| is provided | |
| 57 // after notifying the observer of its deletion. | |
| 58 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.
| |
| 59 | |
| 60 std::map<base::ProcessId, ChildProcessTask*> tasks_by_pid_; | |
| 61 | |
| 62 std::map<int, std::unique_ptr<ChildProcessTask>> tasks_by_rph_id_; | |
| 63 | |
| 64 // Object for registering notification requests. | |
| 65 content::NotificationRegistrar registrar_; | |
| 66 | |
| 67 // Always keep this the last member of this class to make sure it's the | |
| 68 // first thing to be destructed. | |
| 69 base::WeakPtrFactory<RenderProcessHostTaskProvider> weak_ptr_factory_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostTaskProvider); | |
| 72 }; | |
| 73 | |
| 74 } // namespace task_manager | |
| 75 | |
| 76 #endif // CHROME_BROWSER_TASK_MANAGER_PROVIDERS_RENDER_PROCESS_HOST_TASK_PROVID ER_H_ | |
| OLD | NEW |