diff options
63 files changed, 312 insertions, 989 deletions
diff --git a/chrome/browser/gpu_data_manager.h b/chrome/browser/gpu_data_manager.h index 1e4b0d4..112405e 100644 --- a/chrome/browser/gpu_data_manager.h +++ b/chrome/browser/gpu_data_manager.h @@ -14,12 +14,11 @@ #include "base/values.h" #include "chrome/browser/web_resource/gpu_blacklist_updater.h" #include "chrome/common/gpu_feature_flags.h" -#include "chrome/common/gpu_info.h" +#include "content/common/gpu_info.h" class CommandLine; class DictionaryValue; class GpuBlacklist; -struct GPUInfo; class GpuDataManager { public: diff --git a/chrome/browser/gpu_process_host_ui_shim.cc b/chrome/browser/gpu_process_host_ui_shim.cc index b7d0792..2533a05 100644 --- a/chrome/browser/gpu_process_host_ui_shim.cc +++ b/chrome/browser/gpu_process_host_ui_shim.cc @@ -8,13 +8,13 @@ #include "chrome/browser/gpu_process_host_ui_shim.h" #include "base/id_map.h" -#include "chrome/common/gpu_messages.h" #include "chrome/browser/gpu_data_manager.h" #include "content/browser/browser_thread.h" #include "content/browser/gpu_process_host.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "content/common/gpu_messages.h" #if defined(OS_LINUX) // These two #includes need to come after gpu_messages.h. diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h index 1856f14..ef80444 100644 --- a/chrome/browser/gpu_process_host_ui_shim.h +++ b/chrome/browser/gpu_process_host_ui_shim.h @@ -21,7 +21,7 @@ #include "base/singleton.h" #include "base/threading/non_thread_safe.h" #include "chrome/common/gpu_feature_flags.h" -#include "chrome/common/gpu_info.h" +#include "content/common/gpu_info.h" #include "content/common/message_router.h" #include "ui/gfx/native_widget_types.h" diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 741b29a..08317f7 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -51,7 +51,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" -#include "chrome/common/gpu_messages.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/pref_names.h" @@ -92,6 +91,7 @@ #include "content/browser/worker_host/worker_message_filter.h" #include "content/common/child_process_info.h" #include "content/common/child_process_messages.h" +#include "content/common/gpu_messages.h" #include "content/common/notification_service.h" #include "content/common/resource_messages.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index c3e1279..0fd9a81 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -26,7 +26,6 @@ #import "chrome/browser/ui/cocoa/view_id_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/edit_command.h" -#include "chrome/common/gpu_messages.h" #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" @@ -37,6 +36,7 @@ #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host.h" +#include "content/common/gpu_messages.h" #include "skia/ext/platform_canvas.h" #import "third_party/mozilla/ComplexTextInputPanel.h" #include "third_party/skia/include/core/SkColor.h" diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 84ac1e1..b0c342f 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -60,8 +60,6 @@ 'common/devtools_messages_internal.h', 'common/dom_storage_messages.cc', 'common/dom_storage_messages.h', - 'common/dx_diag_node.cc', - 'common/dx_diag_node.h', 'common/file_utilities_messages.h', 'common/font_descriptor_mac.h', 'common/font_descriptor_mac.mm', @@ -71,18 +69,8 @@ 'common/geoposition.h', 'common/gfx_resource_provider.cc', 'common/gfx_resource_provider.h', - 'common/gpu_create_command_buffer_config.cc', - 'common/gpu_create_command_buffer_config.h', 'common/gpu_feature_flags.cc', 'common/gpu_feature_flags.h', - 'common/gpu_info.cc', - 'common/gpu_info.h', - 'common/gpu_messages.cc', - 'common/gpu_messages.h', - 'common/gpu_messages_internal.h', - 'common/gpu_param_traits.h', - 'common/gpu_video_common.cc', - 'common/gpu_video_common.h', 'common/guid.cc', 'common/guid.h', 'common/guid_posix.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index e6aa261..a7f0314 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1731,8 +1731,6 @@ 'common/extensions/user_script_unittest.cc', 'common/font_descriptor_mac_unittest.mm', 'common/gpu_feature_flags_unittest.cc', - 'common/gpu_info_unittest.cc', - 'common/gpu_messages_unittest.cc', 'common/guid_unittest.cc', 'common/important_file_writer_unittest.cc', 'common/json_pref_store_unittest.cc', @@ -1840,6 +1838,7 @@ '../content/browser/tab_contents/navigation_entry_unittest.cc', '../content/browser/tab_contents/render_view_host_manager_unittest.cc', '../content/browser/webui/web_ui_unittest.cc', + '../content/common/gpu_info_unittest.cc', '../content/common/notification_service_unittest.cc', '../content/common/property_bag_unittest.cc', '../content/common/resource_dispatcher_unittest.cc', diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h index 14ede2a..7bd13fe 100644 --- a/chrome/common/automation_messages.h +++ b/chrome/common/automation_messages.h @@ -13,7 +13,7 @@ #include "chrome/common/common_param_traits.h" #include "chrome/common/page_type.h" #include "chrome/common/security_style.h" -#include "chrome/common/common_param_traits.h" +#include "content/common/common_param_traits.h" #include "net/base/host_port_pair.h" #include "net/base/upload_data.h" #include "ui/gfx/rect.h" diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h index decc420..3493bd4 100644 --- a/chrome/common/automation_messages_internal.h +++ b/chrome/common/automation_messages_internal.h @@ -15,7 +15,7 @@ #include "ipc/ipc_message_macros.h" #include "net/url_request/url_request_status.h" #include "ui/gfx/rect.h" - +#include "webkit/glue/window_open_disposition.h" // NOTE: All IPC messages have either a routing_id of 0 (for asynchronous diff --git a/chrome/common/child_process_logging_linux.cc b/chrome/common/child_process_logging_linux.cc index 400a8fe..4ad290b 100644 --- a/chrome/common/child_process_logging_linux.cc +++ b/chrome/common/child_process_logging_linux.cc @@ -7,8 +7,8 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "chrome/common/gpu_info.h" #include "chrome/installer/util/google_update_settings.h" +#include "content/common/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 50cd141..fd1ed16 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -10,8 +10,8 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "base/utf_string_conversions.h" -#include "chrome/common/gpu_info.h" #include "chrome/installer/util/google_update_settings.h" +#include "content/common/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 8f7121ee..a5b7d88 100644 --- a/chrome/common/child_process_logging_win.cc +++ b/chrome/common/child_process_logging_win.cc @@ -11,8 +11,8 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "chrome/common/chrome_constants.h" -#include "chrome/common/gpu_info.h" #include "chrome/installer/util/google_update_settings.h" +#include "content/common/gpu_info.h" #include "googleurl/src/gurl.h" namespace child_process_logging { diff --git a/chrome/common/common_message_generator.h b/chrome/common/common_message_generator.h index 4ce33ad..43852de 100644 --- a/chrome/common/common_message_generator.h +++ b/chrome/common/common_message_generator.h @@ -20,7 +20,6 @@ #include "chrome/common/automation_messages.h" #include "chrome/common/devtools_messages.h" #include "chrome/common/dom_storage_messages.h" -#include "chrome/common/gpu_messages.h" #include "chrome/common/nacl_messages.h" #include "chrome/common/pepper_file_messages.h" #include "chrome/common/pepper_messages.h" diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc index 38792bb..6297e641 100644 --- a/chrome/common/common_param_traits.cc +++ b/chrome/common/common_param_traits.cc @@ -15,7 +15,6 @@ #include "printing/backend/print_backend.h" #include "printing/native_metafile.h" #include "printing/page_range.h" -#include "ui/gfx/rect.h" #ifndef EXCLUDE_SKIA_DEPENDENCIES #include "third_party/skia/include/core/SkBitmap.h" @@ -103,73 +102,6 @@ void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) { #endif // EXCLUDE_SKIA_DEPENDENCIES -void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { - m->WriteInt(p.x()); - m->WriteInt(p.y()); -} - -bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, - gfx::Point* r) { - int x, y; - if (!m->ReadInt(iter, &x) || - !m->ReadInt(iter, &y)) - return false; - r->set_x(x); - r->set_y(y); - return true; -} - -void ParamTraits<gfx::Point>::Log(const gfx::Point& p, std::string* l) { - l->append(base::StringPrintf("(%d, %d)", p.x(), p.y())); -} - - -void ParamTraits<gfx::Rect>::Write(Message* m, const gfx::Rect& p) { - m->WriteInt(p.x()); - m->WriteInt(p.y()); - m->WriteInt(p.width()); - m->WriteInt(p.height()); -} - -bool ParamTraits<gfx::Rect>::Read(const Message* m, void** iter, gfx::Rect* r) { - int x, y, w, h; - if (!m->ReadInt(iter, &x) || - !m->ReadInt(iter, &y) || - !m->ReadInt(iter, &w) || - !m->ReadInt(iter, &h)) - return false; - r->set_x(x); - r->set_y(y); - r->set_width(w); - r->set_height(h); - return true; -} - -void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { - l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), - p.width(), p.height())); -} - - -void ParamTraits<gfx::Size>::Write(Message* m, const gfx::Size& p) { - m->WriteInt(p.width()); - m->WriteInt(p.height()); -} - -bool ParamTraits<gfx::Size>::Read(const Message* m, void** iter, gfx::Size* r) { - int w, h; - if (!m->ReadInt(iter, &w) || - !m->ReadInt(iter, &h)) - return false; - r->set_width(w); - r->set_height(h); - return true; -} - -void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) { - l->append(base::StringPrintf("(%d, %d)", p.width(), p.height())); -} - void ParamTraits<ContentSetting>::Write(Message* m, const param_type& p) { WriteParam(m, static_cast<int>(p)); } diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index 28b48bc..b5fd950 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.h @@ -27,7 +27,6 @@ // // TODO(erg): The following headers are historical and only work because // their definitions are inlined, which also needs to be fixed. -#include "ui/gfx/native_widget_types.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/window_open_disposition.h" @@ -40,12 +39,6 @@ struct ThumbnailScore; struct WebApplicationInfo; class WebCursor; -namespace gfx { -class Point; -class Rect; -class Size; -} // namespace gfx - namespace printing { struct PageRange; struct PrinterCapsAndDefaults; @@ -70,30 +63,6 @@ struct ParamTraits<SkBitmap> { }; template <> -struct ParamTraits<gfx::Point> { - typedef gfx::Point param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<gfx::Rect> { - typedef gfx::Rect param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<gfx::Size> { - typedef gfx::Size param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> struct ParamTraits<ContentSetting> { typedef ContentSetting param_type; static void Write(Message* m, const param_type& p); @@ -130,38 +99,6 @@ struct ParamTraits<ContentSettings> { }; template <> -struct ParamTraits<gfx::NativeWindow> { - typedef gfx::NativeWindow param_type; - static void Write(Message* m, const param_type& p) { -#if defined(OS_WIN) - // HWNDs are always 32 bits on Windows, even on 64 bit systems. - m->WriteUInt32(reinterpret_cast<uint32>(p)); -#else - m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p)); -#endif - } - static bool Read(const Message* m, void** iter, param_type* r) { -#if defined(OS_WIN) - return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r)); -#else - const char *data; - int data_size = 0; - bool result = m->ReadData(iter, &data, &data_size); - if (result && data_size == sizeof(gfx::NativeWindow)) { - memcpy(r, data, sizeof(gfx::NativeWindow)); - } else { - result = false; - NOTREACHED(); - } - return result; -#endif - } - static void Log(const param_type& p, std::string* l) { - l->append("<gfx::NativeWindow>"); - } -}; - -template <> struct ParamTraits<PageZoom::Function> { typedef PageZoom::Function param_type; static void Write(Message* m, const param_type& p) { diff --git a/chrome/common/gpu_create_command_buffer_config.cc b/chrome/common/gpu_create_command_buffer_config.cc deleted file mode 100644 index e8ab9d7..0000000 --- a/chrome/common/gpu_create_command_buffer_config.cc +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2010 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 "chrome/common/gpu_create_command_buffer_config.h" - -GPUCreateCommandBufferConfig::GPUCreateCommandBufferConfig() {} - -GPUCreateCommandBufferConfig::GPUCreateCommandBufferConfig( - const std::string& _allowed_extensions, - const std::vector<int>& _attribs) - : allowed_extensions(_allowed_extensions), - attribs(_attribs) { -} - -GPUCreateCommandBufferConfig::~GPUCreateCommandBufferConfig() {} diff --git a/chrome/common/gpu_create_command_buffer_config.h b/chrome/common/gpu_create_command_buffer_config.h deleted file mode 100644 index 0cb217a..0000000 --- a/chrome/common/gpu_create_command_buffer_config.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2010 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 CHROME_COMMON_GPU_CREATE_COMMAND_BUFFER_CONFIG_H_ -#define CHROME_COMMON_GPU_CREATE_COMMAND_BUFFER_CONFIG_H_ -#pragma once - -#include <string> -#include <vector> - -// Parameters passed when initializing a GPU channel. -struct GPUCreateCommandBufferConfig { - GPUCreateCommandBufferConfig(); - - GPUCreateCommandBufferConfig(const std::string& _allowed_extensions, - const std::vector<int>& _attribs); - - ~GPUCreateCommandBufferConfig(); - - std::string allowed_extensions; - std::vector<int> attribs; -}; - -#endif // CHROME_COMMON_GPU_CREATE_COMMAND_BUFFER_CONFIG_H_ diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc deleted file mode 100644 index a54a029..0000000 --- a/chrome/common/gpu_messages.cc +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) 2010 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/string_piece.h" -#include "base/sys_string_conversions.h" -#include "chrome/common/gpu_create_command_buffer_config.h" -#include "chrome/common/gpu_info.h" -#include "chrome/common/dx_diag_node.h" -#include "ipc/ipc_channel_handle.h" -#include "ui/gfx/rect.h" -#include "ui/gfx/size.h" - -#define IPC_MESSAGE_IMPL -#include "chrome/common/gpu_messages.h" - -#if defined(OS_MACOSX) - -// Parameters for the GpuHostMsg_AcceleratedSurfaceSetIOSurface -// message, which has too many parameters to be sent with the -// predefined IPC macros. -GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params:: - GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params() - : renderer_id(0), - render_view_id(0), - window(NULL), - width(0), - height(0), - identifier(0) { -} - -GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params:: - GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params() - : renderer_id(0), - render_view_id(0), - window(NULL), - surface_id(0), - route_id(0), - swap_buffers_count(0) { -} -#endif - -namespace IPC { - -#if defined(OS_MACOSX) - -void ParamTraits<GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params> ::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.renderer_id); - WriteParam(m, p.render_view_id); - WriteParam(m, p.window); - WriteParam(m, p.width); - WriteParam(m, p.height); - WriteParam(m, p.identifier); -} - -bool ParamTraits<GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params> ::Read( - const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->renderer_id) && - ReadParam(m, iter, &p->render_view_id) && - ReadParam(m, iter, &p->window) && - ReadParam(m, iter, &p->width) && - ReadParam(m, iter, &p->height) && - ReadParam(m, iter, &p->identifier); -} - -void ParamTraits<GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params> ::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.renderer_id, l); - l->append(", "); - LogParam(p.render_view_id, l); - l->append(", "); - LogParam(p.window, l); - l->append(", "); - LogParam(p.width, l); - l->append(", "); - LogParam(p.height, l); - l->append(", "); - LogParam(p.identifier, l); - l->append(")"); -} - -void ParamTraits<GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params> ::Write( - Message* m, - const param_type& p) { - WriteParam(m, p.renderer_id); - WriteParam(m, p.render_view_id); - WriteParam(m, p.window); - WriteParam(m, p.surface_id); - WriteParam(m, p.route_id); - WriteParam(m, p.swap_buffers_count); -} - -bool ParamTraits<GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params> ::Read( - const Message* m, - void** iter, - param_type* p) { - return ReadParam(m, iter, &p->renderer_id) && - ReadParam(m, iter, &p->render_view_id) && - ReadParam(m, iter, &p->window) && - ReadParam(m, iter, &p->surface_id) && - ReadParam(m, iter, &p->route_id) && - ReadParam(m, iter, &p->swap_buffers_count); -} - -void ParamTraits<GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params> ::Log( - const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.renderer_id, l); - l->append(", "); - LogParam(p.render_view_id, l); - l->append(", "); - LogParam(p.window, l); - l->append(", "); - LogParam(p.surface_id, l); - l->append(", "); - LogParam(p.route_id, l); - l->append(", "); - LogParam(p.swap_buffers_count, l); - l->append(")"); -} -#endif // if defined(OS_MACOSX) - -void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) { - WriteParam(m, static_cast<int32>(p.level)); - WriteParam(m, p.initialization_time); - WriteParam(m, p.vendor_id); - WriteParam(m, p.device_id); - WriteParam(m, p.driver_vendor); - WriteParam(m, p.driver_version); - WriteParam(m, p.driver_date); - WriteParam(m, p.pixel_shader_version); - WriteParam(m, p.vertex_shader_version); - WriteParam(m, p.gl_version); - WriteParam(m, p.gl_version_string); - WriteParam(m, p.gl_vendor); - WriteParam(m, p.gl_renderer); - WriteParam(m, p.gl_extensions); - WriteParam(m, p.can_lose_context); - WriteParam(m, p.collection_error); - -#if defined(OS_WIN) - ParamTraits<DxDiagNode> ::Write(m, p.dx_diagnostics); -#endif -} - -bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->level) && - ReadParam(m, iter, &p->initialization_time) && - ReadParam(m, iter, &p->vendor_id) && - ReadParam(m, iter, &p->device_id) && - ReadParam(m, iter, &p->driver_vendor) && - ReadParam(m, iter, &p->driver_version) && - ReadParam(m, iter, &p->driver_date) && - ReadParam(m, iter, &p->pixel_shader_version) && - ReadParam(m, iter, &p->vertex_shader_version) && - ReadParam(m, iter, &p->gl_version) && - ReadParam(m, iter, &p->gl_version_string) && - ReadParam(m, iter, &p->gl_vendor) && - ReadParam(m, iter, &p->gl_renderer) && - ReadParam(m, iter, &p->gl_extensions) && - ReadParam(m, iter, &p->can_lose_context) && - ReadParam(m, iter, &p->collection_error) && -#if defined(OS_WIN) - ReadParam(m, iter, &p->dx_diagnostics); -#else - true; -#endif -} - -void ParamTraits<GPUInfo> ::Log(const param_type& p, std::string* l) { - l->append(base::StringPrintf("<GPUInfo> %d %d %x %x %s %s %s %x %x %x %d", - p.level, - static_cast<int32>( - p.initialization_time.InMilliseconds()), - p.vendor_id, - p.device_id, - p.driver_vendor.c_str(), - p.driver_version.c_str(), - p.driver_date.c_str(), - p.pixel_shader_version, - p.vertex_shader_version, - p.gl_version, - p.can_lose_context)); -} - - -void ParamTraits<GPUInfo::Level> ::Write(Message* m, const param_type& p) { - WriteParam(m, static_cast<int32>(p)); -} - -bool ParamTraits<GPUInfo::Level> ::Read(const Message* m, - void** iter, - param_type* p) { - int32 level; - bool ret = ReadParam(m, iter, &level); - *p = static_cast<GPUInfo::Level>(level); - return ret; -} - -void ParamTraits<GPUInfo::Level> ::Log(const param_type& p, std::string* l) { - LogParam(static_cast<int32>(p), l); -} - -void ParamTraits<DxDiagNode> ::Write(Message* m, const param_type& p) { - WriteParam(m, p.values); - WriteParam(m, p.children); -} - -bool ParamTraits<DxDiagNode> ::Read(const Message* m, - void** iter, - param_type* p) { - bool ret = ReadParam(m, iter, &p->values); - ret = ret && ReadParam(m, iter, &p->children); - return ret; -} - -void ParamTraits<DxDiagNode> ::Log(const param_type& p, std::string* l) { - l->append("<DxDiagNode>"); -} - -void ParamTraits<GPUCreateCommandBufferConfig> ::Write( - Message* m, const param_type& p) { - WriteParam(m, p.allowed_extensions); - WriteParam(m, p.attribs); -} - -bool ParamTraits<GPUCreateCommandBufferConfig> ::Read( - const Message* m, void** iter, param_type* p) { - if (!ReadParam(m, iter, &p->allowed_extensions) || - !ReadParam(m, iter, &p->attribs)) { - return false; - } - return true; -} - -void ParamTraits<GPUCreateCommandBufferConfig> ::Log( - const param_type& p, std::string* l) { - l->append("<GPUCreateCommandBufferConfig>"); -} - -} // namespace IPC diff --git a/chrome/common/gpu_messages.h b/chrome/common/gpu_messages.h deleted file mode 100644 index 2e89a25..0000000 --- a/chrome/common/gpu_messages.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2010 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 CHROME_COMMON_GPU_MESSAGES_H_ -#define CHROME_COMMON_GPU_MESSAGES_H_ -#pragma once - -#include "base/basictypes.h" -#include "base/process.h" -#include "chrome/common/common_param_traits.h" -#include "chrome/common/gpu_param_traits.h" -#include "gpu/command_buffer/common/command_buffer.h" -#include "ui/gfx/native_widget_types.h" - -#include "chrome/common/gpu_messages_internal.h" - -#endif // CHROME_COMMON_GPU_MESSAGES_H_ diff --git a/chrome/common/gpu_messages_unittest.cc b/chrome/common/gpu_messages_unittest.cc deleted file mode 100644 index 0abe2d5..0000000 --- a/chrome/common/gpu_messages_unittest.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2010 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/scoped_ptr.h" -#include "chrome/common/gpu_info.h" -#include "chrome/common/gpu_messages.h" -#include "ipc/ipc_message.h" -#include "ipc/ipc_message_utils.h" -#include "testing/gtest/include/gtest/gtest.h" - -// Test GPUInfo serialization -TEST(GPUIPCMessageTest, GPUInfo) { - GPUInfo input; - // Test variables taken from HP Z600 Workstation - input.level = GPUInfo::kPartial; - input.initialization_time = base::TimeDelta::FromMilliseconds(100); - input.vendor_id = 0x10de; - input.device_id = 0x0658; - input.driver_vendor = "NVIDIA"; - input.driver_version = "195.36.24"; - input.driver_date = "7-14-2009"; - input.pixel_shader_version = 0x0162; - input.vertex_shader_version = 0x0162; - input.gl_version = 0x0302; - input.gl_version_string = "3.2.0 NVIDIA 195.36.24"; - input.gl_vendor = "NVIDIA Corporation"; - input.gl_renderer = "Quadro FX 380/PCI/SSE2"; - input.gl_extensions ="GL_ARB_texture_rg GL_ARB_window_pos"; - input.can_lose_context = false; - - IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - IPC::WriteParam(&msg, input); - - GPUInfo output; - void* iter = NULL; - EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); - EXPECT_EQ(input.level, output.level); - EXPECT_EQ(input.initialization_time.InMilliseconds(), - output.initialization_time.InMilliseconds()); - EXPECT_EQ(input.vendor_id, output.vendor_id); - EXPECT_EQ(input.device_id, output.device_id); - EXPECT_EQ(input.driver_vendor, output.driver_vendor); - EXPECT_EQ(input.driver_version, output.driver_version); - EXPECT_EQ(input.driver_date, output.driver_date); - EXPECT_EQ(input.pixel_shader_version, output.pixel_shader_version); - EXPECT_EQ(input.vertex_shader_version, output.vertex_shader_version); - EXPECT_EQ(input.gl_version, output.gl_version); - EXPECT_EQ(input.gl_version_string, output.gl_version_string); - EXPECT_EQ(input.gl_vendor, output.gl_vendor); - EXPECT_EQ(input.gl_renderer, output.gl_renderer); - EXPECT_EQ(input.gl_extensions, output.gl_extensions); - EXPECT_EQ(input.can_lose_context, output.can_lose_context); - - std::string log_message; - IPC::LogParam(output, &log_message); - EXPECT_STREQ("<GPUInfo> 2 100 10de 658 NVIDIA " - "195.36.24 7-14-2009 162 162 302 0", - log_message.c_str()); -} diff --git a/chrome/common/gpu_param_traits.h b/chrome/common/gpu_param_traits.h deleted file mode 100644 index 1c1c9c0..0000000 --- a/chrome/common/gpu_param_traits.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2010 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 CHROME_COMMON_GPU_PARAM_TRAITS_H_ -#define CHROME_COMMON_GPU_PARAM_TRAITS_H_ -#pragma once - -#include "base/basictypes.h" -#include "base/process.h" -#include "chrome/common/common_param_traits.h" -#include "chrome/common/dx_diag_node.h" -#include "chrome/common/gpu_create_command_buffer_config.h" -#include "chrome/common/gpu_info.h" -#include "gpu/ipc/gpu_command_buffer_traits.h" -#include "gpu/command_buffer/common/command_buffer.h" -#include "ui/gfx/native_widget_types.h" -#include "ui/gfx/rect.h" -#include "ui/gfx/size.h" - -#if defined(OS_MACOSX) -// Parameters for the GpuHostMsg_AcceleratedSurfaceSetIOSurface -// message, which has too many parameters to be sent with the -// predefined IPC macros. -struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params { - int32 renderer_id; - int32 render_view_id; - gfx::PluginWindowHandle window; - int32 width; - int32 height; - uint64 identifier; - - GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params(); -}; - -struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params { - int32 renderer_id; - int32 render_view_id; - gfx::PluginWindowHandle window; - uint64 surface_id; - int32 route_id; - uint64 swap_buffers_count; - - GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params(); -}; -#endif - -namespace IPC { -#if defined(OS_MACOSX) -template <> -struct ParamTraits<GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params> { - typedef GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params> { - typedef GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; -#endif - -template <> -struct ParamTraits<GPUInfo> { - typedef GPUInfo param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<GPUInfo::Level> { - typedef GPUInfo::Level param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<DxDiagNode> { - typedef DxDiagNode param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<GPUCreateCommandBufferConfig> { - typedef GPUCreateCommandBufferConfig param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -} // namespace IPC - -#endif // CHROME_COMMON_GPU_PARAM_TRAITS_H_ diff --git a/chrome/common/gpu_video_common.cc b/chrome/common/gpu_video_common.cc deleted file mode 100644 index 9e25a5f..0000000 --- a/chrome/common/gpu_video_common.cc +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) 2010 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 "chrome/common/gpu_video_common.h" - -const int32 kGpuVideoInvalidFrameId = -1; - -namespace IPC { - -/////////////////////////////////////////////////////////////////////////////// - -void ParamTraits<GpuVideoDecoderInitParam>::Write( - Message* m, const GpuVideoDecoderInitParam& p) { - WriteParam(m, p.codec_id); - WriteParam(m, p.width); - WriteParam(m, p.height); -} - -bool ParamTraits<GpuVideoDecoderInitParam>::Read( - const Message* m, void** iter, GpuVideoDecoderInitParam* r) { - if (!ReadParam(m, iter, &r->codec_id) || - !ReadParam(m, iter, &r->width) || - !ReadParam(m, iter, &r->height)) - return false; - return true; -} - -void ParamTraits<GpuVideoDecoderInitParam>::Log( - const GpuVideoDecoderInitParam& p, std::string* l) { - l->append(base::StringPrintf("(%d, %d %d)", p.codec_id, p.width, p.height)); -} - -/////////////////////////////////////////////////////////////////////////////// - -void ParamTraits<GpuVideoDecoderInitDoneParam>::Write( - Message* m, const GpuVideoDecoderInitDoneParam& p) { - WriteParam(m, p.success); - WriteParam(m, p.input_buffer_size); - WriteParam(m, p.input_buffer_handle); -} - -bool ParamTraits<GpuVideoDecoderInitDoneParam>::Read( - const Message* m, void** iter, GpuVideoDecoderInitDoneParam* r) { - if (!ReadParam(m, iter, &r->success) || - !ReadParam(m, iter, &r->input_buffer_size) || - !ReadParam(m, iter, &r->input_buffer_handle)) - return false; - return true; -} - -void ParamTraits<GpuVideoDecoderInitDoneParam>::Log( - const GpuVideoDecoderInitDoneParam& p, std::string* l) { - l->append(base::StringPrintf("(%d %d)", p.success, p.input_buffer_size)); -} - -/////////////////////////////////////////////////////////////////////////////// - -void ParamTraits<GpuVideoDecoderInputBufferParam>::Write( - Message* m, const GpuVideoDecoderInputBufferParam& p) { - WriteParam(m, p.timestamp); - WriteParam(m, p.offset); - WriteParam(m, p.size); -} - -bool ParamTraits<GpuVideoDecoderInputBufferParam>::Read( - const Message* m, void** iter, GpuVideoDecoderInputBufferParam* r) { - if (!ReadParam(m, iter, &r->timestamp) || - !ReadParam(m, iter, &r->offset) || - !ReadParam(m, iter, &r->size)) - return false; - return true; -} - -void ParamTraits<GpuVideoDecoderInputBufferParam>::Log( - const GpuVideoDecoderInputBufferParam& p, std::string* l) { - l->append(base::StringPrintf("(%d %d %d)", - static_cast<int>(p.timestamp), - p.offset, p.size)); -} - -/////////////////////////////////////////////////////////////////////////////// - -void ParamTraits<GpuVideoDecoderErrorInfoParam>::Write( - Message* m, const GpuVideoDecoderErrorInfoParam& p) { - WriteParam(m, p.error_id); -} - -bool ParamTraits<GpuVideoDecoderErrorInfoParam>::Read( - const Message* m, void** iter, GpuVideoDecoderErrorInfoParam* r) { - if (!ReadParam(m, iter, &r->error_id)) - return false; - return true; -} - -void ParamTraits<GpuVideoDecoderErrorInfoParam>::Log( - const GpuVideoDecoderErrorInfoParam& p, std::string* l) { - l->append(base::StringPrintf("(%d)", p.error_id)); -} - -/////////////////////////////////////////////////////////////////////////////// - -void ParamTraits<GpuVideoDecoderFormatChangeParam>::Write( - Message* m, const GpuVideoDecoderFormatChangeParam& p) { - WriteParam(m, p.input_buffer_size); -} - -bool ParamTraits<GpuVideoDecoderFormatChangeParam>::Read( - const Message* m, void** iter, GpuVideoDecoderFormatChangeParam* r) { - if (!ReadParam(m, iter, &r->input_buffer_size)) - return false; - return true; -} - -void ParamTraits<GpuVideoDecoderFormatChangeParam>::Log( - const GpuVideoDecoderFormatChangeParam& p, std::string* l) { - l->append(base::StringPrintf("%d", p.input_buffer_size)); -} - -/////////////////////////////////////////////////////////////////////////////// -// Traits for media::VideoFrame::Format -void ParamTraits<media::VideoFrame::Format>::Write( - Message* m, const param_type& p) { - m->WriteInt(p); -} - -bool ParamTraits<media::VideoFrame::Format>::Read( - const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast<param_type>(type); - return true; -} - -void ParamTraits<media::VideoFrame::Format>::Log( - const param_type& p, std::string* l) { - std::string s; - switch (p) { - case media::VideoFrame::RGB555: - s = "RGB555"; - break; - case media::VideoFrame::RGB565: - s = "RGB565"; - break; - case media::VideoFrame::RGB24: - s = "RGB24"; - break; - case media::VideoFrame::RGB32: - s = "RGB32"; - break; - case media::VideoFrame::RGBA: - s = "RGBA"; - break; - case media::VideoFrame::YV12: - s = "YV12"; - break; - case media::VideoFrame::YV16: - s = "YV16"; - break; - case media::VideoFrame::NV12: - s = "NV12"; - break; - case media::VideoFrame::EMPTY: - s = "EMPTY"; - break; - case media::VideoFrame::ASCII: - s = "ASCII"; - break; - case media::VideoFrame::INVALID: - s = "INVALID"; - break; - default: - NOTIMPLEMENTED(); - s = "UNKNOWN"; - break; - } - LogParam(s, l); -} - -} // namespace IPC diff --git a/chrome/common/gpu_video_common.h b/chrome/common/gpu_video_common.h deleted file mode 100644 index d5a2ced..0000000 --- a/chrome/common/gpu_video_common.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2010 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 CHROME_COMMON_GPU_VIDEO_COMMON_H_ -#define CHROME_COMMON_GPU_VIDEO_COMMON_H_ - -#include "base/basictypes.h" -#include "base/shared_memory.h" -#include "chrome/common/common_param_traits.h" -#include "media/base/video_frame.h" - -// This is used in messages when only buffer flag is meaningful. -extern const int32 kGpuVideoInvalidFrameId; - -// Flags assigned to a video buffer for both input and output. -enum GpuVideoBufferFlag { - kGpuVideoEndOfStream = 1 << 0, - kGpuVideoDiscontinuous = 1 << 1, -}; - -struct GpuVideoDecoderInitParam { - int32 codec_id; - int32 width; - int32 height; - int32 profile; - int32 level; - int32 frame_rate_den; - int32 frame_rate_num; - int32 aspect_ratio_den; - int32 aspect_ratio_num; -}; - -struct GpuVideoDecoderInitDoneParam { - int32 success; // other parameter is only meaningful when this is true. - int32 input_buffer_size; - base::SharedMemoryHandle input_buffer_handle; -}; - -struct GpuVideoDecoderInputBufferParam { - int64 timestamp; // In unit of microseconds. - int32 offset; - int32 size; - int32 flags; // Miscellaneous flag bit mask. -}; - -struct GpuVideoDecoderErrorInfoParam { - int32 error_id; // TODO(jiesun): define enum. -}; - -// TODO(jiesun): define this. -struct GpuVideoDecoderFormatChangeParam { - int32 input_buffer_size; - base::SharedMemoryHandle input_buffer_handle; -}; - -namespace IPC { - -template <> -struct ParamTraits<GpuVideoDecoderInitParam> { - typedef GpuVideoDecoderInitParam param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<GpuVideoDecoderInitDoneParam> { - typedef GpuVideoDecoderInitDoneParam param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<GpuVideoDecoderInputBufferParam> { - typedef GpuVideoDecoderInputBufferParam param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<GpuVideoDecoderErrorInfoParam> { - typedef GpuVideoDecoderErrorInfoParam param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<GpuVideoDecoderFormatChangeParam> { - typedef GpuVideoDecoderFormatChangeParam param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - -template <> -struct ParamTraits<media::VideoFrame::Format> { - typedef media::VideoFrame::Format param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -} // namespace IPC - -#endif // CHROME_COMMON_GPU_VIDEO_COMMON_H_ diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index 758369e..9ba1106 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -6,7 +6,6 @@ #include "chrome/common/edit_command.h" #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" -#include "chrome/common/gpu_param_traits.h" #include "chrome/common/render_messages_params.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/web_apps.h" diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index c45b865..58a9efa 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -51,7 +51,6 @@ typedef std::map<std::string, std::string> SubstitutionMap; class Value; class SkBitmap; class WebCursor; -struct GPUInfo; struct ThumbnailScore; namespace gfx { @@ -608,13 +607,6 @@ IPC_MESSAGE_ROUTED3(ViewMsg_HandleMessageFromExternalHost, // into a full window). IPC_MESSAGE_ROUTED0(ViewMsg_DisassociateFromPopupCount) -// The browser sends this to a renderer process in response to a -// GpuHostMsg_EstablishGpuChannel message. -IPC_MESSAGE_CONTROL3(ViewMsg_GpuChannelEstablished, - IPC::ChannelHandle /* handle to channel */, - base::ProcessHandle /* renderer_process_for_gpu */, - GPUInfo /* stats about GPU process*/) - // Notifies the renderer of the appcache that has been selected for a // a particular host. This is sent in reply to AppCacheMsg_SelectCache. IPC_MESSAGE_CONTROL2(AppCacheMsg_CacheSelected, diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc index bb71e62..2c02dcc 100644 --- a/chrome/gpu/gpu_channel.cc +++ b/chrome/gpu/gpu_channel.cc @@ -13,10 +13,10 @@ #include "base/string_util.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_thread.h" #include "chrome/gpu/gpu_video_service.h" #include "content/common/child_process.h" +#include "content/common/gpu_messages.h" #if defined(OS_POSIX) #include "ipc/ipc_channel_posix.h" diff --git a/chrome/gpu/gpu_channel.h b/chrome/gpu/gpu_channel.h index a0f4655..2512104 100644 --- a/chrome/gpu/gpu_channel.h +++ b/chrome/gpu/gpu_channel.h @@ -14,8 +14,6 @@ #include "base/process.h" #include "base/scoped_ptr.h" #include "build/build_config.h" -#include "chrome/common/gpu_create_command_buffer_config.h" -#include "chrome/common/gpu_video_common.h" #include "chrome/gpu/gpu_command_buffer_stub.h" #include "content/common/message_router.h" #include "ipc/ipc_sync_channel.h" @@ -23,6 +21,7 @@ #include "ui/gfx/size.h" class GpuThread; +struct GPUCreateCommandBufferConfig; // Encapsulates an IPC channel between the GPU process and one renderer // process. On the renderer side there's a corresponding GpuChannelHost. diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc index bd925c0..17a9235 100644 --- a/chrome/gpu/gpu_command_buffer_stub.cc +++ b/chrome/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 "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_channel.h" #include "chrome/gpu/gpu_command_buffer_stub.h" #include "chrome/gpu/gpu_thread.h" #include "content/common/child_thread.h" +#include "content/common/gpu_messages.h" using gpu::Buffer; diff --git a/chrome/gpu/gpu_info_collector.h b/chrome/gpu/gpu_info_collector.h index a95a525..91b77ac 100644 --- a/chrome/gpu/gpu_info_collector.h +++ b/chrome/gpu/gpu_info_collector.h @@ -8,8 +8,7 @@ #include "base/basictypes.h" #include "build/build_config.h" -#include "chrome/common/dx_diag_node.h" -#include "chrome/common/gpu_info.h" +#include "content/common/gpu_info.h" struct IDirect3D9; diff --git a/chrome/gpu/gpu_info_collector_unittest.cc b/chrome/gpu/gpu_info_collector_unittest.cc index a78b46f..87e6376 100644 --- a/chrome/gpu/gpu_info_collector_unittest.cc +++ b/chrome/gpu/gpu_info_collector_unittest.cc @@ -4,8 +4,8 @@ #include "app/gfx/gl/gl_implementation.h" #include "base/scoped_ptr.h" -#include "chrome/common/gpu_info.h" #include "chrome/gpu/gpu_info_collector.h" +#include "content/common/gpu_info.h" #include "gpu/command_buffer/common/gl_mock.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/gpu/gpu_info_unittest_win.cc b/chrome/gpu/gpu_info_unittest_win.cc index 9455f4d..a6375069 100644 --- a/chrome/gpu/gpu_info_unittest_win.cc +++ b/chrome/gpu/gpu_info_unittest_win.cc @@ -3,9 +3,9 @@ // found in the LICENSE file. #include "base/scoped_ptr.h" -#include "chrome/common/gpu_info.h" #include "chrome/gpu/gpu_idirect3d9_mock_win.h" #include "chrome/gpu/gpu_info_collector.h" +#include "content/common/gpu_info.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc index 706d537..ecc046a 100644 --- a/chrome/gpu/gpu_thread.cc +++ b/chrome/gpu/gpu_thread.cc @@ -14,11 +14,11 @@ #include "base/threading/worker_pool.h" #include "build/build_config.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_info_collector.h" #include "chrome/gpu/gpu_watchdog_thread.h" #include "content/common/child_process.h" #include "content/common/content_client.h" +#include "content/common/gpu_messages.h" #include "ipc/ipc_channel_handle.h" #if defined(OS_MACOSX) diff --git a/chrome/gpu/gpu_thread.h b/chrome/gpu/gpu_thread.h index a4920f8..7c3cef4 100644 --- a/chrome/gpu/gpu_thread.h +++ b/chrome/gpu/gpu_thread.h @@ -13,11 +13,11 @@ #include "base/scoped_ptr.h" #include "base/time.h" #include "build/build_config.h" -#include "chrome/common/gpu_info.h" #include "chrome/gpu/gpu_channel.h" #include "chrome/gpu/gpu_config.h" #include "chrome/gpu/x_util.h" #include "content/common/child_thread.h" +#include "content/common/gpu_info.h" #include "ui/gfx/native_widget_types.h" namespace IPC { diff --git a/chrome/gpu/gpu_video_decoder.cc b/chrome/gpu/gpu_video_decoder.cc index 988ffd4..96be0c3 100644 --- a/chrome/gpu/gpu_video_decoder.cc +++ b/chrome/gpu/gpu_video_decoder.cc @@ -5,11 +5,11 @@ #include "chrome/gpu/gpu_video_decoder.h" #include "base/command_line.h" -#include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_channel.h" #include "chrome/gpu/media/fake_gl_video_decode_engine.h" #include "chrome/gpu/media/fake_gl_video_device.h" #include "content/common/child_thread.h" +#include "content/common/gpu_messages.h" #include "media/base/data_buffer.h" #include "media/base/media_switches.h" #include "media/base/video_frame.h" @@ -127,11 +127,11 @@ void GpuVideoDecoder::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame, // TODO(sjl): Do something with the statistics... if (frame->IsEndOfStream()) { - SendConsumeVideoFrame(kGpuVideoInvalidFrameId, 0, 0, kGpuVideoEndOfStream); + SendConsumeVideoFrame(0, 0, 0, kGpuVideoEndOfStream); return; } - int32 frame_id = kGpuVideoInvalidFrameId; + int32 frame_id = -1; for (VideoFrameMap::iterator i = video_frame_map_.begin(); i != video_frame_map_.end(); ++i) { if (i->second == frame) { @@ -139,7 +139,11 @@ void GpuVideoDecoder::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame, break; } } - DCHECK_NE(-1, frame_id) << "VideoFrame not recognized"; + + if (frame_id == -1) { + NOTREACHED() << "VideoFrame not recognized"; + return; + } SendConsumeVideoFrame(frame_id, frame->GetTimestamp().InMicroseconds(), frame->GetDuration().InMicroseconds(), 0); diff --git a/chrome/gpu/gpu_video_decoder.h b/chrome/gpu/gpu_video_decoder.h index 0e76ed8..92bbb70 100644 --- a/chrome/gpu/gpu_video_decoder.h +++ b/chrome/gpu/gpu_video_decoder.h @@ -10,9 +10,10 @@ #include "base/basictypes.h" #include "base/callback.h" +#include "base/process.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" -#include "chrome/common/gpu_video_common.h" +#include "base/shared_memory.h" #include "chrome/gpu/media/gpu_video_device.h" #include "media/video/video_decode_context.h" #include "media/video/video_decode_engine.h" @@ -32,6 +33,9 @@ class GLES2Decoder; } // namespace gpu class GpuChannel; +struct GpuVideoDecoderInitDoneParam; +struct GpuVideoDecoderInitParam; +struct GpuVideoDecoderInputBufferParam; // A GpuVideoDecoder is a platform independent video decoder that uses platform // specific VideoDecodeEngine and GpuVideoDevice for the actual decoding diff --git a/chrome/gpu/gpu_video_decoder_unittest.cc b/chrome/gpu/gpu_video_decoder_unittest.cc index f88f30c..4b8b18f 100644 --- a/chrome/gpu/gpu_video_decoder_unittest.cc +++ b/chrome/gpu/gpu_video_decoder_unittest.cc @@ -4,8 +4,8 @@ #include "base/message_loop.h" #include "base/process.h" -#include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_video_decoder.h" +#include "content/common/gpu_messages.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/chrome/gpu/gpu_video_service.cc b/chrome/gpu/gpu_video_service.cc index 4221348..008fb69 100644 --- a/chrome/gpu/gpu_video_service.cc +++ b/chrome/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 "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_channel.h" #include "chrome/gpu/gpu_video_decoder.h" #include "chrome/gpu/gpu_video_service.h" +#include "content/common/gpu_messages.h" struct GpuVideoService::GpuVideoDecoderInfo { scoped_refptr<GpuVideoDecoder> decoder; diff --git a/chrome/renderer/command_buffer_proxy.cc b/chrome/renderer/command_buffer_proxy.cc index 8414b4e..3de46bf 100644 --- a/chrome/renderer/command_buffer_proxy.cc +++ b/chrome/renderer/command_buffer_proxy.cc @@ -6,12 +6,12 @@ #include "base/process_util.h" #include "base/shared_memory.h" #include "base/task.h" -#include "chrome/common/gpu_messages.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/command_buffer_proxy.h" #include "chrome/renderer/plugin_channel_host.h" #include "chrome/renderer/render_thread.h" +#include "content/common/gpu_messages.h" #include "gpu/command_buffer/common/cmd_buffer_common.h" #include "ui/gfx/size.h" diff --git a/chrome/renderer/gpu_channel_host.cc b/chrome/renderer/gpu_channel_host.cc index 705193d..14b91b4 100644 --- a/chrome/renderer/gpu_channel_host.cc +++ b/chrome/renderer/gpu_channel_host.cc @@ -4,12 +4,11 @@ #include "chrome/renderer/gpu_channel_host.h" -#include "chrome/common/gpu_create_command_buffer_config.h" -#include "chrome/common/gpu_messages.h" #include "chrome/renderer/command_buffer_proxy.h" #include "chrome/renderer/gpu_video_service_host.h" #include "chrome/renderer/render_thread.h" #include "content/common/child_process.h" +#include "content/common/gpu_messages.h" GpuChannelHost::GpuChannelHost() : state_(kUnconnected) { } @@ -105,7 +104,9 @@ CommandBufferProxy* GpuChannelHost::CreateViewCommandBuffer( if (!channel_.get()) return NULL; - GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs); + GPUCreateCommandBufferConfig init_params; + init_params.allowed_extensions = allowed_extensions; + init_params.attribs = attribs; int32 route_id; if (!RenderThread::current()->Send( new GpuHostMsg_CreateViewCommandBuffer( @@ -136,7 +137,9 @@ CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer( if (!channel_.get()) return NULL; - GPUCreateCommandBufferConfig init_params(allowed_extensions, attribs); + GPUCreateCommandBufferConfig init_params; + init_params.allowed_extensions = allowed_extensions; + init_params.attribs = attribs; int32 parent_route_id = parent ? parent->route_id() : 0; int32 route_id; if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(parent_route_id, diff --git a/chrome/renderer/gpu_channel_host.h b/chrome/renderer/gpu_channel_host.h index 88979a9..fb099a6 100644 --- a/chrome/renderer/gpu_channel_host.h +++ b/chrome/renderer/gpu_channel_host.h @@ -12,7 +12,7 @@ #include "base/hash_tables.h" #include "base/process_util.h" #include "base/scoped_ptr.h" -#include "chrome/common/gpu_info.h" +#include "content/common/gpu_info.h" #include "content/common/message_router.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_sync_channel.h" diff --git a/chrome/renderer/gpu_video_decoder_host.cc b/chrome/renderer/gpu_video_decoder_host.cc index fb96eb9..5afa69c 100644 --- a/chrome/renderer/gpu_video_decoder_host.cc +++ b/chrome/renderer/gpu_video_decoder_host.cc @@ -4,9 +4,9 @@ #include "chrome/renderer/gpu_video_decoder_host.h" -#include "chrome/common/gpu_messages.h" -#include "media/base/pipeline.h" +#include "content/common/gpu_messages.h" #include "content/common/message_router.h" +#include "media/base/pipeline.h" #include "media/video/video_decode_context.h" GpuVideoDecoderHost::GpuVideoDecoderHost(MessageRouter* router, diff --git a/chrome/renderer/gpu_video_decoder_host.h b/chrome/renderer/gpu_video_decoder_host.h index cd78643..34b5903 100644 --- a/chrome/renderer/gpu_video_decoder_host.h +++ b/chrome/renderer/gpu_video_decoder_host.h @@ -8,8 +8,8 @@ #include <deque> #include <map> +#include "base/shared_memory.h" #include "base/singleton.h" -#include "chrome/common/gpu_video_common.h" #include "chrome/renderer/gpu_channel_host.h" #include "ipc/ipc_message.h" #include "media/base/buffers.h" @@ -20,6 +20,7 @@ using media::VideoFrame; using media::Buffer; class MessageRouter; +struct GpuVideoDecoderInitDoneParam; // This class is used to talk to GpuVideoDecoder in the GPU process through // IPC messages. It implements the interface of VideoDecodeEngine so users diff --git a/chrome/renderer/gpu_video_decoder_host_unittest.cc b/chrome/renderer/gpu_video_decoder_host_unittest.cc index 89d765e..6186e48 100644 --- a/chrome/renderer/gpu_video_decoder_host_unittest.cc +++ b/chrome/renderer/gpu_video_decoder_host_unittest.cc @@ -3,9 +3,9 @@ // found in the LICENSE file. #include "base/message_loop.h" -#include "chrome/common/gpu_messages.h" #include "chrome/renderer/gpu_video_decoder_host.h" #include "content/common/message_router.h" +#include "content/common/gpu_messages.h" #include "media/base/pipeline.h" #include "media/video/video_mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/renderer/gpu_video_service_host.cc b/chrome/renderer/gpu_video_service_host.cc index 2971ff2..221990f 100644 --- a/chrome/renderer/gpu_video_service_host.cc +++ b/chrome/renderer/gpu_video_service_host.cc @@ -4,9 +4,9 @@ #include "chrome/renderer/gpu_video_service_host.h" -#include "chrome/common/gpu_messages.h" #include "chrome/renderer/gpu_video_decoder_host.h" #include "chrome/renderer/render_thread.h" +#include "content/common/gpu_messages.h" GpuVideoServiceHost::GpuVideoServiceHost() : channel_(NULL), diff --git a/chrome/renderer/gpu_video_service_host.h b/chrome/renderer/gpu_video_service_host.h index e4f3be0..c3c999e 100644 --- a/chrome/renderer/gpu_video_service_host.h +++ b/chrome/renderer/gpu_video_service_host.h @@ -6,7 +6,6 @@ #define CHROME_RENDERER_GPU_VIDEO_SERVICE_HOST_H_ #include "base/singleton.h" -#include "chrome/common/gpu_video_common.h" #include "chrome/renderer/gpu_channel_host.h" #include "chrome/renderer/gpu_video_decoder_host.h" #include "ipc/ipc_channel.h" diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index cad2d5e..27d0a12 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -31,7 +31,6 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_localization_peer.h" #include "chrome/common/extensions/extension_set.h" -#include "chrome/common/gpu_messages.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" @@ -67,6 +66,7 @@ #include "chrome/renderer/security_filter_peer.h" #include "chrome/renderer/spellchecker/spellcheck.h" #include "chrome/renderer/user_script_slave.h" +#include "content/common/gpu_messages.h" #include "content/common/resource_dispatcher.h" #include "content/common/resource_messages.h" #include "ipc/ipc_channel_handle.h" @@ -679,7 +679,7 @@ bool RenderThread::OnControlMessageReceived(const IPC::Message& msg) { OnSpellCheckWordAdded) IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, OnSpellCheckEnableAutoSpellCorrect) - IPC_MESSAGE_HANDLER(ViewMsg_GpuChannelEstablished, OnGpuChannelEstablished) + IPC_MESSAGE_HANDLER(GpuMsg_GpuChannelEstablished, OnGpuChannelEstablished) IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index db1deab..eed5c65 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -16,7 +16,6 @@ #include "build/build_config.h" #include "chrome/common/css_colors.h" #include "chrome/common/extensions/extension_set.h" -#include "chrome/common/gpu_info.h" #include "chrome/renderer/visitedlink_slave.h" #include "content/common/child_thread.h" #include "ipc/ipc_channel_proxy.h" @@ -45,6 +44,7 @@ class WebDatabaseObserverImpl; struct ContentSettings; struct RendererPreferences; struct DOMStorageMsg_Event_Params; +struct GPUInfo; struct ViewMsg_ExtensionLoaded_Params; struct ViewMsg_New_Params; struct WebPreferences; diff --git a/chrome/test/gpu/gpu_pixel_browsertest.cc b/chrome/test/gpu/gpu_pixel_browsertest.cc index b310596..0808c2c 100644 --- a/chrome/test/gpu/gpu_pixel_browsertest.cc +++ b/chrome/test/gpu/gpu_pixel_browsertest.cc @@ -19,13 +19,13 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/gpu_info.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/test_launcher_utils.h" #include "chrome/test/ui_test_utils.h" #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 "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/DEPS b/content/DEPS index b5cb1c7..a5184fb 100644 --- a/content/DEPS +++ b/content/DEPS @@ -9,6 +9,7 @@ include_rules = [ "+chrome", "+grit", + "+gpu", "+media", "+net", "+ppapi", diff --git a/content/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc index ce54c28..9130149 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 "chrome/common/gpu_info.h" +#include "content/common/gpu_info.h" namespace { diff --git a/content/browser/gpu_blacklist_unittest.cc b/content/browser/gpu_blacklist_unittest.cc index 6008b62..0394a06 100644 --- a/content/browser/gpu_blacklist_unittest.cc +++ b/content/browser/gpu_blacklist_unittest.cc @@ -10,8 +10,8 @@ #include "base/path_service.h" #include "base/scoped_ptr.h" #include "base/version.h" -#include "chrome/common/gpu_info.h" #include "content/browser/gpu_blacklist.h" +#include "content/common/gpu_info.h" #include "testing/gtest/include/gtest/gtest.h" class GpuBlacklistTest : public testing::Test { diff --git a/content/browser/gpu_process_host.cc b/content/browser/gpu_process_host.cc index e89a46e..900abff 100644 --- a/content/browser/gpu_process_host.cc +++ b/content/browser/gpu_process_host.cc @@ -17,12 +17,12 @@ #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/gpu_feature_flags.h" -#include "chrome/common/gpu_messages.h" #include "chrome/common/render_messages.h" #include "chrome/gpu/gpu_thread.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "content/common/gpu_messages.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_switches.h" #include "media/base/media_switches.h" diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc index 9222e10..87d2362 100644 --- a/content/browser/renderer_host/gpu_message_filter.cc +++ b/content/browser/renderer_host/gpu_message_filter.cc @@ -10,10 +10,9 @@ #include "base/callback.h" #include "chrome/browser/gpu_process_host_ui_shim.h" -#include "chrome/common/gpu_create_command_buffer_config.h" -#include "chrome/common/gpu_messages.h" #include "chrome/common/render_messages.h" #include "content/browser/gpu_process_host.h" +#include "content/common/gpu_messages.h" GpuMessageFilter::GpuMessageFilter(int render_process_id) : gpu_host_id_(0), @@ -92,10 +91,8 @@ class EstablishChannelCallback #endif DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - ViewMsg_GpuChannelEstablished* reply = - new ViewMsg_GpuChannelEstablished(channel, - renderer_process_for_gpu, - gpu_info); + IPC::Message* reply = new GpuMsg_GpuChannelEstablished( + channel, renderer_process_for_gpu, gpu_info); // If the renderer process is performing synchronous initialization, // it needs to handle this message before receiving the reply for diff --git a/content/common/common_param_traits.cc b/content/common/common_param_traits.cc index b5ba062..948576b 100644 --- a/content/common/common_param_traits.cc +++ b/content/common/common_param_traits.cc @@ -8,6 +8,7 @@ #include "net/base/host_port_pair.h" #include "net/base/upload_data.h" #include "net/http/http_response_headers.h" +#include "ui/gfx/rect.h" #include "webkit/glue/resource_loader_bridge.h" namespace IPC { @@ -470,4 +471,69 @@ void ParamTraits<base::PlatformFileInfo>::Log( l->append(")"); } +void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) { + m->WriteInt(p.x()); + m->WriteInt(p.y()); +} + +bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter, + gfx::Point* r) { + int x, y; + if (!m->ReadInt(iter, &x) || + !m->ReadInt(iter, &y)) + return false; + r->set_x(x); + r->set_y(y); + return true; +} + +void ParamTraits<gfx::Point>::Log(const gfx::Point& p, std::string* l) { + l->append(base::StringPrintf("(%d, %d)", p.x(), p.y())); +} + +void ParamTraits<gfx::Size>::Write(Message* m, const gfx::Size& p) { + m->WriteInt(p.width()); + m->WriteInt(p.height()); +} + +bool ParamTraits<gfx::Size>::Read(const Message* m, void** iter, gfx::Size* r) { + int w, h; + if (!m->ReadInt(iter, &w) || + !m->ReadInt(iter, &h)) + return false; + r->set_width(w); + r->set_height(h); + return true; +} + +void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) { + l->append(base::StringPrintf("(%d, %d)", p.width(), p.height())); +} + +void ParamTraits<gfx::Rect>::Write(Message* m, const gfx::Rect& p) { + m->WriteInt(p.x()); + m->WriteInt(p.y()); + m->WriteInt(p.width()); + m->WriteInt(p.height()); +} + +bool ParamTraits<gfx::Rect>::Read(const Message* m, void** iter, gfx::Rect* r) { + int x, y, w, h; + if (!m->ReadInt(iter, &x) || + !m->ReadInt(iter, &y) || + !m->ReadInt(iter, &w) || + !m->ReadInt(iter, &h)) + return false; + r->set_x(x); + r->set_y(y); + r->set_width(w); + r->set_height(h); + return true; +} + +void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { + l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), + p.width(), p.height())); +} + } // namespace IPC diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h index f6f79b6..20c5be3 100644 --- a/content/common/common_param_traits.h +++ b/content/common/common_param_traits.h @@ -27,11 +27,18 @@ // TODO(erg): The following headers are historical and only work because // their definitions are inlined, which also needs to be fixed. +#include "ui/gfx/native_widget_types.h" #include "webkit/glue/resource_type.h" // Forward declarations. class GURL; +namespace gfx { +class Point; +class Rect; +class Size; +} // namespace gfx + namespace net { class HttpResponseHeaders; class HostPortPair; @@ -122,6 +129,62 @@ struct SimilarTypeTraits<base::PlatformFileError> { typedef int Type; }; +template <> +struct ParamTraits<gfx::Point> { + typedef gfx::Point param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<gfx::Size> { + typedef gfx::Size param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<gfx::Rect> { + typedef gfx::Rect param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<gfx::NativeWindow> { + typedef gfx::NativeWindow param_type; + static void Write(Message* m, const param_type& p) { +#if defined(OS_WIN) + // HWNDs are always 32 bits on Windows, even on 64 bit systems. + m->WriteUInt32(reinterpret_cast<uint32>(p)); +#else + m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p)); +#endif + } + static bool Read(const Message* m, void** iter, param_type* r) { +#if defined(OS_WIN) + return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r)); +#else + const char *data; + int data_size = 0; + bool result = m->ReadData(iter, &data, &data_size); + if (result && data_size == sizeof(gfx::NativeWindow)) { + memcpy(r, data, sizeof(gfx::NativeWindow)); + } else { + result = false; + NOTREACHED(); + } + return result; +#endif + } + static void Log(const param_type& p, std::string* l) { + l->append("<gfx::NativeWindow>"); + } +}; + } // namespace IPC #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index 619e26c..69d16bc8 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -7,5 +7,6 @@ #include "content/common/child_process_messages.h" #include "content/common/file_system_messages.h" #include "content/common/p2p_messages.h" +#include "content/common/gpu_messages.h" #include "content/common/resource_messages.h" #include "content/common/socket_stream_messages.h" diff --git a/chrome/common/dx_diag_node.cc b/content/common/dx_diag_node.cc index 85beb5b..566cd4a 100644 --- a/chrome/common/dx_diag_node.cc +++ b/content/common/dx_diag_node.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 "chrome/common/dx_diag_node.h" +#include "content/common/dx_diag_node.h" DxDiagNode::DxDiagNode() {} diff --git a/chrome/common/dx_diag_node.h b/content/common/dx_diag_node.h index 6522213..8e3f2e3 100644 --- a/chrome/common/dx_diag_node.h +++ b/content/common/dx_diag_node.h @@ -5,8 +5,8 @@ // A tree of name value pairs that report contain DirectX diagnostic // information. -#ifndef CHROME_COMMON_DX_DIAG_NODE_H_ -#define CHROME_COMMON_DX_DIAG_NODE_H_ +#ifndef CONTENT_COMMON_DX_DIAG_NODE_H_ +#define CONTENT_COMMON_DX_DIAG_NODE_H_ #include <map> #include <string> @@ -19,4 +19,4 @@ struct DxDiagNode { std::map<std::string, DxDiagNode> children; }; -#endif // CHROME_COMMON_DX_DIAG_NODE_H_ +#endif // CONTENT_COMMON_DX_DIAG_NODE_H_ diff --git a/chrome/common/gpu_info.cc b/content/common/gpu_info.cc index 3b04528..55ecdbc 100644 --- a/chrome/common/gpu_info.cc +++ b/content/common/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 "chrome/common/gpu_info.h" +#include "content/common/gpu_info.h" GPUInfo::GPUInfo() : level(kUninitialized), diff --git a/chrome/common/gpu_info.h b/content/common/gpu_info.h index 8ce5b51..b571682 100644 --- a/chrome/common/gpu_info.h +++ b/content/common/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 CHROME_COMMON_GPU_INFO_H__ -#define CHROME_COMMON_GPU_INFO_H__ +#ifndef CONTENT_COMMON_GPU_INFO_H_ +#define CONTENT_COMMON_GPU_INFO_H_ #pragma once // Provides access to the GPU information for the system @@ -12,10 +12,9 @@ #include <string> #include "base/basictypes.h" -#include "base/scoped_ptr.h" #include "base/time.h" #include "build/build_config.h" -#include "chrome/common/dx_diag_node.h" +#include "content/common/dx_diag_node.h" struct GPUInfo { GPUInfo(); @@ -98,4 +97,4 @@ struct GPUInfo { #endif }; -#endif // CHROME_COMMON_GPU_INFO_H__ +#endif // CONTENT_COMMON_GPU_INFO_H_ diff --git a/chrome/common/gpu_info_unittest.cc b/content/common/gpu_info_unittest.cc index 15fe03c..8e99e37 100644 --- a/chrome/common/gpu_info_unittest.cc +++ b/content/common/gpu_info_unittest.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 "chrome/common/gpu_info.h" +#include "content/common/gpu_info.h" #include "testing/gtest/include/gtest/gtest.h" // Test that an empty GPUInfo has valid members diff --git a/chrome/common/gpu_messages_internal.h b/content/common/gpu_messages.h index 24b36e9..558f6b3 100644 --- a/chrome/common/gpu_messages_internal.h +++ b/content/common/gpu_messages.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. @@ -6,22 +6,111 @@ #include <string> #include "base/shared_memory.h" -#include "chrome/common/gpu_info.h" -#include "chrome/common/gpu_video_common.h" +#include "content/common/common_param_traits.h" +#include "content/common/gpu_info.h" +#include "gpu/ipc/gpu_command_buffer_traits.h" +#include "gpu/command_buffer/common/command_buffer.h" +#include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/size.h" + +// Multiply-included message file, hence no include guard. #define IPC_MESSAGE_START GpuMsgStart -namespace gfx { -class Size; -} +// Flag assigned to a video buffer for both input and output. +#define kGpuVideoEndOfStream (1 << 0) + +IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig) + IPC_STRUCT_MEMBER(std::string, allowed_extensions) + IPC_STRUCT_MEMBER(std::vector<int>, attribs) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(GpuVideoDecoderInitParam) + IPC_STRUCT_MEMBER(int32, codec_id) + IPC_STRUCT_MEMBER(int32, width) + IPC_STRUCT_MEMBER(int32, height) + IPC_STRUCT_MEMBER(int32, profile) + IPC_STRUCT_MEMBER(int32, level) + IPC_STRUCT_MEMBER(int32, frame_rate_den) + IPC_STRUCT_MEMBER(int32, frame_rate_num) + IPC_STRUCT_MEMBER(int32, aspect_ratio_den) + IPC_STRUCT_MEMBER(int32, aspect_ratio_num) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(GpuVideoDecoderInitDoneParam) + // other parameter is only meaningful when this is true. + IPC_STRUCT_MEMBER(int32, success) + IPC_STRUCT_MEMBER(int32, input_buffer_size) + IPC_STRUCT_MEMBER(base::SharedMemoryHandle, input_buffer_handle) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(GpuVideoDecoderInputBufferParam) + IPC_STRUCT_MEMBER(int64, timestamp) // In unit of microseconds. + IPC_STRUCT_MEMBER(int32, offset) + IPC_STRUCT_MEMBER(int32, size) + IPC_STRUCT_MEMBER(int32, flags) // Miscellaneous flag bit mask. +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(GpuVideoDecoderErrorInfoParam) + IPC_STRUCT_MEMBER(int32, error_id) // TODO(jiesun): define enum. +IPC_STRUCT_END() + +// TODO(jiesun): define this. +IPC_STRUCT_BEGIN(GpuVideoDecoderFormatChangeParam) + IPC_STRUCT_MEMBER(int32, input_buffer_size) + IPC_STRUCT_MEMBER(base::SharedMemoryHandle, input_buffer_handle) +IPC_STRUCT_END() -namespace IPC { -struct ChannelHandle; -} +#if defined(OS_MACOSX) +IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params) + IPC_STRUCT_MEMBER(int32, renderer_id) + IPC_STRUCT_MEMBER(int32, render_view_id) + IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, window) + IPC_STRUCT_MEMBER(int32, width) + IPC_STRUCT_MEMBER(int32, height) + IPC_STRUCT_MEMBER(uint64, identifier) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) + IPC_STRUCT_MEMBER(int32, renderer_id) + IPC_STRUCT_MEMBER(int32, render_view_id) + IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, window) + IPC_STRUCT_MEMBER(uint64, surface_id) + IPC_STRUCT_MEMBER(int32, route_id) + IPC_STRUCT_MEMBER(uint64, swap_buffers_count) +IPC_STRUCT_END() +#endif -struct GPUCreateCommandBufferConfig; -struct GPUInfo; +IPC_STRUCT_TRAITS_BEGIN(DxDiagNode) + IPC_STRUCT_TRAITS_MEMBER(values) + IPC_STRUCT_TRAITS_MEMBER(children) +IPC_STRUCT_TRAITS_END() + +IPC_ENUM_TRAITS(GPUInfo::Level) + +IPC_STRUCT_TRAITS_BEGIN(GPUInfo) + IPC_STRUCT_TRAITS_MEMBER(level) + IPC_STRUCT_TRAITS_MEMBER(initialization_time) + IPC_STRUCT_TRAITS_MEMBER(vendor_id) + IPC_STRUCT_TRAITS_MEMBER(device_id) + 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(gl_version) + IPC_STRUCT_TRAITS_MEMBER(gl_version_string) + IPC_STRUCT_TRAITS_MEMBER(gl_vendor) + IPC_STRUCT_TRAITS_MEMBER(gl_renderer) + IPC_STRUCT_TRAITS_MEMBER(gl_extensions) + IPC_STRUCT_TRAITS_MEMBER(can_lose_context) + IPC_STRUCT_TRAITS_MEMBER(collection_error) +#if defined(OS_WIN) + IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics) +#endif +IPC_STRUCT_TRAITS_END() //------------------------------------------------------------------------------ // GPU Messages @@ -92,6 +181,13 @@ IPC_MESSAGE_CONTROL0(GpuMsg_Crash) // Tells the GPU process to hang. IPC_MESSAGE_CONTROL0(GpuMsg_Hang) +// The browser sends this to a renderer process in response to a +// GpuHostMsg_EstablishGpuChannel message. +IPC_MESSAGE_CONTROL3(GpuMsg_GpuChannelEstablished, + IPC::ChannelHandle /* handle to channel */, + base::ProcessHandle /* renderer_process_for_gpu */, + GPUInfo /* stats about GPU process*/) + //------------------------------------------------------------------------------ // GPU Host Messages // These are messages to the browser. diff --git a/content/content_common.gypi b/content/content_common.gypi index a3d382a..fa83cf9 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -36,6 +36,8 @@ 'common/content_paths.h', 'common/content_switches.cc', 'common/content_switches.h', + 'common/dx_diag_node.cc', + 'common/dx_diag_node.h', 'common/file_system/file_system_dispatcher.cc', 'common/file_system/file_system_dispatcher.h', 'common/file_system/webfilesystem_callback_dispatcher.cc', @@ -45,6 +47,9 @@ 'common/file_system/webfilewriter_impl.cc', 'common/file_system/webfilewriter_impl.h', 'common/file_system_messages.h', + 'common/gpu_info.cc', + 'common/gpu_info.h', + 'common/gpu_messages.h', 'common/message_router.cc', 'common/message_router.h', 'common/notification_details.cc', |