diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 01:48:48 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 01:48:48 +0000 |
commit | f24a1e2b4c8e42794d1636e43bf033f8762410c0 (patch) | |
tree | 4f5e50b905149674e93d063a8b31c53e0905bf70 | |
parent | 31af5f2c16eb49136701e4a9d0b9625a12ba8b28 (diff) | |
download | chromium_src-f24a1e2b4c8e42794d1636e43bf033f8762410c0.zip chromium_src-f24a1e2b4c8e42794d1636e43bf033f8762410c0.tar.gz chromium_src-f24a1e2b4c8e42794d1636e43bf033f8762410c0.tar.bz2 |
Moved code that runs in both the browser and GPU process from content/gpu to content/common/gpu.
Also renamed GpuRenderThread to GpuChannelManager since that is what it really does.
The only remaining dependency from content/common/gpu to content/gpu is gpu_watchdog_thread.h. Once that dependency has been reversed it should be possible to move most or all of the code in content/gpu to chrome/gpu.
TEST=build, WebGL works, run by trybots.
BUG=none
Review URL: http://codereview.chromium.org/6793054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80883 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gpu_data_manager.h | 2 | ||||
-rw-r--r-- | chrome/browser/gpu_process_host_ui_shim.cc | 18 | ||||
-rw-r--r-- | chrome/browser/gpu_process_host_ui_shim.h | 10 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 6 | ||||
-rw-r--r-- | chrome/common/child_process_logging_linux.cc | 4 | ||||
-rw-r--r-- | chrome/common/child_process_logging_mac.mm | 4 | ||||
-rw-r--r-- | chrome/common/child_process_logging_win.cc | 4 | ||||
-rw-r--r-- | chrome/common/chrome_content_gpu_client.h | 2 | ||||
-rw-r--r-- | chrome/test/gpu/gpu_pixel_browsertest.cc | 2 | ||||
-rw-r--r-- | content/browser/DEPS | 2 | ||||
-rw-r--r-- | content/browser/gpu_blacklist.cc | 2 | ||||
-rw-r--r-- | content/browser/gpu_blacklist_unittest.cc | 2 | ||||
-rw-r--r-- | content/common/DEPS | 6 | ||||
-rw-r--r-- | content/common/gpu/DEPS | 9 | ||||
-rw-r--r-- | content/common/gpu/OWNERS | 2 | ||||
-rw-r--r-- | content/common/gpu/content_gpu_client.h (renamed from content/gpu/content_gpu_client.h) | 6 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel.cc (renamed from content/gpu/gpu_channel.cc) | 69 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel.h (renamed from content/gpu/gpu_channel.h) | 30 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel_manager.cc (renamed from content/gpu/gpu_render_thread.cc) | 35 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel_manager.h (renamed from content/gpu/gpu_render_thread.h) | 43 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc (renamed from content/gpu/gpu_command_buffer_stub.cc) | 28 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.h (renamed from content/gpu/gpu_command_buffer_stub.h) | 6 | ||||
-rw-r--r-- | content/common/gpu/gpu_config.h (renamed from content/gpu/gpu_config.h) | 6 | ||||
-rw-r--r-- | content/common/gpu/gpu_info.cc (renamed from content/common/gpu_info.cc) | 2 | ||||
-rw-r--r-- | content/common/gpu/gpu_info.h (renamed from content/common/gpu_info.h) | 6 | ||||
-rw-r--r-- | content/common/gpu/gpu_info_unittest.cc (renamed from content/common/gpu_info_unittest.cc) | 4 | ||||
-rw-r--r-- | content/common/gpu/gpu_video_decoder.cc (renamed from content/gpu/gpu_video_decoder.cc) | 10 | ||||
-rw-r--r-- | content/common/gpu/gpu_video_decoder.h (renamed from content/gpu/gpu_video_decoder.h) | 8 | ||||
-rw-r--r-- | content/common/gpu/gpu_video_decoder_unittest.cc (renamed from content/gpu/gpu_video_decoder_unittest.cc) | 4 | ||||
-rw-r--r-- | content/common/gpu/gpu_video_service.cc (renamed from content/gpu/gpu_video_service.cc) | 6 | ||||
-rw-r--r-- | content/common/gpu/gpu_video_service.h (renamed from content/gpu/gpu_video_service.h) | 8 | ||||
-rw-r--r-- | content/common/gpu/media/fake_gl_video_decode_engine.cc (renamed from content/gpu/media/fake_gl_video_decode_engine.cc) | 2 | ||||
-rw-r--r-- | content/common/gpu/media/fake_gl_video_decode_engine.h (renamed from content/gpu/media/fake_gl_video_decode_engine.h) | 0 | ||||
-rw-r--r-- | content/common/gpu/media/fake_gl_video_device.cc (renamed from content/gpu/media/fake_gl_video_device.cc) | 2 | ||||
-rw-r--r-- | content/common/gpu/media/fake_gl_video_device.h (renamed from content/gpu/media/fake_gl_video_device.h) | 2 | ||||
-rw-r--r-- | content/common/gpu/media/gpu_video_device.h (renamed from content/gpu/media/gpu_video_device.h) | 0 | ||||
-rw-r--r-- | content/common/gpu/media/mft_angle_video_device.cc (renamed from content/gpu/media/mft_angle_video_device.cc) | 2 | ||||
-rw-r--r-- | content/common/gpu/media/mft_angle_video_device.h (renamed from content/gpu/media/mft_angle_video_device.h) | 2 | ||||
-rw-r--r-- | content/common/gpu/x_util.cc (renamed from content/gpu/x_util.cc) | 2 | ||||
-rw-r--r-- | content/common/gpu/x_util.h (renamed from content/gpu/x_util.h) | 4 | ||||
-rw-r--r-- | content/common/gpu_messages.h | 2 | ||||
-rw-r--r-- | content/content_common.gypi | 47 | ||||
-rw-r--r-- | content/content_gpu.gypi | 33 | ||||
-rw-r--r-- | content/gpu/gpu_child_thread.cc | 7 | ||||
-rw-r--r-- | content/gpu/gpu_child_thread.h | 14 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector.h | 2 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector_unittest.cc | 2 | ||||
-rw-r--r-- | content/gpu/gpu_info_unittest_win.cc | 2 | ||||
-rw-r--r-- | content/gpu/gpu_main.cc | 2 | ||||
-rw-r--r-- | content/renderer/gpu_channel_host.h | 2 |
50 files changed, 251 insertions, 224 deletions
diff --git a/chrome/browser/gpu_data_manager.h b/chrome/browser/gpu_data_manager.h index ade4279..f131b07 100644 --- a/chrome/browser/gpu_data_manager.h +++ b/chrome/browser/gpu_data_manager.h @@ -14,8 +14,8 @@ #include "base/memory/singleton.h" #include "base/values.h" #include "chrome/browser/web_resource/gpu_blacklist_updater.h" +#include "content/common/gpu/gpu_info.h" #include "content/common/gpu_feature_flags.h" -#include "content/common/gpu_info.h" class CommandLine; class DictionaryValue; diff --git a/chrome/browser/gpu_process_host_ui_shim.cc b/chrome/browser/gpu_process_host_ui_shim.cc index 68cb20b..73be07d 100644 --- a/chrome/browser/gpu_process_host_ui_shim.cc +++ b/chrome/browser/gpu_process_host_ui_shim.cc @@ -70,7 +70,7 @@ class UIThreadSender : public IPC::Channel::Sender { DCHECK(!msg->is_sync()); #endif - // When the GpuRenderThread sends an IPC, post it to the UI thread without + // When the GpuChannelManager sends an IPC, post it to the UI thread without // using IPC. bool success = BrowserThread::PostTask( BrowserThread::UI, @@ -82,9 +82,9 @@ class UIThreadSender : public IPC::Channel::Sender { } }; -void ForwardMessageToGpuThread(GpuRenderThread* render_thread, +void ForwardMessageToGpuThread(GpuChannelManager* gpu_channel_manager, IPC::Message* msg) { - bool success = render_thread->OnMessageReceived(*msg); + bool success = gpu_channel_manager->OnMessageReceived(*msg); // If the message was not handled, it is likely it was intended for the // GpuChildThread, which does not exist in single process and in process GPU @@ -163,7 +163,7 @@ GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id, content::CauseForGpuLaunch cause_for_gpu_launch) : host_id_(host_id), gpu_process_(base::kNullProcessHandle), - gpu_render_thread_(NULL), + gpu_channel_manager_(NULL), ui_thread_sender_(NULL) { g_hosts_by_id.AddWithID(this, host_id_); gpu_data_manager_ = GpuDataManager::GetInstance(); @@ -172,7 +172,7 @@ GpuProcessHostUIShim::GpuProcessHostUIShim(int host_id, if (host_id == 0) { gpu_process_ = base::GetCurrentProcessHandle(); ui_thread_sender_ = new UIThreadSender; - gpu_render_thread_ = new GpuRenderThread( + gpu_channel_manager_ = new GpuChannelManager( ui_thread_sender_, NULL, g_browser_process->io_thread()->message_loop(), @@ -278,7 +278,7 @@ bool GpuProcessHostUIShim::Send(IPC::Message* msg) { BrowserThread::GPU, FROM_HERE, NewRunnableFunction(ForwardMessageToGpuThread, - gpu_render_thread_, + gpu_channel_manager_, msg)); } else { success = BrowserThread::PostTask( @@ -488,11 +488,11 @@ GpuProcessHostUIShim::~GpuProcessHostUIShim() { #endif // Ensure these are destroyed on the GPU thread. - if (gpu_render_thread_) { + if (gpu_channel_manager_) { BrowserThread::DeleteSoon(BrowserThread::GPU, FROM_HERE, - gpu_render_thread_); - gpu_render_thread_ = NULL; + gpu_channel_manager_); + gpu_channel_manager_ = NULL; } if (ui_thread_sender_) { BrowserThread::DeleteSoon(BrowserThread::GPU, diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h index f9fafa5..8bcdb23 100644 --- a/chrome/browser/gpu_process_host_ui_shim.h +++ b/chrome/browser/gpu_process_host_ui_shim.h @@ -21,11 +21,11 @@ #include "base/memory/singleton.h" #include "base/process.h" #include "base/threading/non_thread_safe.h" +#include "content/common/gpu/gpu_channel_manager.h" +#include "content/common/gpu/gpu_info.h" #include "content/common/gpu_feature_flags.h" -#include "content/common/gpu_info.h" #include "content/common/gpu_process_launch_causes.h" #include "content/common/message_router.h" -#include "content/gpu/gpu_render_thread.h" #include "ui/gfx/native_widget_types.h" namespace gfx { @@ -209,9 +209,9 @@ class GpuProcessHostUIShim ViewSurfaceMap acquired_surfaces_; // In single process and in process GPU mode, this references the - // GpuRenderThread or null otherwise. It must be called and deleted on the GPU - // thread. - GpuRenderThread* gpu_render_thread_; + // GpuChannelManager or null otherwise. It must be called and deleted on the + // GPU thread. + GpuChannelManager* gpu_channel_manager_; // This is likewise single process / in process GPU specific. This is a Sender // implementation that forwards IPC messages to this UI shim on the UI thread. diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 57b70c0..b85962e 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1886,7 +1886,7 @@ '../content/browser/webui/web_ui_unittest.cc', '../content/common/font_descriptor_mac_unittest.mm', '../content/common/gpu_feature_flags_unittest.cc', - '../content/common/gpu_info_unittest.cc', + '../content/common/gpu/gpu_info_unittest.cc', '../content/common/mru_cache_unittest.cc', '../content/common/notification_service_unittest.cc', '../content/common/process_watcher_unittest.cc', @@ -1900,8 +1900,8 @@ '../content/gpu/gpu_idirect3d9_mock_win.cc', '../content/gpu/gpu_idirect3d9_mock_win.h', '../content/gpu/gpu_info_collector_unittest.cc', - '../content/gpu/gpu_info_unittest_win.cc', - '../content/gpu/gpu_video_decoder_unittest.cc', + '../content/common/gpu/gpu_info_unittest_win.cc', + '../content/common/gpu/gpu_video_decoder_unittest.cc', '../content/renderer/active_notification_tracker_unittest.cc', '../content/renderer/audio_message_filter_unittest.cc', '../content/renderer/gpu_video_decoder_host_unittest.cc', diff --git a/chrome/common/child_process_logging_linux.cc b/chrome/common/child_process_logging_linux.cc index f15536e..a730761 100644 --- a/chrome/common/child_process_logging_linux.cc +++ b/chrome/common/child_process_logging_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -8,7 +8,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/installer/util/google_update_settings.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "googleurl/src/gurl.h" namespace child_process_logging { diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm index 0a13af0..ab3d021 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// 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. @@ -11,7 +11,7 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "chrome/installer/util/google_update_settings.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "googleurl/src/gurl.h" namespace child_process_logging { diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc index 6f9650c..3a937f8 100644 --- a/chrome/common/child_process_logging_win.cc +++ b/chrome/common/child_process_logging_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -12,7 +12,7 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_constants.h" #include "chrome/installer/util/google_update_settings.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "googleurl/src/gurl.h" namespace child_process_logging { diff --git a/chrome/common/chrome_content_gpu_client.h b/chrome/common/chrome_content_gpu_client.h index ad97188..53b3cdf 100644 --- a/chrome/common/chrome_content_gpu_client.h +++ b/chrome/common/chrome_content_gpu_client.h @@ -6,7 +6,7 @@ #define CHROME_COMMON_CHROME_CONTENT_GPU_CLIENT_H_ #pragma once -#include "content/gpu/content_gpu_client.h" +#include "content/common/gpu/content_gpu_client.h" namespace chrome { diff --git a/chrome/test/gpu/gpu_pixel_browsertest.cc b/chrome/test/gpu/gpu_pixel_browsertest.cc index 862d0ba..ae71982 100644 --- a/chrome/test/gpu/gpu_pixel_browsertest.cc +++ b/chrome/test/gpu/gpu_pixel_browsertest.cc @@ -23,7 +23,7 @@ #include "content/browser/gpu_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/browser/DEPS b/content/browser/DEPS index eb0e8c0..f333397 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS @@ -2,7 +2,5 @@ include_rules = [ # The following directories have been refactored, so no new dependencies
# should be added from these directories.
"-chrome/browser/extensions",
-
- "+content/gpu", # For single-process mode.
]
diff --git a/content/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc index ee83df3..50486c9 100644 --- a/content/browser/gpu_blacklist.cc +++ b/content/browser/gpu_blacklist.cc @@ -14,7 +14,7 @@ #include "base/sys_info.h" #include "base/values.h" #include "base/version.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" namespace { diff --git a/content/browser/gpu_blacklist_unittest.cc b/content/browser/gpu_blacklist_unittest.cc index ebcf6ba6..79cc0ac 100644 --- a/content/browser/gpu_blacklist_unittest.cc +++ b/content/browser/gpu_blacklist_unittest.cc @@ -11,7 +11,7 @@ #include "base/path_service.h" #include "base/version.h" #include "content/browser/gpu_blacklist.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "testing/gtest/include/gtest/gtest.h" class GpuBlacklistTest : public testing::Test { diff --git a/content/common/DEPS b/content/common/DEPS new file mode 100644 index 0000000..fd53eb5 --- /dev/null +++ b/content/common/DEPS @@ -0,0 +1,6 @@ +include_rules = [
+ # Don't add any more dependencies on this directory. Refactoring out the
+ # remaining dependency on gpu_watchdog_thread.h is underway.
+ "+content/gpu",
+]
+
diff --git a/content/common/gpu/DEPS b/content/common/gpu/DEPS new file mode 100644 index 0000000..274c1ef --- /dev/null +++ b/content/common/gpu/DEPS @@ -0,0 +1,9 @@ +include_rules = [
+ "+chrome/app",
+ "+gpu/command_buffer",
+ "+libEGL",
+ "+libGLESv2",
+ "+media/base",
+ "+media/video",
+ "+skia",
+]
diff --git a/content/common/gpu/OWNERS b/content/common/gpu/OWNERS new file mode 100644 index 0000000..d73ca87 --- /dev/null +++ b/content/common/gpu/OWNERS @@ -0,0 +1,2 @@ +apatrick@chromium.org
+kbr@chromium.org
diff --git a/content/gpu/content_gpu_client.h b/content/common/gpu/content_gpu_client.h index e87f90b..3df4de2 100644 --- a/content/gpu/content_gpu_client.h +++ b/content/common/gpu/content_gpu_client.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_GPU_CONTENT_GPU_CLIENT_H_ -#define CONTENT_GPU_CONTENT_GPU_CLIENT_H_ +#ifndef CONTENT_COMMON_GPU_CONTENT_GPU_CLIENT_H_ +#define CONTENT_COMMON_GPU_CONTENT_GPU_CLIENT_H_ #pragma once #include "content/common/content_client.h" @@ -21,4 +21,4 @@ class ContentGpuClient { } // namespace content -#endif // CONTENT_GPU_CONTENT_GPU_CLIENT_H_ +#endif // CONTENT_COMMON_GPU_CONTENT_GPU_CLIENT_H_ diff --git a/content/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index b81f9868..8df65cd 100644 --- a/content/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -6,7 +6,7 @@ #include <windows.h> #endif -#include "content/gpu/gpu_channel.h" +#include "content/common/gpu/gpu_channel.h" #include "base/command_line.h" #include "base/process_util.h" @@ -15,23 +15,23 @@ #include "content/common/content_client.h" #include "content/common/content_switches.h" #include "content/common/gpu_messages.h" -#include "content/gpu/gpu_render_thread.h" -#include "content/gpu/gpu_video_service.h" +#include "content/common/gpu/gpu_channel_manager.h" +#include "content/common/gpu/gpu_video_service.h" #include "content/gpu/transport_texture.h" - + #if defined(OS_POSIX) #include "ipc/ipc_channel_posix.h" #endif -GpuChannel::GpuChannel(GpuRenderThread* gpu_render_thread, +GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, GpuWatchdogThread* gpu_watchdog_thread, int renderer_id) - : gpu_render_thread_(gpu_render_thread), + : gpu_channel_manager_(gpu_channel_manager), renderer_id_(renderer_id), renderer_process_(base::kNullProcessHandle), renderer_pid_(base::kNullProcessId), watchdog_thread_(gpu_watchdog_thread) { - DCHECK(gpu_render_thread); + DCHECK(gpu_channel_manager); DCHECK(renderer_id); const CommandLine* command_line = CommandLine::ForCurrentProcess(); log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); @@ -46,6 +46,15 @@ GpuChannel::~GpuChannel() { #endif } +TransportTexture* GpuChannel::GetTransportTexture(int32 route_id) { + return transport_textures_.Lookup(route_id); +} + +void GpuChannel::DestroyTransportTexture(int32 route_id) { + transport_textures_.Remove(route_id); + router_.RemoveRoute(route_id); +} + bool GpuChannel::OnMessageReceived(const IPC::Message& message) { if (log_messages_) { VLOG(1) << "received message @" << &message << " on channel @" << this @@ -69,7 +78,7 @@ bool GpuChannel::OnMessageReceived(const IPC::Message& message) { } void GpuChannel::OnChannelError() { - gpu_render_thread_->RemoveChannel(renderer_id_); + gpu_channel_manager_->RemoveChannel(renderer_id_); } void GpuChannel::OnChannelConnected(int32 peer_pid) { @@ -133,15 +142,6 @@ void GpuChannel::DestroyCommandBufferByViewId(int32 render_view_id) { } #endif -TransportTexture* GpuChannel::GetTransportTexture(int32 route_id) { - return transport_textures_.Lookup(route_id); -} - -void GpuChannel::DestroyTransportTexture(int32 route_id) { - transport_textures_.Remove(route_id); - router_.RemoveRoute(route_id); -} - bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) @@ -155,7 +155,7 @@ bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyVideoDecoder, OnDestroyVideoDecoder) IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateTransportTexture, - OnCreateTransportTexture) + OnCreateTransportTexture) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() DCHECK(handled); @@ -217,7 +217,7 @@ void GpuChannel::OnDestroyCommandBuffer(int32 route_id) { } void GpuChannel::OnCreateVideoDecoder(int32 context_route_id, - int32 decoder_host_id) { + int32 decoder_host_id) { // TODO(cevans): do NOT re-enable this until GpuVideoService has been checked // for integer overflows, including the classic "width * height" overflow. #if 0 @@ -243,6 +243,7 @@ void GpuChannel::OnCreateVideoDecoder(int32 context_route_id, void GpuChannel::OnDestroyVideoDecoder(int32 decoder_id) { #if defined(ENABLE_GPU) + LOG(ERROR) << "GpuChannel::OnDestroyVideoDecoder"; GpuVideoService* service = GpuVideoService::GetInstance(); if (service == NULL) return; @@ -252,21 +253,21 @@ void GpuChannel::OnDestroyVideoDecoder(int32 decoder_id) { void GpuChannel::OnCreateTransportTexture(int32 context_route_id, int32 host_id) { -#if defined(ENABLE_GPU) - GpuCommandBufferStub* stub = stubs_.Lookup(context_route_id); - int32 route_id = GenerateRouteID(); - - scoped_ptr<TransportTexture> transport( - new TransportTexture(this, channel_.get(), stub->processor()->decoder(), - host_id, route_id)); - router_.AddRoute(route_id, transport.get()); - transport_textures_.AddWithID(transport.release(), route_id); - - IPC::Message* msg = new GpuTransportTextureHostMsg_TransportTextureCreated( - host_id, route_id); - Send(msg); -#endif -} + #if defined(ENABLE_GPU) + GpuCommandBufferStub* stub = stubs_.Lookup(context_route_id); + int32 route_id = GenerateRouteID(); + + scoped_ptr<TransportTexture> transport( + new TransportTexture(this, channel_.get(), stub->processor()->decoder(), + host_id, route_id)); + router_.AddRoute(route_id, transport.get()); + transport_textures_.AddWithID(transport.release(), route_id); + + IPC::Message* msg = new GpuTransportTextureHostMsg_TransportTextureCreated( + host_id, route_id); + Send(msg); + #endif + } bool GpuChannel::Init(MessageLoop* io_message_loop, base::WaitableEvent* shutdown_event) { diff --git a/content/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h index 497e47c..ccce837 100644 --- a/content/gpu/gpu_channel.h +++ b/content/common/gpu/gpu_channel.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_GPU_GPU_CHANNEL_H_ -#define CONTENT_GPU_GPU_CHANNEL_H_ +#ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ +#define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ #pragma once #include <set> @@ -14,18 +14,18 @@ #include "base/memory/scoped_ptr.h" #include "base/process.h" #include "build/build_config.h" +#include "content/common/gpu/gpu_command_buffer_stub.h" #include "content/common/message_router.h" -#include "content/gpu/gpu_command_buffer_stub.h" #include "ipc/ipc_sync_channel.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" -class GpuRenderThread; +class GpuChannelManager; class GpuWatchdogThread; struct GPUCreateCommandBufferConfig; class MessageLoop; class TransportTexture; - + namespace base { class WaitableEvent; } @@ -37,15 +37,17 @@ class GpuChannel : public IPC::Channel::Listener, public base::RefCountedThreadSafe<GpuChannel> { public: // Takes ownership of the renderer process handle. - GpuChannel(GpuRenderThread* gpu_render_thread, + GpuChannel(GpuChannelManager* gpu_channel_manager, GpuWatchdogThread* gpu_watchdog_thread, int renderer_id); virtual ~GpuChannel(); bool Init(MessageLoop* io_message_loop, base::WaitableEvent* shutdown_event); - // Get the GpuThread that owns this channel. - GpuRenderThread* gpu_render_thread() const { return gpu_render_thread_; } + // Get the GpuChannelManager that owns this channel. + GpuChannelManager* gpu_channel_manager() const { + return gpu_channel_manager_; + } // Returns the name of the associated IPC channel. std::string GetChannelName(); @@ -77,7 +79,6 @@ class GpuChannel : public IPC::Channel::Listener, int32 route_id, uint64 swap_buffers_count); void DestroyCommandBufferByViewId(int32 render_view_id); #endif - // Get the TransportTexture by ID. TransportTexture* GetTransportTexture(int32 route_id); @@ -99,15 +100,16 @@ class GpuChannel : public IPC::Channel::Listener, uint32 parent_texture_id, int32* route_id); void OnDestroyCommandBuffer(int32 route_id); + void OnCreateVideoDecoder(int32 context_route_id, int32 decoder_host_id); void OnDestroyVideoDecoder(int32 decoder_id); void OnCreateTransportTexture(int32 context_route_id, int32 host_id); - - // The lifetime of objects of this class is managed by a GpuRenderThread. The - // GpuRenderThreads destroy all the GpuChannels that they own when they + + // The lifetime of objects of this class is managed by a GpuChannelManager. + // The GpuChannelManager destroy all the GpuChannels that they own when they // are destroyed. So a raw pointer is safe. - GpuRenderThread* gpu_render_thread_; + GpuChannelManager* gpu_channel_manager_; scoped_ptr<IPC::SyncChannel> channel_; @@ -139,4 +141,4 @@ class GpuChannel : public IPC::Channel::Listener, DISALLOW_COPY_AND_ASSIGN(GpuChannel); }; -#endif // CONTENT_GPU_GPU_CHANNEL_H_ +#endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ diff --git a/content/gpu/gpu_render_thread.cc b/content/common/gpu/gpu_channel_manager.cc index 784d3e5..af2c188 100644 --- a/content/gpu/gpu_render_thread.cc +++ b/content/common/gpu/gpu_channel_manager.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/gpu/gpu_render_thread.h" +#include "content/common/gpu/gpu_channel_manager.h" #include <string> #include <vector> @@ -15,17 +15,15 @@ #include "chrome/common/chrome_switches.h" #include "content/common/child_process.h" #include "content/common/gpu_messages.h" -#include "content/gpu/gpu_child_thread.h" -#include "content/gpu/gpu_info_collector.h" #include "content/gpu/gpu_watchdog_thread.h" #include "ipc/ipc_channel_handle.h" #include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_implementation.h" -GpuRenderThread::GpuRenderThread(IPC::Message::Sender* browser_channel, - GpuWatchdogThread* gpu_watchdog_thread, - MessageLoop* io_message_loop, - base::WaitableEvent* shutdown_event) +GpuChannelManager::GpuChannelManager(IPC::Message::Sender* browser_channel, + GpuWatchdogThread* gpu_watchdog_thread, + MessageLoop* io_message_loop, + base::WaitableEvent* shutdown_event) : io_message_loop_(io_message_loop), shutdown_event_(shutdown_event), browser_channel_(browser_channel), @@ -35,18 +33,18 @@ GpuRenderThread::GpuRenderThread(IPC::Message::Sender* browser_channel, DCHECK(shutdown_event); } -GpuRenderThread::~GpuRenderThread() { +GpuChannelManager::~GpuChannelManager() { gpu_channels_.clear(); } -void GpuRenderThread::RemoveChannel(int renderer_id) { +void GpuChannelManager::RemoveChannel(int renderer_id) { gpu_channels_.erase(renderer_id); } -bool GpuRenderThread::OnMessageReceived(const IPC::Message& msg) { +bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { bool msg_is_ok = true; bool handled = true; - IPC_BEGIN_MESSAGE_MAP_EX(GpuRenderThread, msg, msg_is_ok) + IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, @@ -63,11 +61,11 @@ bool GpuRenderThread::OnMessageReceived(const IPC::Message& msg) { return handled; } -bool GpuRenderThread::Send(IPC::Message* msg) { +bool GpuChannelManager::Send(IPC::Message* msg) { return browser_channel_->Send(msg); } -void GpuRenderThread::OnEstablishChannel(int renderer_id) { +void GpuChannelManager::OnEstablishChannel(int renderer_id) { scoped_refptr<GpuChannel> channel; IPC::ChannelHandle channel_handle; GPUInfo gpu_info; @@ -98,7 +96,8 @@ void GpuRenderThread::OnEstablishChannel(int renderer_id) { Send(new GpuHostMsg_ChannelEstablished(channel_handle)); } -void GpuRenderThread::OnCloseChannel(const IPC::ChannelHandle& channel_handle) { +void GpuChannelManager::OnCloseChannel( + const IPC::ChannelHandle& channel_handle) { for (GpuChannelMap::iterator iter = gpu_channels_.begin(); iter != gpu_channels_.end(); ++iter) { if (iter->second->GetChannelName() == channel_handle.name) { @@ -108,11 +107,11 @@ void GpuRenderThread::OnCloseChannel(const IPC::ChannelHandle& channel_handle) { } } -void GpuRenderThread::OnSynchronize() { +void GpuChannelManager::OnSynchronize() { Send(new GpuHostMsg_SynchronizeReply()); } -void GpuRenderThread::OnCreateViewCommandBuffer( +void GpuChannelManager::OnCreateViewCommandBuffer( gfx::PluginWindowHandle window, int32 render_view_id, int32 renderer_id, @@ -129,7 +128,7 @@ void GpuRenderThread::OnCreateViewCommandBuffer( } #if defined(OS_MACOSX) -void GpuRenderThread::OnAcceleratedSurfaceBuffersSwappedACK( +void GpuChannelManager::OnAcceleratedSurfaceBuffersSwappedACK( int renderer_id, int32 route_id, uint64 swap_buffers_count) { GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); if (iter == gpu_channels_.end()) @@ -137,7 +136,7 @@ void GpuRenderThread::OnAcceleratedSurfaceBuffersSwappedACK( scoped_refptr<GpuChannel> channel = iter->second; channel->AcceleratedSurfaceBuffersSwapped(route_id, swap_buffers_count); } -void GpuRenderThread::OnDestroyCommandBuffer( +void GpuChannelManager::OnDestroyCommandBuffer( int renderer_id, int32 renderer_view_id) { GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); if (iter == gpu_channels_.end()) diff --git a/content/gpu/gpu_render_thread.h b/content/common/gpu/gpu_channel_manager.h index 6292864..b32136f 100644 --- a/content/gpu/gpu_render_thread.h +++ b/content/common/gpu/gpu_channel_manager.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_GPU_GPU_RENDER_THREAD_H_ -#define CONTENT_GPU_GPU_RENDER_THREAD_H_ +#ifndef CONTENT_GPU_GPU_CHANNEL_MANAGER_H_ +#define CONTENT_GPU_GPU_CHANNEL_MANAGER_H_ #pragma once #include <string> @@ -16,10 +16,9 @@ #include "base/time.h" #include "build/build_config.h" #include "content/common/child_thread.h" -#include "content/common/gpu_info.h" -#include "content/gpu/gpu_channel.h" -#include "content/gpu/gpu_config.h" -#include "content/gpu/x_util.h" +#include "content/common/gpu/gpu_channel.h" +#include "content/common/gpu/gpu_config.h" +#include "content/common/gpu/x_util.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_message.h" #include "ui/gfx/native_widget_types.h" @@ -28,24 +27,24 @@ namespace IPC { struct ChannelHandle; } -// A GpuRenderThread is a thread responsible for issuing rendering commands to -// a GPU. There is currently only one per GPU process. This might change. Assume -// there are many, all running on different threads. +// A GpuChannelManager is a thread responsible for issuing rendering commands +// managing the lifetimes of GPU channels and forwarding IPC requests from the +// browser process to them based on the corresponding renderer ID. // -// A GpuRenderThread can also be hosted in the browser process in single process -// or in-process GPU modes. In this case there is no corresponding +// A GpuChannelManager can also be hosted in the browser process in single +// process or in-process GPU modes. In this case there is no corresponding // GpuChildThread and this is the reason the GpuChildThread is referenced via // a pointer to IPC::Message::Sender, which can be implemented by other hosts // to send IPC messages to the browser process IO thread on the -// GpuRenderThread's behalf. -class GpuRenderThread : public IPC::Channel::Listener, - public IPC::Message::Sender { +// GpuChannelManager's behalf. +class GpuChannelManager : public IPC::Channel::Listener, + public IPC::Message::Sender { public: - GpuRenderThread(IPC::Message::Sender* browser_channel, - GpuWatchdogThread* gpu_watchdog_thread, - MessageLoop* io_message_loop, - base::WaitableEvent* shutdown_event); - ~GpuRenderThread(); + GpuChannelManager(IPC::Message::Sender* browser_channel, + GpuWatchdogThread* gpu_watchdog_thread, + MessageLoop* io_message_loop, + base::WaitableEvent* shutdown_event); + ~GpuChannelManager(); // Remove the channel for a particular renderer. void RemoveChannel(int renderer_id); @@ -75,7 +74,7 @@ class GpuRenderThread : public IPC::Channel::Listener, MessageLoop* io_message_loop_; base::WaitableEvent* shutdown_event_; - // Either an IPC channel to the browser or, if the GpuRenderThread is + // Either an IPC channel to the browser or, if the GpuChannelManager is // running in the browser process, a Sender implementation that will post // IPC messages to the UI thread. IPC::Message::Sender* browser_channel_; @@ -87,7 +86,7 @@ class GpuRenderThread : public IPC::Channel::Listener, GpuChannelMap gpu_channels_; GpuWatchdogThread* watchdog_thread_; - DISALLOW_COPY_AND_ASSIGN(GpuRenderThread); + DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); }; -#endif // CONTENT_GPU_GPU_RENDER_THREAD_H_ +#endif // CONTENT_GPU_GPU_CHANNEL_MANAGER_H_ diff --git a/content/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index 2d0ec51..e237dd1 100644 --- a/content/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -7,11 +7,11 @@ #include "base/process_util.h" #include "base/shared_memory.h" #include "build/build_config.h" -#include "content/common/gpu_messages.h" #include "content/common/child_thread.h" -#include "content/gpu/gpu_channel.h" -#include "content/gpu/gpu_command_buffer_stub.h" -#include "content/gpu/gpu_render_thread.h" +#include "content/common/gpu_messages.h" +#include "content/common/gpu/gpu_channel.h" +#include "content/common/gpu/gpu_channel_manager.h" +#include "content/common/gpu/gpu_command_buffer_stub.h" #include "content/gpu/gpu_watchdog_thread.h" #include "gpu/common/gpu_trace_event.h" @@ -147,8 +147,8 @@ bool GpuCommandBufferStub::CreateCompositorWindow() { } void GpuCommandBufferStub::OnCompositorWindowPainted() { - GpuRenderThread* render_thread = channel_->gpu_render_thread(); - render_thread->Send(new GpuHostMsg_ScheduleComposite( + GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); + gpu_channel_manager->Send(new GpuHostMsg_ScheduleComposite( renderer_id_, render_view_id_)); } #endif // defined(OS_WIN) @@ -165,8 +165,8 @@ GpuCommandBufferStub::~GpuCommandBufferStub() { } #endif // defined(OS_WIN) - GpuRenderThread* render_thread = channel_->gpu_render_thread(); - render_thread->Send(new GpuHostMsg_DestroyCommandBuffer( + GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); + gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer( handle_, renderer_id_, render_view_id_)); } @@ -368,7 +368,7 @@ void GpuCommandBufferStub::OnSwapBuffers() { #if defined(OS_MACOSX) void GpuCommandBufferStub::OnSetWindowSize(const gfx::Size& size) { - GpuRenderThread* gpu_render_thread = channel_->gpu_render_thread(); + GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); // Try using the IOSurface version first. uint64 new_backing_store = processor_->SetWindowSizeForIOSurface(size); if (new_backing_store) { @@ -379,7 +379,7 @@ void GpuCommandBufferStub::OnSetWindowSize(const gfx::Size& size) { params.width = size.width(); params.height = size.height(); params.identifier = new_backing_store; - gpu_render_thread->Send( + gpu_channel_manager->Send( new GpuHostMsg_AcceleratedSurfaceSetIOSurface(params)); } else { // TODO(kbr): figure out what to do here. It wouldn't be difficult @@ -391,7 +391,7 @@ void GpuCommandBufferStub::OnSetWindowSize(const gfx::Size& size) { void GpuCommandBufferStub::SwapBuffersCallback() { OnSwapBuffers(); - GpuRenderThread* gpu_render_thread = channel_->gpu_render_thread(); + GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; params.renderer_id = renderer_id_; params.render_view_id = render_view_id_; @@ -399,7 +399,7 @@ void GpuCommandBufferStub::SwapBuffersCallback() { params.surface_id = processor_->GetSurfaceId(); params.route_id = route_id(); params.swap_buffers_count = processor_->swap_buffers_count(); - gpu_render_thread->Send( + gpu_channel_manager->Send( new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); } @@ -417,9 +417,9 @@ void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { processor_->decoder()->UpdateOffscreenFrameBufferSize(); } else { #if defined(OS_LINUX) && !defined(TOUCH_UI) - GpuRenderThread* gpu_render_thread = channel_->gpu_render_thread(); + GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); bool result = false; - gpu_render_thread->Send( + gpu_channel_manager->Send( new GpuHostMsg_ResizeXID(handle_, size, &result)); #elif defined(OS_WIN) HWND hwnd = static_cast<HWND>(compositor_window_); diff --git a/content/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 1af3afa..0010b17 100644 --- a/content/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_GPU_GPU_COMMAND_BUFFER_STUB_H_ -#define CONTENT_GPU_GPU_COMMAND_BUFFER_STUB_H_ +#ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ +#define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ #pragma once #if defined(ENABLE_GPU) @@ -138,4 +138,4 @@ class GpuCommandBufferStub #endif // defined(ENABLE_GPU) -#endif // CONTENT_GPU_GPU_COMMAND_BUFFER_STUB_H_ +#endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ diff --git a/content/gpu/gpu_config.h b/content/common/gpu/gpu_config.h index 8aba7bf..8156948 100644 --- a/content/gpu/gpu_config.h +++ b/content/common/gpu/gpu_config.h @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_GPU_GPU_CONFIG_H_ -#define CONTENT_GPU_GPU_CONFIG_H_ +#ifndef CONTENT_COMMON_GPU_GPU_CONFIG_H_ +#define CONTENT_COMMON_GPU_GPU_CONFIG_H_ #pragma once // This file declares common preprocessor configuration for the GPU process. #include "build/build_config.h" -#endif // CONTENT_GPU_GPU_CONFIG_H_ +#endif // CONTENT_COMMON_GPU_GPU_CONFIG_H_ diff --git a/content/common/gpu_info.cc b/content/common/gpu/gpu_info.cc index 6b4d0a7..f067baf 100644 --- a/content/common/gpu_info.cc +++ b/content/common/gpu/gpu_info.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" GPUInfo::GPUInfo() : finalized(false), diff --git a/content/common/gpu_info.h b/content/common/gpu/gpu_info.h index 402535e..678cb86 100644 --- a/content/common/gpu_info.h +++ b/content/common/gpu/gpu_info.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_COMMON_GPU_INFO_H_ -#define CONTENT_COMMON_GPU_INFO_H_ +#ifndef CONTENT_COMMON_GPU_GPU_INFO_H_ +#define CONTENT_COMMON_GPU_GPU_INFO_H_ #pragma once // Provides access to the GPU information for the system @@ -83,4 +83,4 @@ struct GPUInfo { #endif }; -#endif // CONTENT_COMMON_GPU_INFO_H_ +#endif // CONTENT_COMMON_GPU_GPU_INFO_H_ diff --git a/content/common/gpu_info_unittest.cc b/content/common/gpu/gpu_info_unittest.cc index 34f0ee6..887b5f1 100644 --- a/content/common/gpu_info_unittest.cc +++ b/content/common/gpu/gpu_info_unittest.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "testing/gtest/include/gtest/gtest.h" // Test that an empty GPUInfo has valid members diff --git a/content/gpu/gpu_video_decoder.cc b/content/common/gpu/gpu_video_decoder.cc index 0416fcd..1b89a01 100644 --- a/content/gpu/gpu_video_decoder.cc +++ b/content/common/gpu/gpu_video_decoder.cc @@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/gpu/gpu_video_decoder.h" +#include "content/common/gpu/gpu_video_decoder.h" #include "base/command_line.h" #include "content/common/child_thread.h" +#include "content/common/gpu/gpu_channel.h" +#include "content/common/gpu/media/fake_gl_video_device.h" +#include "content/common/gpu/media/fake_gl_video_decode_engine.h" #include "content/common/gpu_messages.h" -#include "content/gpu/gpu_channel.h" -#include "content/gpu/media/fake_gl_video_decode_engine.h" -#include "content/gpu/media/fake_gl_video_device.h" #include "media/base/data_buffer.h" #include "media/base/media_switches.h" #include "media/base/video_frame.h" #if defined(OS_WIN) -#include "content/gpu/media/mft_angle_video_device.h" +#include "content/common/gpu/media/mft_angle_video_device.h" #include "media/video/mft_h264_decode_engine.h" #include <d3d9.h> #endif diff --git a/content/gpu/gpu_video_decoder.h b/content/common/gpu/gpu_video_decoder.h index 87d214e..03cb9dc 100644 --- a/content/gpu/gpu_video_decoder.h +++ b/content/common/gpu/gpu_video_decoder.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_GPU_GPU_VIDEO_DECODER_H_ -#define CONTENT_GPU_GPU_VIDEO_DECODER_H_ +#ifndef CONTENT_COMMON_GPU_GPU_VIDEO_DECODER_H_ +#define CONTENT_COMMON_GPU_GPU_VIDEO_DECODER_H_ #include <map> #include <vector> @@ -14,7 +14,7 @@ #include "base/memory/scoped_ptr.h" #include "base/process.h" #include "base/shared_memory.h" -#include "content/gpu/media/gpu_video_device.h" +#include "content/common/gpu/media/gpu_video_device.h" #include "media/video/video_decode_context.h" #include "media/video/video_decode_engine.h" #include "ipc/ipc_channel.h" @@ -206,4 +206,4 @@ class GpuVideoDecoder DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); }; -#endif // CONTENT_GPU_GPU_VIDEO_DECODER_H_ +#endif // CONTENT_COMMON_GPU_GPU_VIDEO_DECODER_H_ diff --git a/content/gpu/gpu_video_decoder_unittest.cc b/content/common/gpu/gpu_video_decoder_unittest.cc index afb396b..b9c846f 100644 --- a/content/gpu/gpu_video_decoder_unittest.cc +++ b/content/common/gpu/gpu_video_decoder_unittest.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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 "base/message_loop.h" #include "base/process.h" +#include "content/common/gpu/gpu_video_decoder.h" #include "content/common/gpu_messages.h" -#include "content/gpu/gpu_video_decoder.h" #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" #include "ipc/ipc_message_utils.h" #include "media/base/pipeline.h" diff --git a/content/gpu/gpu_video_service.cc b/content/common/gpu/gpu_video_service.cc index 355aabc..3128534 100644 --- a/content/gpu/gpu_video_service.cc +++ b/content/common/gpu/gpu_video_service.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/common/gpu/gpu_channel.h" +#include "content/common/gpu/gpu_video_decoder.h" +#include "content/common/gpu/gpu_video_service.h" #include "content/common/gpu_messages.h" -#include "content/gpu/gpu_channel.h" -#include "content/gpu/gpu_video_decoder.h" -#include "content/gpu/gpu_video_service.h" struct GpuVideoService::GpuVideoDecoderInfo { scoped_refptr<GpuVideoDecoder> decoder; diff --git a/content/gpu/gpu_video_service.h b/content/common/gpu/gpu_video_service.h index 91f9261e..8c39db3 100644 --- a/content/gpu/gpu_video_service.h +++ b/content/common/gpu/gpu_video_service.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_GPU_GPU_VIDEO_SERVICE_H_ -#define CONTENT_GPU_GPU_VIDEO_SERVICE_H_ +#ifndef CONTENT_COMMON_GPU_GPU_VIDEO_SERVICE_H_ +#define CONTENT_COMMON_GPU_GPU_VIDEO_SERVICE_H_ #include <map> #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" -#include "content/gpu/gpu_video_decoder.h" +#include "content/common/gpu/gpu_video_decoder.h" #include "ipc/ipc_channel.h" class GpuChannel; @@ -48,4 +48,4 @@ class GpuVideoService : public IPC::Channel::Listener { DISALLOW_COPY_AND_ASSIGN(GpuVideoService); }; -#endif // CONTENT_GPU_GPU_VIDEO_SERVICE_H_ +#endif // CONTENT_COMMON_GPU_GPU_VIDEO_SERVICE_H_ diff --git a/content/gpu/media/fake_gl_video_decode_engine.cc b/content/common/gpu/media/fake_gl_video_decode_engine.cc index 0486a01..02fa4fb 100644 --- a/content/gpu/media/fake_gl_video_decode_engine.cc +++ b/content/common/gpu/media/fake_gl_video_decode_engine.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/gpu/media/fake_gl_video_decode_engine.h" +#include "content/common/gpu/media/fake_gl_video_decode_engine.h" #include "media/base/limits.h" #include "media/base/video_frame.h" diff --git a/content/gpu/media/fake_gl_video_decode_engine.h b/content/common/gpu/media/fake_gl_video_decode_engine.h index 899c84f..899c84f 100644 --- a/content/gpu/media/fake_gl_video_decode_engine.h +++ b/content/common/gpu/media/fake_gl_video_decode_engine.h diff --git a/content/gpu/media/fake_gl_video_device.cc b/content/common/gpu/media/fake_gl_video_device.cc index 18fb09e..172b701 100644 --- a/content/gpu/media/fake_gl_video_device.cc +++ b/content/common/gpu/media/fake_gl_video_device.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/gpu/media/fake_gl_video_device.h" +#include "content/common/gpu/media/fake_gl_video_device.h" #include "media/base/video_frame.h" #include "ui/gfx/gl/gl_bindings.h" diff --git a/content/gpu/media/fake_gl_video_device.h b/content/common/gpu/media/fake_gl_video_device.h index f5acb1a..4f5233b 100644 --- a/content/gpu/media/fake_gl_video_device.h +++ b/content/common/gpu/media/fake_gl_video_device.h @@ -5,7 +5,7 @@ #ifndef CONTENT_GPU_MEDIA_FAKE_GL_VIDEO_DEVICE_H_ #define CONTENT_GPU_MEDIA_FAKE_GL_VIDEO_DEVICE_H_ -#include "content/gpu/media/gpu_video_device.h" +#include "content/common/gpu/media/gpu_video_device.h" // A simple GpuVideoDevice that create VideoFrame with GL textures. // It uploads frames in RGBA format in system memory to the GL texture. diff --git a/content/gpu/media/gpu_video_device.h b/content/common/gpu/media/gpu_video_device.h index dcba5f2..dcba5f2 100644 --- a/content/gpu/media/gpu_video_device.h +++ b/content/common/gpu/media/gpu_video_device.h diff --git a/content/gpu/media/mft_angle_video_device.cc b/content/common/gpu/media/mft_angle_video_device.cc index 355ffa3..a044e1aa 100644 --- a/content/gpu/media/mft_angle_video_device.cc +++ b/content/common/gpu/media/mft_angle_video_device.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/gpu/media/mft_angle_video_device.h" +#include "content/common/gpu/media/mft_angle_video_device.h" #include <d3d9.h> diff --git a/content/gpu/media/mft_angle_video_device.h b/content/common/gpu/media/mft_angle_video_device.h index 6d85de2..8abe461 100644 --- a/content/gpu/media/mft_angle_video_device.h +++ b/content/common/gpu/media/mft_angle_video_device.h @@ -6,7 +6,7 @@ #define CONTENT_GPU_MEDIA_MFT_ANGLE_VIDEO_DEVICE_H_ #include "base/scoped_comptr_win.h" -#include "content/gpu/media/gpu_video_device.h" +#include "content/common/gpu/media/gpu_video_device.h" struct IDirect3DDevice9; extern "C" const GUID IID_IDirect3DDevice9; diff --git a/content/gpu/x_util.cc b/content/common/gpu/x_util.cc index 72089e6..486b00e 100644 --- a/content/gpu/x_util.cc +++ b/content/common/gpu/x_util.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/gpu/x_util.h" +#include "content/common/gpu/x_util.h" #include <X11/Xutil.h> diff --git a/content/gpu/x_util.h b/content/common/gpu/x_util.h index c854080..c6305c5 100644 --- a/content/gpu/x_util.h +++ b/content/common/gpu/x_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. @@ -10,7 +10,7 @@ // be a NOP on non-Linux ones. #include "build/build_config.h" -#include "content/gpu/gpu_config.h" +#include "content/common/gpu/gpu_config.h" #if defined(OS_LINUX) diff --git a/content/common/gpu_messages.h b/content/common/gpu_messages.h index 5a188c4..6a8dc4f 100644 --- a/content/common/gpu_messages.h +++ b/content/common/gpu_messages.h @@ -8,7 +8,7 @@ #include "base/shared_memory.h" #include "content/common/common_param_traits.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "content/common/gpu_process_launch_causes.h" #include "gpu/command_buffer/common/command_buffer.h" #include "gpu/ipc/gpu_command_buffer_traits.h" diff --git a/content/content_common.gypi b/content/content_common.gypi index a8e4def..2c0b552 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -13,6 +13,7 @@ '../third_party/icu/icu.gyp:icuuc', '../third_party/npapi/npapi.gyp:npapi', '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', + '../ui/gfx/gl/gl.gyp:gl', '../webkit/support/webkit_support.gyp:appcache', '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', @@ -98,8 +99,25 @@ 'common/geolocation_messages.h', 'common/geoposition.cc', 'common/geoposition.h', - 'common/gpu_info.cc', - 'common/gpu_info.h', + 'common/gpu/content_gpu_client.h', + 'common/gpu/gpu_channel.cc', + 'common/gpu/gpu_channel.h', + 'common/gpu/gpu_channel_manager.cc', + 'common/gpu/gpu_channel_manager.h', + 'common/gpu/gpu_command_buffer_stub.cc', + 'common/gpu/gpu_command_buffer_stub.h', + 'common/gpu/gpu_config.h', + 'common/gpu/gpu_info.cc', + 'common/gpu/gpu_info.h', + 'common/gpu/gpu_video_decoder.cc', + 'common/gpu/gpu_video_decoder.h', + 'common/gpu/gpu_video_service.cc', + 'common/gpu/gpu_video_service.h', + 'common/gpu/media/gpu_video_device.h', + 'common/gpu/media/fake_gl_video_decode_engine.cc', + 'common/gpu/media/fake_gl_video_decode_engine.h', + 'common/gpu/media/fake_gl_video_device.cc', + 'common/gpu/media/fake_gl_video_device.h', 'common/gpu_process_launch_causes.h', 'common/gpu_messages.h', 'common/hi_res_timer_manager_posix.cc', @@ -195,6 +213,20 @@ 'conditions': [ ['OS=="win"', { 'msvs_guid': '062E9260-304A-4657-A74C-0D3AA1A0A0A4', + 'sources': [ + 'common/gpu/media/mft_angle_video_device.cc', + 'common/gpu/media/mft_angle_video_device.h', + ], + 'include_dirs': [ + '<(DEPTH)/third_party/angle/include', + '<(DEPTH)/third_party/angle/src', + '<(DEPTH)/third_party/wtl/include', + '$(DXSDK_DIR)/include', + ], + 'dependencies': [ + '../third_party/angle/src/build_angle.gyp:libEGL', + '../third_party/angle/src/build_angle.gyp:libGLESv2', + ], }], ['OS!="linux"', { 'sources!': [ @@ -221,11 +253,22 @@ '../build/linux/system.gyp:gtk', ], }], + ['OS=="linux" and target_arch!="arm"', { + 'sources': [ + 'common/gpu/x_util.cc', + 'common/gpu/x_util.h', + ], + }], ['toolkit_views==1', { 'sources': [ 'common/native_web_keyboard_event_views.cc', ], }], + ['enable_gpu==1', { + 'dependencies': [ + '../gpu/gpu.gyp:command_buffer_service', + ], + }], ], }, ], diff --git a/content/content_gpu.gypi b/content/content_gpu.gypi index cebb9ec..ffa7c4c 100644 --- a/content/content_gpu.gypi +++ b/content/content_gpu.gypi @@ -14,17 +14,10 @@ 'dependencies': [ 'content_common', '../base/base.gyp:base', - '../media/media.gyp:media', '../skia/skia.gyp:skia', '../ui/gfx/gl/gl.gyp:gl', ], 'sources': [ - 'gpu/content_gpu_client.h', - 'gpu/gpu_channel.cc', - 'gpu/gpu_channel.h', - 'gpu/gpu_command_buffer_stub.cc', - 'gpu/gpu_command_buffer_stub.h', - 'gpu/gpu_config.h', 'gpu/gpu_dx_diagnostics_win.cc', 'gpu/gpu_info_collector_linux.cc', 'gpu/gpu_info_collector_mac.mm', @@ -36,19 +29,8 @@ 'gpu/gpu_process.h', 'gpu/gpu_child_thread.cc', 'gpu/gpu_child_thread.h', - 'gpu/gpu_render_thread.cc', - 'gpu/gpu_render_thread.h', - 'gpu/gpu_video_decoder.cc', - 'gpu/gpu_video_decoder.h', - 'gpu/gpu_video_service.cc', - 'gpu/gpu_video_service.h', 'gpu/gpu_watchdog_thread.cc', 'gpu/gpu_watchdog_thread.h', - 'gpu/media/gpu_video_device.h', - 'gpu/media/fake_gl_video_decode_engine.cc', - 'gpu/media/fake_gl_video_decode_engine.h', - 'gpu/media/fake_gl_video_device.cc', - 'gpu/media/fake_gl_video_device.h', 'gpu/transport_texture.cc', 'gpu/transport_texture.h', ], @@ -111,21 +93,6 @@ ], }, ], - 'sources': [ - 'gpu/media/mft_angle_video_device.cc', - 'gpu/media/mft_angle_video_device.h', - ], - }], - ['OS=="linux" and target_arch!="arm"', { - 'sources': [ - 'gpu/x_util.cc', - 'gpu/x_util.h', - ], - }], - ['enable_gpu==1', { - 'dependencies': [ - '../gpu/gpu.gyp:command_buffer_service', - ], }], ], }, diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc index 9597c0c..f0a8aad 100644 --- a/content/gpu/gpu_child_thread.cc +++ b/content/gpu/gpu_child_thread.cc @@ -13,8 +13,8 @@ #include "build/build_config.h" #include "chrome/common/chrome_switches.h" #include "content/common/child_process.h" +#include "content/common/gpu/content_gpu_client.h" #include "content/common/gpu_messages.h" -#include "content/gpu/content_gpu_client.h" #include "content/gpu/gpu_info_collector.h" #include "content/gpu/gpu_watchdog_thread.h" #include "ipc/ipc_channel_handle.h" @@ -110,7 +110,8 @@ bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { if (handled) return true; - return render_thread_.get() && render_thread_->OnMessageReceived(msg); + return gpu_channel_manager_.get() && + gpu_channel_manager_->OnMessageReceived(msg); } void GpuChildThread::OnInitialize() { @@ -187,7 +188,7 @@ void GpuChildThread::OnInitialize() { // Defer creation of the render thread. This is to prevent it from handling // IPC messages before the sandbox has been enabled and all other necessary // initialization has succeeded. - render_thread_.reset(new GpuRenderThread( + gpu_channel_manager_.reset(new GpuChannelManager( this, watchdog_thread_, ChildProcess::current()->io_message_loop(), diff --git a/content/gpu/gpu_child_thread.h b/content/gpu/gpu_child_thread.h index b488725..b8853fa 100644 --- a/content/gpu/gpu_child_thread.h +++ b/content/gpu/gpu_child_thread.h @@ -15,11 +15,11 @@ #include "base/time.h" #include "build/build_config.h" #include "content/common/child_thread.h" -#include "content/common/gpu_info.h" -#include "content/gpu/gpu_channel.h" -#include "content/gpu/gpu_config.h" -#include "content/gpu/gpu_render_thread.h" -#include "content/gpu/x_util.h" +#include "content/common/gpu/gpu_channel.h" +#include "content/common/gpu/gpu_channel_manager.h" +#include "content/common/gpu/gpu_config.h" +#include "content/common/gpu/gpu_info.h" +#include "content/common/gpu/x_util.h" #include "ui/gfx/native_widget_types.h" namespace IPC { @@ -34,7 +34,7 @@ class GpuWatchdogThread; // The main thread of the GPU child process. There will only ever be one of // these per process. It does process initialization and shutdown. It forwards -// IPC messages to GpuRenderThread, which is responsible for issuing rendering +// IPC messages to GpuChannelManager, which is responsible for issuing rendering // commands to the GPU. class GpuChildThread : public ChildThread { public: @@ -79,7 +79,7 @@ class GpuChildThread : public ChildThread { bool collecting_dx_diagnostics_; #endif - scoped_ptr<GpuRenderThread> render_thread_; + scoped_ptr<GpuChannelManager> gpu_channel_manager_; // Information about the GPU, such as device and vendor ID. GPUInfo gpu_info_; diff --git a/content/gpu/gpu_info_collector.h b/content/gpu/gpu_info_collector.h index eb669a0..f911c9c 100644 --- a/content/gpu/gpu_info_collector.h +++ b/content/gpu/gpu_info_collector.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "build/build_config.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" struct IDirect3D9; diff --git a/content/gpu/gpu_info_collector_unittest.cc b/content/gpu/gpu_info_collector_unittest.cc index d787e89..5196c557 100644 --- a/content/gpu/gpu_info_collector_unittest.cc +++ b/content/gpu/gpu_info_collector_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/memory/scoped_ptr.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "content/gpu/gpu_info_collector.h" #include "gpu/command_buffer/common/gl_mock.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/content/gpu/gpu_info_unittest_win.cc b/content/gpu/gpu_info_unittest_win.cc index 0629fbd..03a00f3 100644 --- a/content/gpu/gpu_info_unittest_win.cc +++ b/content/gpu/gpu_info_unittest_win.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/memory/scoped_ptr.h" -#include "content/common/gpu_info.h" +#include "content/gpu/common/gpu/gpu_info.h" #include "content/gpu/gpu_idirect3d9_mock_win.h" #include "content/gpu/gpu_info_collector.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc index 4076ad8..422175c 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc @@ -15,9 +15,9 @@ #include "base/threading/platform_thread.h" #include "build/build_config.h" #include "content/common/content_switches.h" +#include "content/common/gpu/gpu_config.h" #include "content/common/main_function_params.h" #include "content/gpu/gpu_child_thread.h" -#include "content/gpu/gpu_config.h" #include "content/gpu/gpu_process.h" #if defined(OS_MACOSX) diff --git a/content/renderer/gpu_channel_host.h b/content/renderer/gpu_channel_host.h index c39652f..fa1d60d 100644 --- a/content/renderer/gpu_channel_host.h +++ b/content/renderer/gpu_channel_host.h @@ -12,7 +12,7 @@ #include "base/hash_tables.h" #include "base/memory/scoped_ptr.h" #include "base/process_util.h" -#include "content/common/gpu_info.h" +#include "content/common/gpu/gpu_info.h" #include "content/common/message_router.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_sync_channel.h" |