
This CL adds empty network service out of process for measuring memory impact on Android. The empty network service lives on new utility process and virtually does nothing (implementation is ~20 lines of code in c/u/services.cc.) The empty service is enabled only if the canonical network service is in process to see additional process overhead on Android. Bug: 1395707 Change-Id: Ieb0902a87134d1ae0af56f6b9d7940944863e450 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4374282 Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> Commit-Queue: Yoichi Osato <yoichio@chromium.org> Cr-Commit-Position: refs/heads/main@{#1143838}
61 lines
2.0 KiB
C++
61 lines
2.0 KiB
C++
// 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 CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_
|
|
#define CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_
|
|
|
|
#include "base/callback_list.h"
|
|
#include "base/functional/callback.h"
|
|
#include "build/build_config.h"
|
|
#include "content/common/content_export.h"
|
|
|
|
#if BUILDFLAG(IS_ANDROID)
|
|
namespace network::mojom {
|
|
class EmptyNetworkService;
|
|
} // namespace network::mojom
|
|
#endif
|
|
|
|
namespace content {
|
|
|
|
// Creates the network::NetworkService object on the IO thread directly instead
|
|
// of trying to go through the ServiceManager.
|
|
// This also calls ForceInProcessNetworkService().
|
|
CONTENT_EXPORT void ForceCreateNetworkServiceDirectlyForTesting();
|
|
|
|
// Resets the interface ptr to the network service.
|
|
CONTENT_EXPORT void ResetNetworkServiceForTesting();
|
|
|
|
// Registers |handler| to run (on UI thread) after mojo::Remote<NetworkService>
|
|
// encounters an error. Note that there are no ordering guarantees wrt error
|
|
// handlers for other interfaces (e.g. mojo::Remote<NetworkContext> and/or
|
|
// mojo::Remote<URLLoaderFactory>).
|
|
//
|
|
// Can only be called on the UI thread. No-op if NetworkService is disabled.
|
|
CONTENT_EXPORT base::CallbackListSubscription
|
|
RegisterNetworkServiceCrashHandler(base::RepeatingClosure handler);
|
|
|
|
constexpr char kSSLKeyLogFileHistogram[] = "Net.SSLKeyLogFileUse";
|
|
|
|
// These values are persisted to logs. Entries should not be renumbered and
|
|
// numeric values should never be reused.
|
|
enum class SSLKeyLogFileAction {
|
|
kLogFileEnabled = 0,
|
|
kSwitchFound = 1,
|
|
kEnvVarFound = 2,
|
|
kMaxValue = kEnvVarFound,
|
|
};
|
|
|
|
// Shuts down the in-process network service or disconnects from the out-of-
|
|
// process one, allowing it to shut down.
|
|
CONTENT_EXPORT void ShutDownNetworkService();
|
|
|
|
#if BUILDFLAG(IS_ANDROID)
|
|
CONTENT_EXPORT network::mojom::EmptyNetworkService*
|
|
GetEmptyNetworkServiceForTesting();
|
|
#endif
|
|
|
|
} // namespace content
|
|
|
|
#endif // CONTENT_BROWSER_NETWORK_SERVICE_INSTANCE_IMPL_H_
|