blob: 12d118bd6c77a21672b652e93bb791f877c40518 [file] [log] [blame]
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_UI_DEVTOOLS_DEVTOOLS_PROCESS_OBSERVER_H_
#define COMPONENTS_UI_DEVTOOLS_DEVTOOLS_PROCESS_OBSERVER_H_
#include "base/memory/raw_ptr.h"
#include "base/process/process.h"
#include "components/ui_devtools/devtools_export.h"
#include "content/public/browser/browser_child_process_observer.h"
namespace ui_devtools {
class TracingAgent;
}
// Observer that is notified of browser and gpu processes when they are launched
// and destroyed. This is used to update the process id for event tracing.
class UI_DEVTOOLS_EXPORT DevtoolsProcessObserver
: public content::BrowserChildProcessObserver {
public:
explicit DevtoolsProcessObserver(ui_devtools::TracingAgent* agent);
DevtoolsProcessObserver(const DevtoolsProcessObserver&) = delete;
DevtoolsProcessObserver& operator=(const DevtoolsProcessObserver&) = delete;
~DevtoolsProcessObserver() override;
private:
// content::BrowserChildProcessObserver:
void BrowserChildProcessLaunchedAndConnected(
const content::ChildProcessData& data) override;
void BrowserChildProcessHostDisconnected(
const content::ChildProcessData& data) override;
void BrowserChildProcessCrashed(
const content::ChildProcessData& data,
const content::ChildProcessTerminationInfo& info) override;
void BrowserChildProcessKilled(
const content::ChildProcessData& data,
const content::ChildProcessTerminationInfo& info) override;
raw_ptr<ui_devtools::TracingAgent> tracing_agent_;
};
#endif // COMPONENTS_UI_DEVTOOLS_DEVTOOLS_PROCESS_OBSERVER_H_