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 | |
19 namespace task_manager { | |
20 | |
21 class ChildProcessTask; | |
22 | |
23 // Defines a provider to provide possibly redundant tasks that represent RPHs | |
24 // that are active. This can track interstitial pages and tracks RPHs that have | |
25 // service workers still alive in them. | |
Charlie Reis
2017/08/02 18:39:14
I think this is a little unclear to people who are
cburn
2017/08/04 16:39:53
I have fixed this in the follow on CL, where the b
| |
26 class RenderProcessHostTaskProvider : public TaskProvider, | |
27 public content::NotificationObserver { | |
28 public: | |
29 RenderProcessHostTaskProvider(); | |
30 ~RenderProcessHostTaskProvider() override; | |
31 | |
32 // task_manager::TaskProvider: | |
33 Task* GetTaskOfUrlRequest(int origin_pid, | |
34 int child_id, | |
35 int route_id) override; | |
36 | |
37 // content::NotificationObserver: | |
38 void Observe(int type, | |
39 const content::NotificationSource& source, | |
40 const content::NotificationDetails& details) override; | |
41 | |
42 private: | |
43 // task_manager::TaskProvider: | |
44 void StartUpdating() override; | |
45 void StopUpdating() override; | |
46 | |
47 // Creates a RenderProcessHostTask from the given |data| and notifies the | |
48 // observer of its addition. | |
49 void CreateTask(const int render_process_host_id); | |
50 | |
51 // Deletes a RenderProcessHostTask whose |render_process_host_ID| is provided | |
Charlie Reis
2017/08/02 18:39:14
nit: Update "ID" here as well.
cburn
2017/08/04 16:39:53
Done.
| |
52 // after notifying the observer of its deletion. | |
53 void DeleteTask(const int render_process_host_id); | |
54 | |
55 std::map<int, std::unique_ptr<ChildProcessTask>> tasks_by_rph_id_; | |
56 | |
57 // Object for registering notification requests. | |
58 content::NotificationRegistrar registrar_; | |
59 | |
60 // Always keep this the last member of this class to make sure it's the | |
61 // first thing to be destructed. | |
62 base::WeakPtrFactory<RenderProcessHostTaskProvider> weak_ptr_factory_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostTaskProvider); | |
65 }; | |
66 | |
67 } // namespace task_manager | |
68 | |
69 #endif // CHROME_BROWSER_TASK_MANAGER_PROVIDERS_RENDER_PROCESS_HOST_TASK_PROVID ER_H_ | |
OLD | NEW |