summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfsamuel <fsamuel@chromium.org>2016-03-17 05:15:43 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-17 12:17:26 +0000
commit68efb4803bf77935194d31ca1d93e639282cd7b5 (patch)
tree5c60c58395389131750b55bd4f0c9a27c2d40f15
parent2ba81b5fd3b9584c8839b0478242ea0b9adb57b8 (diff)
downloadchromium_src-68efb4803bf77935194d31ca1d93e639282cd7b5.zip
chromium_src-68efb4803bf77935194d31ca1d93e639282cd7b5.tar.gz
chromium_src-68efb4803bf77935194d31ca1d93e639282cd7b5.tar.bz2
gpu_host_messages.h => content/gpu
gpu_host_messages consists of host <=> gpu IPC messages and is browser specific. Thus, for the time being, it makes sense to keep this file in content. The rest of content/common/gpu is moving to gpu/ipc. Thus, we are moving gpu_host_messages to content/gpu. GpuHostMsg_EstablishGpuChannel, and GpuHostMsg_HasGpuProcess didn't fit in with the rest of gpu_host_messages because they are renderer => browser messages. Thus this CL also moves those oddball IPCs to child_process_messsages.h. Some traits are used by both child_process_messages and gpu_host_messages. I've moved those traits to content/common/gpu/gpu_param_traits_macros.h. BUG=586365 Review URL: https://codereview.chromium.org/1799713002 Cr-Commit-Position: refs/heads/master@{#381693}
-rw-r--r--content/browser/BUILD.gn1
-rw-r--r--content/browser/DEPS1
-rw-r--r--content/browser/gpu/gpu_data_manager_impl_private.cc2
-rw-r--r--content/browser/gpu/gpu_process_host.cc2
-rw-r--r--content/browser/gpu/gpu_process_host_ui_shim.cc2
-rw-r--r--content/browser/renderer_host/gpu_message_filter.cc110
-rw-r--r--content/browser/renderer_host/gpu_message_filter.h58
-rw-r--r--content/browser/renderer_host/render_message_filter.cc78
-rw-r--r--content/browser/renderer_host/render_message_filter.h16
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc7
-rw-r--r--content/browser/renderer_host/render_process_host_impl.h9
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc2
-rw-r--r--content/common/child_process_messages.h40
-rw-r--r--content/common/content_message_generator.h1
-rw-r--r--content/common/content_param_traits_macros.h1
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.cc1
-rw-r--r--content/common/gpu/client/gpu_channel_host.cc1
-rw-r--r--content/common/gpu/gpu_messages.h100
-rw-r--r--content/common/gpu/gpu_param_traits.cc27
-rw-r--r--content/common/gpu/gpu_param_traits.h10
-rw-r--r--content/common/gpu/gpu_param_traits_macros.h140
-rw-r--r--content/common/gpu/media/media_messages.h22
-rw-r--r--content/content.gyp3
-rw-r--r--content/content_browser.gypi2
-rw-r--r--content/content_common.gypi3
-rw-r--r--content/content_gpu.gypi4
-rw-r--r--content/gpu/BUILD.gn6
-rw-r--r--content/gpu/content_gpu_message_generator.cc33
-rw-r--r--content/gpu/content_gpu_message_generator.h7
-rw-r--r--content/gpu/gpu_child_thread.cc2
-rw-r--r--content/gpu/gpu_host_messages.h (renamed from content/common/gpu/gpu_host_messages.h)23
-rw-r--r--content/gpu/gpu_main.cc2
-rw-r--r--content/renderer/BUILD.gn1
-rw-r--r--content/renderer/gpu/gpu_benchmarking_extension.cc4
-rw-r--r--content/renderer/render_thread_impl.cc5
35 files changed, 378 insertions, 348 deletions
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index d9c4935..aea09ca 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -33,6 +33,7 @@ source_set("browser") {
"//content/browser/notifications:notification_proto",
"//content/browser/service_worker:service_worker_proto",
"//content/browser/speech/proto",
+ "//content/gpu:gpu_sources",
"//content/public/common:common_sources",
"//content/public/common:mojo_bindings",
"//crypto",
diff --git a/content/browser/DEPS b/content/browser/DEPS
index 85ffdda..650dbd4 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -11,6 +11,7 @@ include_rules = [
"+components/url_formatter",
"+content/app/strings/grit", # For generated headers
+ "+content/gpu",
"+content/public/browser",
"+device/battery", # For battery status service.
"+device/vibration", # For Vibration API
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc
index 6e74459..5a63868 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -19,7 +19,7 @@
#include "build/build_config.h"
#include "cc/base/switches.h"
#include "content/browser/gpu/gpu_process_host.h"
-#include "content/common/gpu/gpu_host_messages.h"
+#include "content/gpu/gpu_host_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_data_manager_observer.h"
#include "content/public/common/content_client.h"
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 0472eb6..3fe646a 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -31,9 +31,9 @@
#include "content/browser/mojo/mojo_application_host.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/child_process_host_impl.h"
-#include "content/common/gpu/gpu_host_messages.h"
#include "content/common/in_process_child_thread_params.h"
#include "content/common/view_messages.h"
+#include "content/gpu/gpu_host_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/gpu_utils.h"
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc
index 387792e..e3b2732 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.cc
+++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
@@ -22,7 +22,7 @@
#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_host_view_base.h"
-#include "content/common/gpu/gpu_host_messages.h"
+#include "content/gpu/gpu_host_messages.h"
#include "content/public/browser/browser_thread.h"
#include "gpu/ipc/common/memory_stats.h"
#include "ui/gfx/swap_result.h"
diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc
deleted file mode 100644
index 14813eb..0000000
--- a/content/browser/renderer_host/gpu_message_filter.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// 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.
-
-#if defined(OS_WIN)
-#include <windows.h>
-#endif
-
-#include "content/browser/renderer_host/gpu_message_filter.h"
-
-#include "base/bind.h"
-#include "build/build_config.h"
-#include "content/browser/gpu/gpu_data_manager_impl.h"
-#include "content/browser/gpu/gpu_process_host.h"
-#include "content/common/child_process_host_impl.h"
-#include "content/common/gpu/gpu_host_messages.h"
-
-namespace content {
-
-GpuMessageFilter::GpuMessageFilter(int render_process_id)
- : BrowserMessageFilter(GpuMsgStart),
- gpu_process_id_(0),
- render_process_id_(render_process_id),
- weak_ptr_factory_(this) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-}
-
-GpuMessageFilter::~GpuMessageFilter() {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
-}
-
-bool GpuMessageFilter::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(GpuMessageFilter, message)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_EstablishGpuChannel,
- OnEstablishGpuChannel)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_HasGpuProcess, OnHasGpuProcess)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void GpuMessageFilter::OnEstablishGpuChannel(
- CauseForGpuLaunch cause_for_gpu_launch,
- IPC::Message* reply_ptr) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- scoped_ptr<IPC::Message> reply(reply_ptr);
-
-#if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
- // TODO(jbauman): Remove this when we know why renderer processes are
- // hanging on x86-64. https://crbug.com/577127
- if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) {
- reply->set_reply_error();
- Send(reply.release());
- return;
- }
-#endif
-
- GpuProcessHost* host = GpuProcessHost::FromID(gpu_process_id_);
- if (!host) {
- host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
- cause_for_gpu_launch);
- if (!host) {
- reply->set_reply_error();
- Send(reply.release());
- return;
- }
-
- gpu_process_id_ = host->host_id();
- }
-
- bool preempts = false;
- bool allow_view_command_buffers = false;
- bool allow_real_time_streams = false;
- host->EstablishGpuChannel(
- render_process_id_,
- ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId(
- render_process_id_),
- preempts, allow_view_command_buffers, allow_real_time_streams,
- base::Bind(&GpuMessageFilter::EstablishChannelCallback,
- weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply)));
-}
-
-void GpuMessageFilter::OnHasGpuProcess(IPC::Message* reply_ptr) {
- scoped_ptr<IPC::Message> reply(reply_ptr);
- GpuProcessHost::GetProcessHandles(
- base::Bind(&GpuMessageFilter::GetGpuProcessHandlesCallback,
- weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply)));
-}
-
-void GpuMessageFilter::EstablishChannelCallback(
- scoped_ptr<IPC::Message> reply,
- const IPC::ChannelHandle& channel,
- const gpu::GPUInfo& gpu_info) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
- GpuHostMsg_EstablishGpuChannel::WriteReplyParams(
- reply.get(), render_process_id_, channel, gpu_info);
- Send(reply.release());
-}
-
-void GpuMessageFilter::GetGpuProcessHandlesCallback(
- scoped_ptr<IPC::Message> reply,
- const std::list<base::ProcessHandle>& handles) {
- bool has_gpu_process = handles.size() > 0;
- GpuHostMsg_HasGpuProcess::WriteReplyParams(reply.get(), has_gpu_process);
- Send(reply.release());
-}
-
-} // namespace content
diff --git a/content/browser/renderer_host/gpu_message_filter.h b/content/browser/renderer_host/gpu_message_filter.h
deleted file mode 100644
index d802b7f..0000000
--- a/content/browser/renderer_host/gpu_message_filter.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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_RENDERER_HOST_GPU_MESSAGE_FILTER_H_
-#define CONTENT_BROWSER_RENDERER_HOST_GPU_MESSAGE_FILTER_H_
-
-#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "content/common/gpu/gpu_process_launch_causes.h"
-#include "content/public/browser/browser_message_filter.h"
-
-namespace gpu {
-struct GPUInfo;
-}
-
-namespace content {
-
-// A message filter for messages from the renderer to the GpuProcessHost
-// in the browser. Such messages are typically destined for the GPU process,
-// but need to be mediated by the browser.
-class GpuMessageFilter : public BrowserMessageFilter {
- public:
- GpuMessageFilter(int render_process_id);
-
- // BrowserMessageFilter methods:
- bool OnMessageReceived(const IPC::Message& message) override;
-
- private:
- friend class BrowserThread;
- friend class base::DeleteHelper<GpuMessageFilter>;
-
- ~GpuMessageFilter() override;
-
- // Message handlers called on the browser IO thread:
- void OnEstablishGpuChannel(CauseForGpuLaunch,
- IPC::Message* reply);
- void OnHasGpuProcess(IPC::Message* reply);
- // Helper callbacks for the message handlers.
- void EstablishChannelCallback(scoped_ptr<IPC::Message> reply,
- const IPC::ChannelHandle& channel,
- const gpu::GPUInfo& gpu_info);
- void GetGpuProcessHandlesCallback(
- scoped_ptr<IPC::Message> reply,
- const std::list<base::ProcessHandle>& handles);
-
- int gpu_process_id_;
- int render_process_id_;
-
- base::WeakPtrFactory<GpuMessageFilter> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuMessageFilter);
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_RENDERER_HOST_GPU_MESSAGE_FILTER_H_
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index d3e33ae..9035c9f 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -25,6 +25,8 @@
#include "content/browser/dom_storage/session_storage_namespace_impl.h"
#include "content/browser/download/download_stats.h"
#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
+#include "content/browser/gpu/gpu_data_manager_impl.h"
+#include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
#include "content/browser/media/media_internals.h"
#include "content/browser/renderer_host/pepper/pepper_security_helper.h"
@@ -134,9 +136,11 @@ RenderMessageFilter::RenderMessageFilter(
resource_context_(browser_context->GetResourceContext()),
render_widget_helper_(render_widget_helper),
dom_storage_context_(dom_storage_context),
+ gpu_process_id_(0),
render_process_id_(render_process_id),
audio_manager_(audio_manager),
- media_internals_(media_internals) {
+ media_internals_(media_internals),
+ weak_ptr_factory_(this) {
DCHECK(request_context_.get());
if (render_widget_helper)
@@ -185,6 +189,10 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(
ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer,
OnAllocateGpuMemoryBuffer)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ChildProcessHostMsg_EstablishGpuChannel,
+ OnEstablishGpuChannel)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ChildProcessHostMsg_HasGpuProcess,
+ OnHasGpuProcess)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedGpuMemoryBuffer,
OnDeletedGpuMemoryBuffer)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_AllocatedSharedBitmap,
@@ -652,6 +660,74 @@ void RenderMessageFilter::GpuMemoryBufferAllocated(
Send(reply);
}
+void RenderMessageFilter::OnEstablishGpuChannel(
+ CauseForGpuLaunch cause_for_gpu_launch,
+ IPC::Message* reply_ptr) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ scoped_ptr<IPC::Message> reply(reply_ptr);
+
+#if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
+ // TODO(jbauman): Remove this when we know why renderer processes are
+ // hanging on x86-64. https://crbug.com/577127
+ if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) {
+ reply->set_reply_error();
+ Send(reply.release());
+ return;
+ }
+#endif
+
+ GpuProcessHost* host = GpuProcessHost::FromID(gpu_process_id_);
+ if (!host) {
+ host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
+ cause_for_gpu_launch);
+ if (!host) {
+ reply->set_reply_error();
+ Send(reply.release());
+ return;
+ }
+
+ gpu_process_id_ = host->host_id();
+ }
+
+ bool preempts = false;
+ bool allow_view_command_buffers = false;
+ bool allow_real_time_streams = false;
+ host->EstablishGpuChannel(
+ render_process_id_,
+ ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId(
+ render_process_id_),
+ preempts, allow_view_command_buffers, allow_real_time_streams,
+ base::Bind(&RenderMessageFilter::EstablishChannelCallback,
+ weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply)));
+}
+
+void RenderMessageFilter::OnHasGpuProcess(IPC::Message* reply_ptr) {
+ scoped_ptr<IPC::Message> reply(reply_ptr);
+ GpuProcessHost::GetProcessHandles(
+ base::Bind(&RenderMessageFilter::GetGpuProcessHandlesCallback,
+ weak_ptr_factory_.GetWeakPtr(), base::Passed(&reply)));
+}
+
+void RenderMessageFilter::EstablishChannelCallback(
+ scoped_ptr<IPC::Message> reply,
+ const IPC::ChannelHandle& channel,
+ const gpu::GPUInfo& gpu_info) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ ChildProcessHostMsg_EstablishGpuChannel::WriteReplyParams(
+ reply.get(), render_process_id_, channel, gpu_info);
+ Send(reply.release());
+}
+
+void RenderMessageFilter::GetGpuProcessHandlesCallback(
+ scoped_ptr<IPC::Message> reply,
+ const std::list<base::ProcessHandle>& handles) {
+ bool has_gpu_process = handles.size() > 0;
+ ChildProcessHostMsg_HasGpuProcess::WriteReplyParams(reply.get(),
+ has_gpu_process);
+ Send(reply.release());
+}
+
void RenderMessageFilter::OnDeletedGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
const gpu::SyncToken& sync_token) {
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index ce07dfe..fe369ec 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -15,13 +15,16 @@
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/shared_memory.h"
+#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner_helpers.h"
#include "base/strings/string16.h"
#include "build/build_config.h"
#include "cc/resources/shared_bitmap_manager.h"
+#include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/common/host_discardable_shared_memory_manager.h"
#include "content/common/host_shared_bitmap_manager.h"
#include "content/public/browser/browser_message_filter.h"
+#include "gpu/config/gpu_info.h"
#include "ipc/message_filter.h"
#include "media/audio/audio_parameters.h"
#include "media/base/channel_layout.h"
@@ -160,6 +163,16 @@ class CONTENT_EXPORT RenderMessageFilter : public BrowserMessageFilter {
void OnGetMonitorColorProfile(std::vector<char>* profile);
#endif
+ // Message handlers called on the browser IO thread:
+ void OnEstablishGpuChannel(CauseForGpuLaunch, IPC::Message* reply);
+ void OnHasGpuProcess(IPC::Message* reply);
+ // Helper callbacks for the message handlers.
+ void EstablishChannelCallback(scoped_ptr<IPC::Message> reply,
+ const IPC::ChannelHandle& channel,
+ const gpu::GPUInfo& gpu_info);
+ void GetGpuProcessHandlesCallback(
+ scoped_ptr<IPC::Message> reply,
+ const std::list<base::ProcessHandle>& handles);
// Used to ask the browser to allocate a block of shared memory for the
// renderer to send back data in, since shared memory can't be created
// in the renderer on POSIX due to the sandbox.
@@ -234,11 +247,14 @@ class CONTENT_EXPORT RenderMessageFilter : public BrowserMessageFilter {
scoped_refptr<DOMStorageContextWrapper> dom_storage_context_;
+ int gpu_process_id_;
int render_process_id_;
media::AudioManager* audio_manager_;
MediaInternals* media_internals_;
+ base::WeakPtrFactory<RenderMessageFilter> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(RenderMessageFilter);
};
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 7d17955..4d2111f 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -92,7 +92,6 @@
#include "content/browser/renderer_host/database_message_filter.h"
#include "content/browser/renderer_host/file_utilities_message_filter.h"
#include "content/browser/renderer_host/gamepad_browser_message_filter.h"
-#include "content/browser/renderer_host/gpu_message_filter.h"
#include "content/browser/renderer_host/media/audio_input_renderer_host.h"
#include "content/browser/renderer_host/media/audio_renderer_host.h"
#include "content/browser/renderer_host/media/media_stream_dispatcher_host.h"
@@ -121,7 +120,6 @@
#include "content/common/child_process_messages.h"
#include "content/common/content_switches_internal.h"
#include "content/common/frame_messages.h"
-#include "content/common/gpu/gpu_host_messages.h"
#include "content/common/in_process_child_thread_params.h"
#include "content/common/mojo/channel_init.h"
#include "content/common/mojo/mojo_messages.h"
@@ -130,6 +128,7 @@
#include "content/common/resource_messages.h"
#include "content/common/site_isolation_policy.h"
#include "content/common/view_messages.h"
+#include "content/gpu/gpu_host_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/navigator_connect_context.h"
@@ -942,8 +941,6 @@ void RenderProcessHostImpl::CreateMessageFilters() {
storage_partition_impl_->GetIndexedDBContext(),
blob_storage_context.get()));
- gpu_message_filter_ = new GpuMessageFilter(GetID());
- AddFilter(gpu_message_filter_);
#if defined(ENABLE_WEBRTC)
AddFilter(new WebRTCIdentityServiceHost(
GetID(), storage_partition_impl_->GetWebRTCIdentityStore(),
@@ -1963,7 +1960,6 @@ void RenderProcessHostImpl::Cleanup() {
channel_.reset();
// The following members should be cleared in ProcessDied() as well!
- gpu_message_filter_ = NULL;
message_port_message_filter_ = NULL;
RemoveUserData(kSessionStorageHolderKey);
@@ -2450,7 +2446,6 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead,
RenderProcessExited(this, status, exit_code));
within_process_died_observer_ = false;
- gpu_message_filter_ = NULL;
message_port_message_filter_ = NULL;
RemoveUserData(kSessionStorageHolderKey);
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index d08b401..ccb83b2 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -54,7 +54,6 @@ class AudioRendererHost;
class BluetoothDispatcherHost;
class BrowserCdmManager;
class BrowserDemuxerAndroid;
-class GpuMessageFilter;
class InProcessChildThreadParams;
class MessagePortMessageFilter;
class MojoApplicationHost;
@@ -380,14 +379,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
// IO thread.
scoped_refptr<RenderWidgetHelper> widget_helper_;
- // The filter for GPU-related messages coming from the renderer.
- // Thread safety note: this field is to be accessed from the UI thread.
- // We don't keep a reference to it, to avoid it being destroyed on the UI
- // thread, but we clear this field when we clear channel_. When channel_ goes
- // away, it posts a task to the IO thread to destroy it there, so we know that
- // it's valid if non-NULL.
- GpuMessageFilter* gpu_message_filter_;
-
// The filter for MessagePort messages coming from the renderer.
scoped_refptr<MessagePortMessageFilter> message_port_message_filter_;
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 27b798a9..cc8662d 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -56,11 +56,11 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
-#include "content/common/gpu/gpu_host_messages.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/common/input/did_overscroll_params.h"
#include "content/common/input_messages.h"
#include "content/common/view_messages.h"
+#include "content/gpu/gpu_host_messages.h"
#include "content/public/browser/android/compositor.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host.h"
diff --git a/content/common/child_process_messages.h b/content/common/child_process_messages.h
index b4ee49f..e46e4af 100644
--- a/content/common/child_process_messages.h
+++ b/content/common/child_process_messages.h
@@ -16,13 +16,20 @@
#include "build/build_config.h"
#include "cc/resources/shared_bitmap_manager.h"
#include "content/common/content_export.h"
+#include "content/common/content_param_traits_macros.h"
+#include "content/common/gpu/gpu_param_traits_macros.h"
+#include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/common/host_discardable_shared_memory_manager.h"
#include "gpu/command_buffer/common/sync_token.h"
+#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
+IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
+ content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
+
IPC_ENUM_TRAITS_MAX_VALUE(tracked_objects::ThreadData::Status,
tracked_objects::ThreadData::STATUS_LAST)
@@ -62,26 +69,6 @@ IPC_STRUCT_TRAITS_BEGIN(tracked_objects::ProcessDataSnapshot)
IPC_STRUCT_TRAITS_MEMBER(process_id)
IPC_STRUCT_TRAITS_END()
-IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType,
- gfx::GPU_MEMORY_BUFFER_TYPE_LAST)
-
-IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle)
- IPC_STRUCT_TRAITS_MEMBER(id)
- IPC_STRUCT_TRAITS_MEMBER(type)
- IPC_STRUCT_TRAITS_MEMBER(handle)
- IPC_STRUCT_TRAITS_MEMBER(offset)
- IPC_STRUCT_TRAITS_MEMBER(stride)
-#if defined(USE_OZONE)
- IPC_STRUCT_TRAITS_MEMBER(native_pixmap_handle)
-#elif defined(OS_MACOSX)
- IPC_STRUCT_TRAITS_MEMBER(mach_port)
-#endif
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferId)
- IPC_STRUCT_TRAITS_MEMBER(id)
-IPC_STRUCT_TRAITS_END()
-
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
@@ -135,6 +122,19 @@ IPC_MESSAGE_CONTROL1(ChildProcessMsg_InitializeClientNativePixmapFactory,
////////////////////////////////////////////////////////////////////////////////
// Messages sent from the child process to the browser.
+// A renderer sends this when it wants to create a connection to the GPU
+// process. The browser will create the GPU process if necessary, and will
+// return a handle to the channel via a GpuChannelEstablished message.
+IPC_SYNC_MESSAGE_CONTROL1_3(ChildProcessHostMsg_EstablishGpuChannel,
+ content::CauseForGpuLaunch,
+ int /* client id */,
+ IPC::ChannelHandle /* handle to channel */,
+ gpu::GPUInfo /* stats about GPU process*/)
+
+// A renderer sends this when it wants to know whether a gpu process exists.
+IPC_SYNC_MESSAGE_CONTROL0_1(ChildProcessHostMsg_HasGpuProcess,
+ bool /* result */)
+
IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest)
// Send back profiler data (ThreadData in tracked_objects).
diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h
index 13a5a27..d5a8bc8 100644
--- a/content/common/content_message_generator.h
+++ b/content/common/content_message_generator.h
@@ -28,7 +28,6 @@
#include "content/common/frame_messages.h"
#include "content/common/gamepad_messages.h"
#include "content/common/geofencing_messages.h"
-#include "content/common/gpu/gpu_host_messages.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/gpu/media/media_messages.h"
#include "content/common/indexed_db/indexed_db_messages.h"
diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h
index 94cde2f..753947b 100644
--- a/content/common/content_param_traits_macros.h
+++ b/content/common/content_param_traits_macros.h
@@ -20,6 +20,7 @@
#include "third_party/WebKit/public/web/WebContentSecurityPolicy.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebSharedWorkerCreationContextType.h"
+#include "ui/gfx/gpu_memory_buffer.h"
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index b5ea79e..a4e3203 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -15,6 +15,7 @@
#include "base/trace_event/trace_event.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/gpu_messages.h"
+#include "content/common/gpu/gpu_param_traits.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "gpu/command_buffer/common/cmd_buffer_common.h"
#include "gpu/command_buffer/common/command_buffer_id.h"
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index dd2ca53..f4dd8e7 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -19,6 +19,7 @@
#include "build/build_config.h"
#include "content/common/gpu/client/command_buffer_proxy_impl.h"
#include "content/common/gpu/gpu_messages.h"
+#include "content/common/gpu/gpu_param_traits_macros.h"
#include "ipc/ipc_sync_message_filter.h"
#include "url/gurl.h"
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index 3f00427..babf041 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -13,10 +13,9 @@
#include "base/memory/shared_memory.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
-#include "content/common/content_param_traits.h"
#include "content/common/gpu/gpu_memory_uma_stats.h"
+#include "content/common/gpu/gpu_param_traits.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
-#include "content/common/gpu/gpu_stream_constants.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/constants.h"
@@ -29,13 +28,13 @@
#include "gpu/ipc/common/surface_handle.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
+#include "ui/events/ipc/latency_info_param_traits.h"
#include "ui/events/latency_info.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/swap_result.h"
-#include "ui/gl/gpu_preference.h"
#include "url/ipc/url_param_traits.h"
#if defined(OS_ANDROID)
@@ -50,21 +49,10 @@
#define IPC_MESSAGE_START GpuChannelMsgStart
-IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference,
- gfx::GpuPreferenceLast)
-IPC_ENUM_TRAITS_MAX_VALUE(content::GpuStreamPriority,
- content::GpuStreamPriority::LAST)
-IPC_ENUM_TRAITS_MAX_VALUE(gfx::SwapResult, gfx::SwapResult::SWAP_RESULT_LAST)
-IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
- gpu::MemoryAllocation::CUTOFF_LAST)
-IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
- gpu::error::kContextLostReasonLast)
-IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
- gpu::kCollectInfoNone,
- gpu::kCollectInfoFatalFailure)
-IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile,
- gpu::VIDEO_CODEC_PROFILE_MIN,
- gpu::VIDEO_CODEC_PROFILE_MAX)
+IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage)
+ IPC_STRUCT_MEMBER(int32_t, id)
+ IPC_STRUCT_MEMBER(std::string, message)
+IPC_STRUCT_END()
IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
IPC_STRUCT_MEMBER(int32_t, share_group_id)
@@ -75,9 +63,13 @@ IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
IPC_STRUCT_MEMBER(gfx::GpuPreference, gpu_preference)
IPC_STRUCT_END()
-IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage)
+IPC_STRUCT_BEGIN(GpuCommandBufferMsg_CreateImage_Params)
IPC_STRUCT_MEMBER(int32_t, id)
- IPC_STRUCT_MEMBER(std::string, message)
+ IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferHandle, gpu_memory_buffer)
+ IPC_STRUCT_MEMBER(gfx::Size, size)
+ IPC_STRUCT_MEMBER(gfx::BufferFormat, format)
+ IPC_STRUCT_MEMBER(uint32_t, internal_format)
+ IPC_STRUCT_MEMBER(uint64_t, image_release_count)
IPC_STRUCT_END()
#if defined(OS_ANDROID)
@@ -101,74 +93,6 @@ IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params)
IPC_STRUCT_END()
#endif
-IPC_STRUCT_BEGIN(GpuCommandBufferMsg_CreateImage_Params)
- IPC_STRUCT_MEMBER(int32_t, id)
- IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferHandle, gpu_memory_buffer)
- IPC_STRUCT_MEMBER(gfx::Size, size)
- IPC_STRUCT_MEMBER(gfx::BufferFormat, format)
- IPC_STRUCT_MEMBER(uint32_t, internal_format)
- IPC_STRUCT_MEMBER(uint64_t, image_release_count)
-IPC_STRUCT_END()
-
-IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode)
- IPC_STRUCT_TRAITS_MEMBER(values)
- IPC_STRUCT_TRAITS_MEMBER(children)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice)
- IPC_STRUCT_TRAITS_MEMBER(vendor_id)
- IPC_STRUCT_TRAITS_MEMBER(device_id)
- IPC_STRUCT_TRAITS_MEMBER(active)
- IPC_STRUCT_TRAITS_MEMBER(vendor_string)
- IPC_STRUCT_TRAITS_MEMBER(device_string)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo)
- IPC_STRUCT_TRAITS_MEMBER(initialization_time)
- IPC_STRUCT_TRAITS_MEMBER(optimus)
- IPC_STRUCT_TRAITS_MEMBER(amd_switchable)
- IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute)
- IPC_STRUCT_TRAITS_MEMBER(gpu)
- IPC_STRUCT_TRAITS_MEMBER(secondary_gpus)
- IPC_STRUCT_TRAITS_MEMBER(adapter_luid)
- IPC_STRUCT_TRAITS_MEMBER(driver_vendor)
- IPC_STRUCT_TRAITS_MEMBER(driver_version)
- IPC_STRUCT_TRAITS_MEMBER(driver_date)
- IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version)
- IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version)
- IPC_STRUCT_TRAITS_MEMBER(max_msaa_samples)
- IPC_STRUCT_TRAITS_MEMBER(machine_model_name)
- IPC_STRUCT_TRAITS_MEMBER(machine_model_version)
- IPC_STRUCT_TRAITS_MEMBER(gl_version)
- IPC_STRUCT_TRAITS_MEMBER(gl_vendor)
- IPC_STRUCT_TRAITS_MEMBER(gl_renderer)
- IPC_STRUCT_TRAITS_MEMBER(gl_extensions)
- IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor)
- IPC_STRUCT_TRAITS_MEMBER(gl_ws_version)
- IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions)
- IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy)
- IPC_STRUCT_TRAITS_MEMBER(can_lose_context)
- IPC_STRUCT_TRAITS_MEMBER(software_rendering)
- IPC_STRUCT_TRAITS_MEMBER(direct_rendering)
- IPC_STRUCT_TRAITS_MEMBER(sandboxed)
- IPC_STRUCT_TRAITS_MEMBER(process_crash_count)
- IPC_STRUCT_TRAITS_MEMBER(in_process_gpu)
- IPC_STRUCT_TRAITS_MEMBER(basic_info_state)
- IPC_STRUCT_TRAITS_MEMBER(context_info_state)
-#if defined(OS_WIN)
- IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state)
- IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics)
-#endif
- IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_capabilities)
- IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles)
- IPC_STRUCT_TRAITS_MEMBER(jpeg_decode_accelerator_supported)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation)
- IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible)
- IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible)
-IPC_STRUCT_TRAITS_END()
-
//------------------------------------------------------------------------------
// GPU Channel Messages
// These are messages from a renderer process to the GPU process.
diff --git a/content/common/gpu/gpu_param_traits.cc b/content/common/gpu/gpu_param_traits.cc
new file mode 100644
index 0000000..2b1580a
--- /dev/null
+++ b/content/common/gpu/gpu_param_traits.cc
@@ -0,0 +1,27 @@
+// 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.
+
+// Get basic type definitions.
+#include "content/common/gpu/gpu_param_traits.h"
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#undef CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_MACROS_H_
+#include "content/common/gpu/gpu_param_traits_macros.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#undef CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_MACROS_H_
+#include "content/common/gpu/gpu_param_traits_macros.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#undef CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_MACROS_H_
+#include "content/common/gpu/gpu_param_traits_macros.h"
+} // namespace IPC
diff --git a/content/common/gpu/gpu_param_traits.h b/content/common/gpu/gpu_param_traits.h
new file mode 100644
index 0000000..1e114bc
--- /dev/null
+++ b/content/common/gpu/gpu_param_traits.h
@@ -0,0 +1,10 @@
+// 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.
+
+#ifndef CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_H_
+#define CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_H_
+
+#include "content/common/gpu/gpu_param_traits_macros.h"
+
+#endif // CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_H_
diff --git a/content/common/gpu/gpu_param_traits_macros.h b/content/common/gpu/gpu_param_traits_macros.h
new file mode 100644
index 0000000..d14b79d
--- /dev/null
+++ b/content/common/gpu/gpu_param_traits_macros.h
@@ -0,0 +1,140 @@
+// 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.
+
+#ifndef CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_MACROS_H_
+#define CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_MACROS_H_
+
+#include "content/common/content_export.h"
+#include "content/common/gpu/gpu_stream_constants.h"
+#include "gpu/command_buffer/common/constants.h"
+#include "gpu/command_buffer/common/gpu_memory_allocation.h"
+#include "gpu/config/gpu_info.h"
+#include "ipc/ipc_message_macros.h"
+#include "media/base/video_codecs.h"
+#include "ui/gfx/gpu_memory_buffer.h"
+#include "ui/gfx/ipc/gfx_param_traits.h"
+#include "ui/gfx/swap_result.h"
+#include "ui/gl/gpu_preference.h"
+#include "url/ipc/url_param_traits.h"
+
+#undef IPC_MESSAGE_EXPORT
+#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
+
+IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
+ media::VIDEO_CODEC_PROFILE_MIN,
+ media::VIDEO_CODEC_PROFILE_MAX)
+
+IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile)
+ IPC_STRUCT_TRAITS_MEMBER(profile)
+ IPC_STRUCT_TRAITS_MEMBER(max_resolution)
+ IPC_STRUCT_TRAITS_MEMBER(min_resolution)
+IPC_STRUCT_TRAITS_END()
+
+IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorCapabilities)
+ IPC_STRUCT_TRAITS_MEMBER(supported_profiles)
+ IPC_STRUCT_TRAITS_MEMBER(flags)
+IPC_STRUCT_TRAITS_END()
+
+IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile)
+ IPC_STRUCT_TRAITS_MEMBER(profile)
+ IPC_STRUCT_TRAITS_MEMBER(max_resolution)
+ IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator)
+ IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator)
+IPC_STRUCT_TRAITS_END()
+
+IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType,
+ gfx::GPU_MEMORY_BUFFER_TYPE_LAST)
+
+IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle)
+ IPC_STRUCT_TRAITS_MEMBER(id)
+ IPC_STRUCT_TRAITS_MEMBER(type)
+ IPC_STRUCT_TRAITS_MEMBER(handle)
+ IPC_STRUCT_TRAITS_MEMBER(offset)
+ IPC_STRUCT_TRAITS_MEMBER(stride)
+#if defined(USE_OZONE)
+ IPC_STRUCT_TRAITS_MEMBER(native_pixmap_handle)
+#elif defined(OS_MACOSX)
+ IPC_STRUCT_TRAITS_MEMBER(mach_port)
+#endif
+IPC_STRUCT_TRAITS_END()
+
+IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferId)
+ IPC_STRUCT_TRAITS_MEMBER(id)
+IPC_STRUCT_TRAITS_END()
+
+IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference, gfx::GpuPreferenceLast)
+IPC_ENUM_TRAITS_MAX_VALUE(content::GpuStreamPriority,
+ content::GpuStreamPriority::LAST)
+IPC_ENUM_TRAITS_MAX_VALUE(gfx::SwapResult, gfx::SwapResult::SWAP_RESULT_LAST)
+IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
+ gpu::MemoryAllocation::CUTOFF_LAST)
+IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
+ gpu::error::kContextLostReasonLast)
+IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
+ gpu::kCollectInfoNone,
+ gpu::kCollectInfoFatalFailure)
+IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile,
+ gpu::VIDEO_CODEC_PROFILE_MIN,
+ gpu::VIDEO_CODEC_PROFILE_MAX)
+
+IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode)
+ IPC_STRUCT_TRAITS_MEMBER(values)
+ IPC_STRUCT_TRAITS_MEMBER(children)
+IPC_STRUCT_TRAITS_END()
+
+IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice)
+ IPC_STRUCT_TRAITS_MEMBER(vendor_id)
+ IPC_STRUCT_TRAITS_MEMBER(device_id)
+ IPC_STRUCT_TRAITS_MEMBER(active)
+ IPC_STRUCT_TRAITS_MEMBER(vendor_string)
+ IPC_STRUCT_TRAITS_MEMBER(device_string)
+IPC_STRUCT_TRAITS_END()
+
+IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo)
+ IPC_STRUCT_TRAITS_MEMBER(initialization_time)
+ IPC_STRUCT_TRAITS_MEMBER(optimus)
+ IPC_STRUCT_TRAITS_MEMBER(amd_switchable)
+ IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute)
+ IPC_STRUCT_TRAITS_MEMBER(gpu)
+ IPC_STRUCT_TRAITS_MEMBER(secondary_gpus)
+ IPC_STRUCT_TRAITS_MEMBER(adapter_luid)
+ IPC_STRUCT_TRAITS_MEMBER(driver_vendor)
+ IPC_STRUCT_TRAITS_MEMBER(driver_version)
+ IPC_STRUCT_TRAITS_MEMBER(driver_date)
+ IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version)
+ IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version)
+ IPC_STRUCT_TRAITS_MEMBER(max_msaa_samples)
+ IPC_STRUCT_TRAITS_MEMBER(machine_model_name)
+ IPC_STRUCT_TRAITS_MEMBER(machine_model_version)
+ IPC_STRUCT_TRAITS_MEMBER(gl_version)
+ IPC_STRUCT_TRAITS_MEMBER(gl_vendor)
+ IPC_STRUCT_TRAITS_MEMBER(gl_renderer)
+ IPC_STRUCT_TRAITS_MEMBER(gl_extensions)
+ IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor)
+ IPC_STRUCT_TRAITS_MEMBER(gl_ws_version)
+ IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions)
+ IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy)
+ IPC_STRUCT_TRAITS_MEMBER(can_lose_context)
+ IPC_STRUCT_TRAITS_MEMBER(software_rendering)
+ IPC_STRUCT_TRAITS_MEMBER(direct_rendering)
+ IPC_STRUCT_TRAITS_MEMBER(sandboxed)
+ IPC_STRUCT_TRAITS_MEMBER(process_crash_count)
+ IPC_STRUCT_TRAITS_MEMBER(in_process_gpu)
+ IPC_STRUCT_TRAITS_MEMBER(basic_info_state)
+ IPC_STRUCT_TRAITS_MEMBER(context_info_state)
+#if defined(OS_WIN)
+ IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state)
+ IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics)
+#endif
+ IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_capabilities)
+ IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles)
+ IPC_STRUCT_TRAITS_MEMBER(jpeg_decode_accelerator_supported)
+IPC_STRUCT_TRAITS_END()
+
+IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation)
+ IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible)
+ IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible)
+IPC_STRUCT_TRAITS_END()
+
+#endif // CONTENT_COMMON_GPU_GPU_PARAM_TRAITS_MACROS_H_
diff --git a/content/common/gpu/media/media_messages.h b/content/common/gpu/media/media_messages.h
index 554fb15..7643672 100644
--- a/content/common/gpu/media/media_messages.h
+++ b/content/common/gpu/media/media_messages.h
@@ -44,10 +44,6 @@ IPC_ENUM_TRAITS_MAX_VALUE(media::JpegDecodeAccelerator::Error,
media::JpegDecodeAccelerator::LARGEST_ERROR_ENUM)
IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error,
media::VideoEncodeAccelerator::kErrorMax)
-IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
- media::VIDEO_CODEC_PROFILE_MIN,
- media::VIDEO_CODEC_PROFILE_MAX)
-
IPC_STRUCT_BEGIN(AcceleratedJpegDecoderMsg_Decode_Params)
IPC_STRUCT_MEMBER(media::BitstreamBuffer, input_buffer)
IPC_STRUCT_MEMBER(gfx::Size, coded_size)
@@ -79,24 +75,6 @@ IPC_STRUCT_TRAITS_BEGIN(media::VideoDecodeAccelerator::Config)
IPC_STRUCT_TRAITS_MEMBER(surface_id)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile)
- IPC_STRUCT_TRAITS_MEMBER(profile)
- IPC_STRUCT_TRAITS_MEMBER(max_resolution)
- IPC_STRUCT_TRAITS_MEMBER(min_resolution)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorCapabilities)
- IPC_STRUCT_TRAITS_MEMBER(supported_profiles)
- IPC_STRUCT_TRAITS_MEMBER(flags)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile)
- IPC_STRUCT_TRAITS_MEMBER(profile)
- IPC_STRUCT_TRAITS_MEMBER(max_resolution)
- IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator)
- IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator)
-IPC_STRUCT_TRAITS_END()
-
IPC_STRUCT_TRAITS_BEGIN(media::SubsampleEntry)
IPC_STRUCT_TRAITS_MEMBER(clear_bytes)
IPC_STRUCT_TRAITS_MEMBER(cypher_bytes)
diff --git a/content/content.gyp b/content/content.gyp
index 765dcd5..ff15c09 100644
--- a/content/content.gyp
+++ b/content/content.gyp
@@ -213,6 +213,7 @@
'chrome_manifest',
'chrome_renderer_manifest',
'content_common',
+ 'content_gpu',
'content_resources',
],
'export_dependent_settings': [
@@ -226,7 +227,6 @@
}],
['OS=="android"', {
'dependencies': [
- 'content_gpu',
'content_utility',
],
}],
@@ -310,6 +310,7 @@
'common_features',
'content_child',
'content_common',
+ 'content_gpu',
'content_resources',
],
'export_dependent_settings': [
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 0aa0d9a..67265b3 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -1200,8 +1200,6 @@
'browser/renderer_host/frame_metadata_util.h',
'browser/renderer_host/gamepad_browser_message_filter.cc',
'browser/renderer_host/gamepad_browser_message_filter.h',
- 'browser/renderer_host/gpu_message_filter.cc',
- 'browser/renderer_host/gpu_message_filter.h',
'browser/renderer_host/input/gesture_event_queue.cc',
'browser/renderer_host/input/gesture_event_queue.h',
'browser/renderer_host/input/input_ack_handler.h',
diff --git a/content/content_common.gypi b/content/content_common.gypi
index a36f310..94fc7a4 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -390,6 +390,9 @@
'common/gpu/gpu_memory_tracking.h',
'common/gpu/gpu_memory_uma_stats.h',
'common/gpu/gpu_messages.h',
+ 'common/gpu/gpu_param_traits.cc',
+ 'common/gpu/gpu_param_traits.h',
+ 'common/gpu/gpu_param_traits_macros.h',
'common/gpu/gpu_process_launch_causes.h',
'common/gpu/gpu_stream_constants.h',
'common/gpu/gpu_surface_lookup.cc',
diff --git a/content/content_gpu.gypi b/content/content_gpu.gypi
index f134890..bba05e2 100644
--- a/content/content_gpu.gypi
+++ b/content/content_gpu.gypi
@@ -6,13 +6,17 @@
'dependencies': [
'../base/base.gyp:base',
'../gpu/gpu.gyp:gpu',
+ '../ipc/ipc.gyp:ipc',
'../skia/skia.gyp:skia',
'../ui/gl/gl.gyp:gl',
'content_common_mojo_bindings.gyp:content_common_mojo_bindings',
],
'sources': [
+ 'gpu/content_gpu_message_generator.cc',
+ 'gpu/content_gpu_message_generator.h',
'gpu/gpu_child_thread.cc',
'gpu/gpu_child_thread.h',
+ 'gpu/gpu_host_messages.h',
'gpu/gpu_main.cc',
'gpu/gpu_process.cc',
'gpu/gpu_process.h',
diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn
index 7274e73..94503da 100644
--- a/content/gpu/BUILD.gn
+++ b/content/gpu/BUILD.gn
@@ -25,8 +25,11 @@ source_set("gpu_sources") {
visibility = [ "//content/*" ]
sources = [
+ "content_gpu_message_generator.cc",
+ "content_gpu_message_generator.h",
"gpu_child_thread.cc",
"gpu_child_thread.h",
+ "gpu_host_messages.h",
"gpu_main.cc",
"gpu_process.cc",
"gpu_process.h",
@@ -44,7 +47,10 @@ source_set("gpu_sources") {
"//base",
"//content:export",
"//content/public/child:child_sources",
+ "//content/public/common:common_sources",
"//gpu:gpu",
+ "//gpu/ipc/common",
+ "//ipc",
"//mojo/shell/public/interfaces",
"//skia",
"//ui/gl",
diff --git a/content/gpu/content_gpu_message_generator.cc b/content/gpu/content_gpu_message_generator.cc
new file mode 100644
index 0000000..ff21717
--- /dev/null
+++ b/content/gpu/content_gpu_message_generator.cc
@@ -0,0 +1,33 @@
+// 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.
+
+// Get basic type definitions.
+#define IPC_MESSAGE_IMPL
+#include "content/gpu/content_gpu_message_generator.h"
+
+// Generate constructors.
+#include "ipc/struct_constructor_macros.h"
+#include "content/gpu/content_gpu_message_generator.h"
+
+// Generate destructors.
+#include "ipc/struct_destructor_macros.h"
+#include "content/gpu/content_gpu_message_generator.h"
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#include "content/gpu/content_gpu_message_generator.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#include "content/gpu/content_gpu_message_generator.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#include "content/gpu/content_gpu_message_generator.h"
+} // namespace IPC
diff --git a/content/gpu/content_gpu_message_generator.h b/content/gpu/content_gpu_message_generator.h
new file mode 100644
index 0000000..55af4ce
--- /dev/null
+++ b/content/gpu/content_gpu_message_generator.h
@@ -0,0 +1,7 @@
+// 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 file, hence no include guard.
+
+#include "content/gpu/gpu_host_messages.h"
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index 4a91da8..2c5d4be 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -15,12 +15,12 @@
#include "content/child/child_process.h"
#include "content/child/thread_safe_sender.h"
#include "content/common/gpu/establish_channel_params.h"
-#include "content/common/gpu/gpu_host_messages.h"
#include "content/common/gpu/gpu_memory_buffer_factory.h"
#include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h"
#include "content/common/gpu/media/gpu_video_decode_accelerator.h"
#include "content/common/gpu/media/gpu_video_encode_accelerator.h"
#include "content/common/gpu/media/media_service.h"
+#include "content/gpu/gpu_host_messages.h"
#include "content/gpu/gpu_process_control_impl.h"
#include "content/gpu/gpu_watchdog_thread.h"
#include "content/public/common/content_client.h"
diff --git a/content/common/gpu/gpu_host_messages.h b/content/gpu/gpu_host_messages.h
index 2aa1490..ed6bb22 100644
--- a/content/common/gpu/gpu_host_messages.h
+++ b/content/gpu/gpu_host_messages.h
@@ -7,19 +7,20 @@
#include "build/build_config.h"
#include "content/common/content_export.h"
-#include "content/common/content_param_traits.h"
#include "content/common/gpu/establish_channel_params.h"
#include "content/common/gpu/gpu_memory_uma_stats.h"
-#include "content/common/gpu/gpu_process_launch_causes.h"
+#include "content/common/gpu/gpu_param_traits.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/command_buffer/common/value_state.h"
#include "gpu/command_buffer/service/gpu_preferences.h"
#include "gpu/config/gpu_info.h"
+#include "gpu/ipc/common/gpu_command_buffer_traits.h"
#include "gpu/ipc/common/memory_stats.h"
#include "gpu/ipc/common/surface_handle.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_start.h"
+#include "ui/events/ipc/latency_info_param_traits.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "url/gurl.h"
@@ -37,9 +38,6 @@
#define IPC_MESSAGE_START GpuMsgStart
-IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
- content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
-
IPC_STRUCT_TRAITS_BEGIN(content::GPUMemoryUmaStats)
IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_current)
IPC_STRUCT_TRAITS_MEMBER(bytes_allocated_max)
@@ -163,8 +161,7 @@ IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel,
// Tells the GPU process to close the channel identified by |client_id|.
// If no channel can be identified, do nothing.
-IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel,
- int32_t /* client_id */)
+IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel, int32_t /* client_id */)
// Tells the GPU process to create a new gpu memory buffer.
IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
@@ -225,18 +222,6 @@ IPC_MESSAGE_CONTROL3(GpuMsg_UpdateValueState,
// GPU Host Messages
// These are messages to the browser.
-// A renderer sends this when it wants to create a connection to the GPU
-// process. The browser will create the GPU process if necessary, and will
-// return a handle to the channel via a GpuChannelEstablished message.
-IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel,
- content::CauseForGpuLaunch,
- int /* client id */,
- IPC::ChannelHandle /* handle to channel */,
- gpu::GPUInfo /* stats about GPU process*/)
-
-// A renderer sends this when it wants to know whether a gpu process exists.
-IPC_SYNC_MESSAGE_CONTROL0_1(GpuHostMsg_HasGpuProcess, bool /* result */)
-
// Response from GPU to a GputMsg_Initialize message.
IPC_MESSAGE_CONTROL2(GpuHostMsg_Initialized,
bool /* result */,
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index 10cc4af..47c5e57 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -21,10 +21,10 @@
#include "content/child/child_process.h"
#include "content/common/content_constants_internal.h"
#include "content/common/gpu/gpu_config.h"
-#include "content/common/gpu/gpu_host_messages.h"
#include "content/common/gpu/gpu_memory_buffer_factory.h"
#include "content/common/sandbox_linux/sandbox_linux.h"
#include "content/gpu/gpu_child_thread.h"
+#include "content/gpu/gpu_host_messages.h"
#include "content/gpu/gpu_process.h"
#include "content/gpu/gpu_watchdog_thread.h"
#include "content/public/common/content_client.h"
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn
index e654492..bf45546 100644
--- a/content/renderer/BUILD.gn
+++ b/content/renderer/BUILD.gn
@@ -34,6 +34,7 @@ source_set("renderer") {
"//components/url_formatter",
"//content:resources",
"//content/common:mojo_bindings",
+ "//content/gpu:gpu_sources",
"//content/public/child:child_sources",
"//content/public/common:common_sources",
"//content/public/common:feature_h264_with_openh264_ffmpeg",
diff --git a/content/renderer/gpu/gpu_benchmarking_extension.cc b/content/renderer/gpu/gpu_benchmarking_extension.cc
index ab82879..1715fe0 100644
--- a/content/renderer/gpu/gpu_benchmarking_extension.cc
+++ b/content/renderer/gpu/gpu_benchmarking_extension.cc
@@ -15,7 +15,7 @@
#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "cc/layers/layer.h"
-#include "content/common/gpu/gpu_host_messages.h"
+#include "content/common/child_process_messages.h"
#include "content/common/input/synthetic_gesture_params.h"
#include "content/common/input/synthetic_pinch_gesture_params.h"
#include "content/common/input/synthetic_smooth_drag_gesture_params.h"
@@ -910,7 +910,7 @@ bool GpuBenchmarking::HasGpuChannel() {
bool GpuBenchmarking::HasGpuProcess() {
bool has_gpu_process = false;
if (!RenderThreadImpl::current()->Send(
- new GpuHostMsg_HasGpuProcess(&has_gpu_process)))
+ new ChildProcessHostMsg_HasGpuProcess(&has_gpu_process)))
return false;
return has_gpu_process;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 68fc3d2..4d2f53e 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -74,7 +74,6 @@
#include "content/common/frame_messages.h"
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "content/common/gpu/client/gpu_channel_host.h"
-#include "content/common/gpu/gpu_host_messages.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/common/render_frame_setup.mojom.h"
#include "content/common/render_process_messages.h"
@@ -1864,8 +1863,8 @@ GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync(
int client_id = 0;
IPC::ChannelHandle channel_handle;
gpu::GPUInfo gpu_info;
- if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch, &client_id,
- &channel_handle, &gpu_info)) ||
+ if (!Send(new ChildProcessHostMsg_EstablishGpuChannel(
+ cause_for_gpu_launch, &client_id, &channel_handle, &gpu_info)) ||
#if defined(OS_POSIX)
channel_handle.socket.fd == -1 ||
#endif