Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8385)

Unified Diff: chrome/browser/task_manager/providers/render_process_host_task_provider.h

Issue 2988453002: Task manager tracking RenderProcessHosts processes (Closed)
Patch Set: fixed copy past cruft Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9b9fd7c01e93a2c2017d39fd6996151c2b4f8b2b
--- /dev/null
+++ b/chrome/browser/task_manager/providers/render_process_host_task_provider.h
@@ -0,0 +1,69 @@
+// 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"
+
+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
+// 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
+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 int render_process_host_id);
+
+ // 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.
+ // after notifying the observer of its deletion.
+ void DeleteTask(const int render_process_host_id);
+
+ 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_

Powered by Google App Engine
This is Rietveld 408576698