Commit 701fa21b authored by chiniforooshan's avatar chiniforooshan Committed by Commit bot

Mojofy GpuHostMsg_FieldTrialActivated

Also, a little bit of cleaning mojo interface registration in
gpu_process_host.

BUG=698284

Review-Url: https://codereview.chromium.org/2803743002
Cr-Commit-Position: refs/heads/master@{#462649}
parent be9dfc36
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "cc/base/switches.h" #include "cc/base/switches.h"
#include "content/browser/gpu/gpu_process_host.h" #include "content/browser/gpu/gpu_process_host.h"
#include "content/common/gpu_host_messages.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_data_manager_observer.h" #include "content/public/browser/gpu_data_manager_observer.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h" #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h"
#include "content/browser/service_manager/service_manager_context.h" #include "content/browser/service_manager/service_manager_context.h"
#include "content/common/child_process_host_impl.h" #include "content/common/child_process_host_impl.h"
#include "content/common/gpu_host_messages.h"
#include "content/common/in_process_child_thread_params.h" #include "content/common/in_process_child_thread_params.h"
#include "content/common/service_manager/child_connection.h" #include "content/common/service_manager/child_connection.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
...@@ -66,7 +65,6 @@ ...@@ -66,7 +65,6 @@
#include "media/base/media_switches.h" #include "media/base/media_switches.h"
#include "media/media_features.h" #include "media/media_features.h"
#include "mojo/edk/embedder/embedder.h" #include "mojo/edk/embedder/embedder.h"
#include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
#include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/connection.h" #include "services/service_manager/public/cpp/connection.h"
#include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/public/cpp/interface_provider.h"
...@@ -326,16 +324,7 @@ void HostLoadedShader(int host_id, ...@@ -326,16 +324,7 @@ void HostLoadedShader(int host_id,
class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter {
public: public:
ConnectionFilterImpl() { ConnectionFilterImpl() {
registry_.AddInterface(
base::Bind(
&memory_instrumentation::CoordinatorImpl::BindCoordinatorRequest,
base::Unretained(
memory_instrumentation::CoordinatorImpl::GetInstance())),
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::UI));
#if defined(OS_ANDROID)
GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces(&registry_); GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces(&registry_);
#endif
} }
private: private:
...@@ -680,11 +669,7 @@ void GpuProcessHost::AddFilter(IPC::MessageFilter* filter) { ...@@ -680,11 +669,7 @@ void GpuProcessHost::AddFilter(IPC::MessageFilter* filter) {
bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
DCHECK(CalledOnValidThread()); DCHECK(CalledOnValidThread());
IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) RouteOnUIThread(message);
IPC_MESSAGE_HANDLER(GpuHostMsg_FieldTrialActivated, OnFieldTrialActivated);
IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
IPC_END_MESSAGE_MAP()
return true; return true;
} }
...@@ -809,13 +794,6 @@ void GpuProcessHost::OnDestroyingVideoSurfaceAck() { ...@@ -809,13 +794,6 @@ void GpuProcessHost::OnDestroyingVideoSurfaceAck() {
} }
#endif #endif
void GpuProcessHost::OnFieldTrialActivated(const std::string& trial_name) {
// Activate the trial in the browser process to match its state in the
// GPU process. This is done by calling FindFullName which finalizes the group
// and activates the trial.
base::FieldTrialList::FindFullName(trial_name);
}
void GpuProcessHost::OnProcessLaunched() { void GpuProcessHost::OnProcessLaunched() {
UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime", UMA_HISTOGRAM_TIMES("GPU.GPUProcessLaunchTime",
base::TimeTicks::Now() - init_start_time_); base::TimeTicks::Now() - init_start_time_);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/browser/compositor/gpu_process_transport_factory.h" #include "content/browser/compositor/gpu_process_transport_factory.h"
#include "content/browser/field_trial_recorder.h"
#include "content/browser/gpu/compositor_util.h" #include "content/browser/gpu/compositor_util.h"
#include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/gpu/gpu_process_host.h" #include "content/browser/gpu/gpu_process_host.h"
...@@ -21,9 +22,9 @@ ...@@ -21,9 +22,9 @@
#include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_helper.h" #include "content/browser/renderer_host/render_widget_helper.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/common/gpu_host_messages.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "gpu/ipc/common/memory_stats.h" #include "gpu/ipc/common/memory_stats.h"
#include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
#include "ui/gfx/swap_result.h" #include "ui/gfx/swap_result.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -56,14 +57,6 @@ void BindJavaInterface(mojo::InterfaceRequest<Interface> request) { ...@@ -56,14 +57,6 @@ void BindJavaInterface(mojo::InterfaceRequest<Interface> request) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::GetGlobalJavaInterfaces()->GetInterface(std::move(request)); content::GetGlobalJavaInterfaces()->GetInterface(std::move(request));
} }
// Binder which posts each request to the UI thread.
template <typename Interface>
void BindJavaInterfaceOnUIThread(mojo::InterfaceRequest<Interface> request) {
BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)
->PostTask(FROM_HERE, base::Bind(&BindJavaInterface<Interface>,
base::Passed(&request)));
}
#endif #endif
} // namespace } // namespace
...@@ -144,13 +137,23 @@ GpuProcessHostUIShim::~GpuProcessHostUIShim() { ...@@ -144,13 +137,23 @@ GpuProcessHostUIShim::~GpuProcessHostUIShim() {
g_hosts_by_id.Pointer()->Remove(host_id_); g_hosts_by_id.Pointer()->Remove(host_id_);
} }
#if defined(OS_ANDROID)
// static // static
void GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces( void GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces(
service_manager::BinderRegistry* registry) { service_manager::BinderRegistry* registry) {
registry->AddInterface(base::Bind( auto task_runner = BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
&BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>));
} registry->AddInterface(base::Bind(&FieldTrialRecorder::Create), task_runner);
registry->AddInterface(
base::Bind(
&memory_instrumentation::CoordinatorImpl::BindCoordinatorRequest,
base::Unretained(
memory_instrumentation::CoordinatorImpl::GetInstance())),
task_runner);
#if defined(OS_ANDROID)
registry->AddInterface(
base::Bind(&BindJavaInterface<media::mojom::AndroidOverlayProvider>),
task_runner);
#endif #endif
}
} // namespace content } // namespace content
...@@ -61,11 +61,9 @@ class GpuProcessHostUIShim : public IPC::Listener, ...@@ -61,11 +61,9 @@ class GpuProcessHostUIShim : public IPC::Listener,
// actually received on the IO thread. // actually received on the IO thread.
bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message) override;
#if defined(OS_ANDROID)
// Register Mojo interfaces that must be bound on the UI thread. // Register Mojo interfaces that must be bound on the UI thread.
static void RegisterUIThreadMojoInterfaces( static void RegisterUIThreadMojoInterfaces(
service_manager::BinderRegistry* registry); service_manager::BinderRegistry* registry);
#endif
private: private:
explicit GpuProcessHostUIShim(int host_id); explicit GpuProcessHostUIShim(int host_id);
......
...@@ -135,7 +135,6 @@ ...@@ -135,7 +135,6 @@
#include "content/common/child_process_messages.h" #include "content/common/child_process_messages.h"
#include "content/common/content_switches_internal.h" #include "content/common/content_switches_internal.h"
#include "content/common/frame_messages.h" #include "content/common/frame_messages.h"
#include "content/common/gpu_host_messages.h"
#include "content/common/in_process_child_thread_params.h" #include "content/common/in_process_child_thread_params.h"
#include "content/common/render_process_messages.h" #include "content/common/render_process_messages.h"
#include "content/common/resource_messages.h" #include "content/common/resource_messages.h"
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_input_event_router.h" #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/common/gpu_host_messages.h"
#include "content/common/input_messages.h" #include "content/common/input_messages.h"
#include "content/common/site_isolation_policy.h" #include "content/common/site_isolation_policy.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
......
...@@ -150,7 +150,6 @@ source_set("common") { ...@@ -150,7 +150,6 @@ source_set("common") {
"generic_shared_memory_id_generator.cc", "generic_shared_memory_id_generator.cc",
"generic_shared_memory_id_generator.h", "generic_shared_memory_id_generator.h",
"gin_java_bridge_messages.h", "gin_java_bridge_messages.h",
"gpu_host_messages.h",
"host_shared_bitmap_manager.cc", "host_shared_bitmap_manager.cc",
"host_shared_bitmap_manager.h", "host_shared_bitmap_manager.h",
"in_process_child_thread_params.cc", "in_process_child_thread_params.cc",
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "content/common/fileapi/file_system_messages.h" #include "content/common/fileapi/file_system_messages.h"
#include "content/common/fileapi/webblob_messages.h" #include "content/common/fileapi/webblob_messages.h"
#include "content/common/frame_messages.h" #include "content/common/frame_messages.h"
#include "content/common/gpu_host_messages.h"
#include "content/common/input_messages.h" #include "content/common/input_messages.h"
#include "content/common/manifest_manager_messages.h" #include "content/common/manifest_manager_messages.h"
#include "content/common/media/aec_dump_messages.h" #include "content/common/media/aec_dump_messages.h"
......
// Copyright 2016 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.
// Multiply-included message file, hence no include guard here, but see below
// for a much smaller-than-usual include guard section.
#include "build/build_config.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_start.h"
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
#define IPC_MESSAGE_START GpuMsgStart
//------------------------------------------------------------------------------
// GPU Host Messages
// These are messages to the browser.
// Sent by the GPU process to indicate that a fields trial has been activated.
IPC_MESSAGE_CONTROL1(GpuHostMsg_FieldTrialActivated, std::string /* name */)
...@@ -53,6 +53,7 @@ target(link_target_type, "gpu_sources") { ...@@ -53,6 +53,7 @@ target(link_target_type, "gpu_sources") {
"//content:export", "//content:export",
"//content/child", "//content/child",
"//content/common", "//content/common",
"//content/common:mojo_bindings",
"//content/public/child:child_sources", "//content/public/child:child_sources",
"//content/public/common:common_sources", "//content/public/common:common_sources",
"//gpu:gpu", "//gpu:gpu",
......
...@@ -11,16 +11,18 @@ ...@@ -11,16 +11,18 @@
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/child/child_process.h" #include "content/child/child_process.h"
#include "content/common/gpu_host_messages.h" #include "content/common/field_trial_recorder.mojom.h"
#include "content/gpu/gpu_service_factory.h" #include "content/gpu/gpu_service_factory.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/common/service_manager_connection.h" #include "content/public/common/service_manager_connection.h"
#include "content/public/common/service_names.mojom.h"
#include "content/public/gpu/content_gpu_client.h" #include "content/public/gpu/content_gpu_client.h"
#include "gpu/command_buffer/common/activity_flags.h" #include "gpu/command_buffer/common/activity_flags.h"
#include "gpu/ipc/service/gpu_watchdog_thread.h" #include "gpu/ipc/service/gpu_watchdog_thread.h"
#include "ipc/ipc_sync_message_filter.h" #include "ipc/ipc_sync_message_filter.h"
#include "media/gpu/ipc/service/media_gpu_channel_manager.h" #include "media/gpu/ipc/service/media_gpu_channel_manager.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/interface_registry.h" #include "services/service_manager/public/cpp/interface_registry.h"
#include "services/ui/gpu/interfaces/gpu_service.mojom.h" #include "services/ui/gpu/interfaces/gpu_service.mojom.h"
...@@ -130,7 +132,10 @@ void GpuChildThread::Init(const base::Time& process_start_time) { ...@@ -130,7 +132,10 @@ void GpuChildThread::Init(const base::Time& process_start_time) {
void GpuChildThread::OnFieldTrialGroupFinalized(const std::string& trial_name, void GpuChildThread::OnFieldTrialGroupFinalized(const std::string& trial_name,
const std::string& group_name) { const std::string& group_name) {
Send(new GpuHostMsg_FieldTrialActivated(trial_name)); mojom::FieldTrialRecorderPtr field_trial_recorder;
GetConnector()->BindInterface(mojom::kBrowserServiceName,
&field_trial_recorder);
field_trial_recorder->FieldTrialActivated(trial_name);
} }
void GpuChildThread::CreateGpuMainService( void GpuChildThread::CreateGpuMainService(
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "content/child/child_process.h" #include "content/child/child_process.h"
#include "content/common/content_constants_internal.h" #include "content/common/content_constants_internal.h"
#include "content/common/gpu_host_messages.h"
#include "content/gpu/gpu_child_thread.h" #include "content/gpu/gpu_child_thread.h"
#include "content/gpu/gpu_process.h" #include "content/gpu/gpu_process.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"service_manager:connector": { "service_manager:connector": {
"provides": { "provides": {
"gpu": [ "gpu": [
"content::mojom::FieldTrialRecorder",
"media::mojom::AndroidOverlayProvider", "media::mojom::AndroidOverlayProvider",
"memory_instrumentation::mojom::Coordinator" "memory_instrumentation::mojom::Coordinator"
], ],
......
...@@ -21,7 +21,6 @@ enum IPCMessageStart { ...@@ -21,7 +21,6 @@ enum IPCMessageStart {
NaClMsgStart, NaClMsgStart,
UtilityMsgStart, UtilityMsgStart,
GpuChannelMsgStart, GpuChannelMsgStart,
GpuMsgStart,
MediaMsgStart, MediaMsgStart,
ServiceMsgStart, ServiceMsgStart,
PpapiMsgStart, PpapiMsgStart,
......
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