Commit a6a3233f authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Remove unused UtilityProcessHostClient

Nobody has used this for years, so it should be safe to remove.

Change-Id: I59d361640801e2677a16f0b80be21b41296d2c91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1655979
Auto-Submit: Clark DuVall <cduvall@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668507}
parent fdfc998a
......@@ -11,7 +11,6 @@
#include "base/run_loop.h"
#include "base/task/post_task.h"
#include "content/browser/utility_process_host.h"
#include "content/browser/utility_process_host_client.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/bind_interface_helpers.h"
......@@ -53,7 +52,7 @@ class MojoSandboxTest : public ContentBrowserTest {
private:
void StartUtilityProcessOnIoThread() {
host_.reset(new UtilityProcessHost(nullptr, nullptr));
host_.reset(new UtilityProcessHost());
host_->SetMetricsName("mojo_sandbox_test_process");
ASSERT_TRUE(host_->Start());
}
......
......@@ -9,7 +9,6 @@
#include "base/task/post_task.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/utility_process_host.h"
#include "content/browser/utility_process_host_client.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_service_registry.h"
......@@ -46,9 +45,7 @@ void VerifyPowerStateInChildProcess(mojom::PowerMonitorTest* power_monitor_test,
}
void StartUtilityProcessOnIOThread(mojom::PowerMonitorTestRequest request) {
UtilityProcessHost* host =
new UtilityProcessHost(/*client=*/nullptr,
/*client_task_runner=*/nullptr);
UtilityProcessHost* host = new UtilityProcessHost();
host->SetMetricsName("test_process");
host->SetName(base::ASCIIToUTF16("TestProcess"));
EXPECT_TRUE(host->Start());
......
......@@ -32,7 +32,6 @@
#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/service_manager/common_browser_interfaces.h"
#include "content/browser/utility_process_host.h"
#include "content/browser/utility_process_host_client.h"
#include "content/browser/wake_lock/wake_lock_context_host.h"
#include "content/common/service_manager/service_manager_connection_impl.h"
#include "content/public/app/content_browser_manifest.h"
......@@ -195,7 +194,7 @@ class ContentChildServiceProcessHost
}
// Start a new process for this service.
UtilityProcessHost* process_host = new UtilityProcessHost(nullptr, nullptr);
UtilityProcessHost* process_host = new UtilityProcessHost();
process_host->SetName(display_name);
process_host->SetMetricsName(identity.name());
process_host->SetServiceIdentity(identity);
......
......@@ -20,7 +20,6 @@
#include "content/browser/browser_child_process_host_impl.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/service_manager/service_manager_context.h"
#include "content/browser/utility_process_host_client.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/in_process_child_thread_params.h"
#include "content/common/service_manager/child_connection.h"
......@@ -207,12 +206,8 @@ void UtilityProcessHost::RegisterUtilityMainThreadFactory(
g_utility_main_thread_factory = create;
}
UtilityProcessHost::UtilityProcessHost(
const scoped_refptr<UtilityProcessHostClient>& client,
const scoped_refptr<base::SequencedTaskRunner>& client_task_runner)
: client_(client),
client_task_runner_(client_task_runner),
sandbox_type_(service_manager::SANDBOX_TYPE_UTILITY),
UtilityProcessHost::UtilityProcessHost()
: sandbox_type_(service_manager::SANDBOX_TYPE_UTILITY),
#if defined(OS_LINUX)
child_flags_(ChildProcessHost::CHILD_ALLOW_SELF),
#else
......@@ -455,15 +450,6 @@ bool UtilityProcessHost::StartProcess() {
}
bool UtilityProcessHost::OnMessageReceived(const IPC::Message& message) {
if (!client_.get())
return true;
client_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
base::IgnoreResult(&UtilityProcessHostClient::OnMessageReceived),
client_.get(), message));
return true;
}
......@@ -479,23 +465,9 @@ void UtilityProcessHost::OnProcessLaunchFailed(int error_code) {
for (auto& callback : pending_run_service_callbacks_)
std::move(callback).Run(base::nullopt);
pending_run_service_callbacks_.clear();
if (!client_.get())
return;
client_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&UtilityProcessHostClient::OnProcessLaunchFailed, client_,
error_code));
}
void UtilityProcessHost::OnProcessCrashed(int exit_code) {
if (!client_.get())
return;
client_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&UtilityProcessHostClient::OnProcessCrashed,
client_, exit_code));
}
} // namespace content
......@@ -27,14 +27,12 @@
#include "services/service_manager/sandbox/sandbox_type.h"
namespace base {
class SequencedTaskRunner;
class Thread;
} // namespace base
namespace content {
class BrowserChildProcessHostImpl;
class InProcessChildThreadParams;
class UtilityProcessHostClient;
struct ChildProcessData;
typedef base::Thread* (*UtilityMainThreadFactoryFunction)(
......@@ -60,13 +58,7 @@ class CONTENT_EXPORT UtilityProcessHost
static void RegisterUtilityMainThreadFactory(
UtilityMainThreadFactoryFunction create);
// |client| is optional. If supplied it will be notified of incoming messages
// from the utility process.
// |client_task_runner| is required if |client| is supplied and is the task
// runner upon which |client| will be invoked.
UtilityProcessHost(
const scoped_refptr<UtilityProcessHostClient>& client,
const scoped_refptr<base::SequencedTaskRunner>& client_task_runner);
UtilityProcessHost();
~UtilityProcessHost() override;
base::WeakPtr<UtilityProcessHost> AsWeakPtr();
......@@ -124,12 +116,6 @@ class CONTENT_EXPORT UtilityProcessHost
void OnProcessLaunchFailed(int error_code) override;
void OnProcessCrashed(int exit_code) override;
// Pointer to our client interface used for progress notifications.
scoped_refptr<UtilityProcessHostClient> client_;
// Task runner used for posting progess notifications to |client_|.
scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
// Launch the child process with switches that will setup this sandbox type.
service_manager::SandboxType sandbox_type_;
......
......@@ -8,7 +8,6 @@
#include "base/task/post_task.h"
#include "build/build_config.h"
#include "content/browser/utility_process_host.h"
#include "content/browser/utility_process_host_client.h"
#include "content/public/browser/browser_child_process_observer.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
......@@ -64,9 +63,7 @@ class UtilityProcessHostBrowserTest : public BrowserChildProcessObserver,
void RunUtilityProcessOnIOThread(bool elevated, bool crash) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
UtilityProcessHost* host =
new UtilityProcessHost(/*client=*/nullptr,
/*client_task_runner=*/nullptr);
UtilityProcessHost* host = new UtilityProcessHost();
host->SetName(base::ASCIIToUTF16("TestProcess"));
host->SetMetricsName(kTestProcessName);
#if defined(OS_WIN)
......
// Copyright (c) 2012 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 CONTENT_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_
#define CONTENT_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
namespace IPC {
class Message;
}
namespace content {
// An interface to be implemented by consumers of the utility process to
// get results back. All functions are called on the thread passed along
// to UtilityProcessHost.
class UtilityProcessHostClient
: public base::RefCountedThreadSafe<UtilityProcessHostClient> {
public:
// Called when the process has crashed.
virtual void OnProcessCrashed(int exit_code) {}
// Called when the process fails to launch. |error_code| is one of
// LaunchResultCode or sandbox::ResultCode containing the error.
virtual void OnProcessLaunchFailed(int error_code) {}
// Allow the client to filter IPC messages.
virtual bool OnMessageReceived(const IPC::Message& message) = 0;
protected:
friend class base::RefCountedThreadSafe<UtilityProcessHostClient>;
virtual ~UtilityProcessHostClient() {}
};
} // namespace content
#endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_CLIENT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment