0
Files
android_webview
apps
ash
base
blink
build
build_overrides
cc
chrome
chrome_cleaner
chrome_elf
chromecast
chromeos
cloud_print
components
content
app
browser
accessibility
android
appcache
background_fetch
background_sync
blob_storage
bluetooth
broadcast_channel
browser_plugin
browsing_data
cache_storage
cocoa
compositor
dedicated_worker
device_sensors
devtools
dom_storage
download
fileapi
frame_host
generic_sensor
geolocation
gpu
hyphenation
image_capture
indexed_db
installedapp
keyboard_lock
loader
locks
manifest
media
memory
net
notifications
origin_manifest
payments
permissions
presentation
push_messaging
renderer_host
resources
screen_orientation
service_manager
service_worker
shape_detection
shared_worker
speech
ssl
streams
tracing
wake_lock
web_contents
web_package
webauth
webrtc
websockets
webui
zygote_host
BUILD.gn
DEPS
OWNERS
PRESUBMIT.py
after_startup_task_utils.cc
after_startup_task_utils.h
bad_message.cc
bad_message.h
battery_monitor_browsertest.cc
bookmarklet_browsertest.cc
browser_associated_interface_unittest.cc
browser_child_process_host_impl.cc
browser_child_process_host_impl.h
browser_context.cc
browser_ipc_logging.cc
browser_main.cc
browser_main.h
browser_main_loop.cc
browser_main_loop.h
browser_main_loop_unittest.cc
browser_main_runner.cc
browser_process_sub_thread.cc
browser_process_sub_thread.h
browser_shutdown_profile_dumper.cc
browser_shutdown_profile_dumper.h
browser_side_navigation_browsertest.cc
browser_thread_impl.cc
browser_thread_impl.h
browser_thread_unittest.cc
browser_url_handler_impl.cc
browser_url_handler_impl.h
browser_url_handler_impl_unittest.cc
browsing_instance.cc
browsing_instance.h
byte_stream.cc
byte_stream.h
byte_stream_unittest.cc
child_process_launcher.cc
child_process_launcher.h
child_process_launcher_browsertest.cc
child_process_launcher_helper.cc
child_process_launcher_helper.h
child_process_launcher_helper_android.cc
child_process_launcher_helper_fuchsia.cc
child_process_launcher_helper_linux.cc
child_process_launcher_helper_mac.cc
child_process_launcher_helper_posix.cc
child_process_launcher_helper_posix.h
child_process_launcher_helper_win.cc
child_process_security_policy_browsertest.cc
child_process_security_policy_impl.cc
child_process_security_policy_impl.h
child_process_security_policy_unittest.cc
context_factory.cc
cross_site_transfer_browsertest.cc
database_browsertest.cc
discardable_shared_memory_manager.cc
do_not_track_browsertest.cc
field_trial_recorder.cc
field_trial_recorder.h
file_url_loader_factory.cc
file_url_loader_factory.h
find_request_manager.cc
find_request_manager.h
find_request_manager_browsertest.cc
font_list_async.cc
generic_sensor_browsertest.cc
histogram_controller.cc
histogram_controller.h
histogram_internals_request_job.cc
histogram_internals_request_job.h
histogram_internals_url_loader.cc
histogram_internals_url_loader.h
histogram_subscriber.h
histogram_synchronizer.cc
histogram_synchronizer.h
host_zoom_level_context.cc
host_zoom_level_context.h
host_zoom_map_impl.cc
host_zoom_map_impl.h
host_zoom_map_impl_browsertest.cc
host_zoom_map_impl_unittest.cc
host_zoom_map_observer.cc
host_zoom_map_observer.h
interface_provider_filtering.cc
interface_provider_filtering.h
isolated_origin_browsertest.cc
isolated_origin_util.cc
isolated_origin_util.h
leveldb_wrapper_impl.cc
leveldb_wrapper_impl.h
leveldb_wrapper_impl_unittest.cc
linux_ipc_browsertest.cc
loader_delegate_impl.cc
loader_delegate_impl.h
mach_broker_mac.h
mach_broker_mac.mm
mach_broker_mac_unittest.cc
message_port_provider.cc
message_port_provider_browsertest.cc
mime_registry_impl.cc
mime_registry_impl.h
mojo_sandbox_browsertest.cc
net_info_browsertest.cc
network_service_browsertest.cc
network_service_client.cc
network_service_client.h
network_service_instance.cc
network_service_restart_browsertest.cc
notification_service_impl.cc
notification_service_impl.h
notification_service_impl_unittest.cc
oop_browsertest.cc
pepper_flash_settings_helper_impl.cc
pepper_flash_settings_helper_impl.h
plugin_content_origin_whitelist.cc
plugin_content_origin_whitelist.h
plugin_data_remover_impl.cc
plugin_data_remover_impl.h
plugin_private_storage_helper.cc
plugin_private_storage_helper.h
plugin_service_impl.cc
plugin_service_impl.h
plugin_service_impl_browsertest.cc
plugin_service_impl_unittest.cc
pointer_lock_browsertest.cc
pointer_lock_browsertest.h
pointer_lock_browsertest_mac.mm
posix_file_descriptor_info_impl.cc
posix_file_descriptor_info_impl.h
posix_file_descriptor_info_impl_unittest.cc
power_monitor_browsertest.cc
ppapi_plugin_process_host.cc
ppapi_plugin_process_host.h
quota_dispatcher_host.cc
quota_dispatcher_host.h
renderer_interface_binders.cc
renderer_interface_binders.h
resolve_proxy_msg_helper.cc
resolve_proxy_msg_helper.h
resolve_proxy_msg_helper_unittest.cc
resource_context_impl.cc
resource_context_impl.h
resource_loading_browsertest.cc
sandbox_host_linux.cc
sandbox_host_linux.h
sandbox_ipc_linux.cc
sandbox_ipc_linux.h
sandbox_parameters_mac.h
sandbox_parameters_mac.mm
scoped_active_url.cc
scoped_active_url.h
security_exploit_browsertest.cc
session_history_browsertest.cc
shareable_file_reference_unittest.cc
site_instance_impl.cc
site_instance_impl.h
site_instance_impl_unittest.cc
site_isolation_policy.cc
site_isolation_policy.h
site_isolation_policy_unittest.cc
site_per_process_browsertest.cc
site_per_process_browsertest.h
site_per_process_hit_test_browsertest.cc
site_per_process_mac_browsertest.mm
snapshot_browsertest.cc
ssl_private_key_impl.cc
ssl_private_key_impl.h
startup_task_runner.cc
startup_task_runner.h
startup_task_runner_unittest.cc
storage_partition_impl.cc
storage_partition_impl.h
storage_partition_impl_browsertest.cc
storage_partition_impl_map.cc
storage_partition_impl_map.h
storage_partition_impl_map_unittest.cc
storage_partition_impl_unittest.cc
theme_helper_mac.h
theme_helper_mac.mm
top_document_isolation_browsertest.cc
url_loader_factory_getter.cc
url_loader_factory_getter.h
utility_process_host_impl.cc
utility_process_host_impl.h
utility_process_host_impl_browsertest.cc
vibration_browsertest.cc
web_contents_binding_set_browsertest.cc
webkit_browsertest.cc
zoom_browsertest.cc
child
common
gpu
ppapi_plugin
public
renderer
shell
test
utility
zygote
BUILD.gn
DEPS
OWNERS
README.md
content_resources.grd
courgette
crypto
dbus
device
docs
extensions
gin
google_apis
google_update
gpu
headless
infra
ios
ipc
jingle
mash
media
mojo
native_client_sdk
net
notification_helper
pdf
ppapi
printing
remoting
rlz
sandbox
services
skia
sql
storage
styleguide
testing
third_party
tools
ui
url
.clang-format
.eslintrc.js
.git-blame-ignore-revs
.gitattributes
.gitignore
.gn
.vpython
AUTHORS
BUILD.gn
CODE_OF_CONDUCT.md
DEPS
ENG_REVIEW_OWNERS
LICENSE
LICENSE.chromium_os
OWNERS
PRESUBMIT.py
PRESUBMIT_test.py
PRESUBMIT_test_mocks.py
README.md
WATCHLISTS
codereview.settings
src/content/browser/browser_ipc_logging.cc
Nicholas Verne 5420564de0 Mojoify control messages for child processes.
Interface ChildControl is implemented by threads in Child processes, e.g.
ChildThreadImpl, RenderThreadImpl.

The ChildControl methods seemed like a good fit for interface Child in
child.mojom, but that interface is empty and implemented by
content::ServiceManagerConnectionImpl::IOThreadContext, not
ChildThreadImpl.

Bug: 775817
Change-Id: Ica5f0e680366c25356f1db7cb3d7091c4305fdba
Reviewed-on: https://chromium-review.googlesource.com/734500
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512115}
2017-10-27 07:37:54 +00:00

59 lines
1.9 KiB
C++

// Copyright (c) 2011 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.
#include "content/public/browser/browser_ipc_logging.h"
#include "base/bind.h"
#include "content/common/child_control.mojom.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/bind_interface_helpers.h"
#include "content/public/common/child_process_host.h"
#include "ipc/ipc_logging.h"
namespace content {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
void EnableIPCLoggingForChildProcesses(bool enabled) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
BrowserChildProcessHostIterator i; // default constr references a singleton
while (!i.Done()) {
mojom::ChildControlPtr child_control;
content::BindInterface(i.GetHost(), &child_control);
child_control->SetIPCLoggingEnabled(enabled);
++i;
}
}
void EnableIPCLogging(bool enable) {
// First enable myself.
if (enable)
IPC::Logging::GetInstance()->Enable();
else
IPC::Logging::GetInstance()->Disable();
// Now tell subprocesses. Messages to ChildProcess-derived
// processes must be done on the IO thread.
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
base::Bind(EnableIPCLoggingForChildProcesses, enable));
// Finally, tell the renderers which don't derive from ChildProcess.
// Messages to the renderers must be done on the UI (main) thread.
for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
!i.IsAtEnd(); i.Advance()) {
mojom::ChildControlPtr child_control;
content::BindInterface(i.GetCurrentValue(), &child_control);
child_control->SetIPCLoggingEnabled(enable);
}
}
#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
} // namespace content