Commit a75606f0 authored by Daniel Cheng's avatar Daniel Cheng Committed by Commit Bot

[EnableIf] Guard some more mojo methods in //content/common

Bug: 676224
Change-Id: I9b0c8266d1b45fa0371cea4fc0cd94e9909b6534
Reviewed-on: https://chromium-review.googlesource.com/957863
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542734}
parent 0ba7b226
......@@ -216,9 +216,9 @@ void RenderMessageFilter::SetThreadPriorityOnFileThread(
}
#endif
#if defined(OS_LINUX)
void RenderMessageFilter::SetThreadPriority(int32_t ns_tid,
base::ThreadPriority priority) {
#if defined(OS_LINUX)
constexpr base::TaskTraits kTraits = {
base::MayBlock(), base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN};
......@@ -226,10 +226,8 @@ void RenderMessageFilter::SetThreadPriority(int32_t ns_tid,
FROM_HERE, kTraits,
base::BindOnce(&RenderMessageFilter::SetThreadPriorityOnFileThread, this,
static_cast<base::PlatformThreadId>(ns_tid), priority));
#else
mojo::ReportBadMessage("SetThreadPriority is only supported on OS_LINUX");
#endif
}
#endif
void RenderMessageFilter::DidGenerateCacheableMetadata(
const GURL& url,
......
......@@ -113,8 +113,10 @@ class CONTENT_EXPORT RenderMessageFilter
const url::Origin& cache_storage_origin,
const std::string& cache_storage_cache_name) override;
void HasGpuProcess(HasGpuProcessCallback callback) override;
#if defined(OS_LINUX)
void SetThreadPriority(int32_t ns_tid,
base::ThreadPriority priority) override;
#endif
void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
......
......@@ -776,14 +776,14 @@ void ChildThreadImpl::ProcessShutdown() {
base::RunLoop::QuitCurrentWhenIdleDeprecated();
}
void ChildThreadImpl::SetIPCLoggingEnabled(bool enable) {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
void ChildThreadImpl::SetIPCLoggingEnabled(bool enable) {
if (enable)
IPC::Logging::GetInstance()->Enable();
else
IPC::Logging::GetInstance()->Disable();
#endif // IPC_MESSAGE_LOG_ENABLED
}
#endif // IPC_MESSAGE_LOG_ENABLED
void ChildThreadImpl::OnChildControlRequest(
mojom::ChildControlRequest request) {
......
......@@ -158,7 +158,9 @@ class CONTENT_EXPORT ChildThreadImpl
// mojom::ChildControl
void ProcessShutdown() override;
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
void SetIPCLoggingEnabled(bool enable) override;
#endif
void OnChildControlRequest(mojom::ChildControlRequest);
virtual bool OnControlMessageReceived(const IPC::Message& msg);
......
......@@ -6,6 +6,7 @@ import("features.gni")
import("//build/buildflag_header.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//ipc/features.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//ppapi/features/features.gni")
......@@ -596,6 +597,14 @@ mojom("mojo_bindings") {
sources += [ "font_loader_mac.mojom" ]
}
enabled_features = []
if (enable_ipc_logging) {
enabled_features += [ "ipc_logging" ]
}
if (is_linux || is_chromeos) {
enabled_features += [ "supports_thread_priorities" ]
}
import_dirs = [ "//mojo/services" ]
public_deps = [
......
......@@ -9,5 +9,6 @@ interface ChildControl {
ProcessShutdown();
// Tell the child process to begin or end IPC message logging.
[EnableIf=ipc_logging]
SetIPCLoggingEnabled(bool on);
};
......@@ -41,7 +41,7 @@ interface RenderMessageFilter {
[Sync] HasGpuProcess() => (bool has_gpu_process);
// Asks the browser to change the priority of thread.
// (Linux only, NOP on other platforms.)
[EnableIf=supports_thread_priorities]
SetThreadPriority(int32 platform_thread_id,
mojo.common.mojom.ThreadPriority thread_priority);
};
......@@ -248,7 +248,6 @@ interface Renderer {
// Tells the renderer process to enter or leave background mode.
// TODO(crbug:676224) Make this conditional on IPC_MESSAGE_LOG_ENABLED.
SetProcessBackgrounded(bool background);
// Tells the scheduler about "keep-alive" state which can be due to:
......
......@@ -86,8 +86,10 @@ class MockRenderMessageFilterImpl : public mojom::RenderMessageFilter {
std::move(callback).Run(false);
}
#if defined(OS_LINUX)
void SetThreadPriority(int32_t platform_thread_id,
base::ThreadPriority thread_priority) override {}
#endif
private:
MockRenderThread* const thread_;
......
......@@ -4,16 +4,12 @@
import("//build/buildflag_header.gni")
import("//build/config/nacl/config.gni")
import("//ipc/features.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/test.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
import("//third_party/protobuf/proto_library.gni")
declare_args() {
# Enabling debug builds automatically sets enable_ipc_logging to true.
enable_ipc_logging = is_debug
}
buildflag_header("ipc_features") {
header = "ipc_features.h"
......
# Copyright 2018 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.
declare_args() {
# Enabling debug builds automatically sets enable_ipc_logging to true.
enable_ipc_logging = is_debug
}
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