diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-10 22:54:43 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-10 22:54:43 +0000 |
commit | d6d8f719ce2e6c1483e085523ddb963eba1b6514 (patch) | |
tree | 368bb1396420155025fe41e5f13b5b7468b574f9 /chrome/common | |
parent | 9fefe44a6503d060cd7cc38df910f09b3164c5e0 (diff) | |
download | chromium_src-d6d8f719ce2e6c1483e085523ddb963eba1b6514.zip chromium_src-d6d8f719ce2e6c1483e085523ddb963eba1b6514.tar.gz chromium_src-d6d8f719ce2e6c1483e085523ddb963eba1b6514.tar.bz2 |
Move GPU messages to content. I've also switched the IPC structs to use the new IPC macros that generate serialization code.
Review URL: http://codereview.chromium.org/6673003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
24 files changed, 5 insertions, 1470 deletions
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/dx_diag_node.cc b/chrome/common/dx_diag_node.cc deleted file mode 100644 index 85beb5b..0000000 --- a/chrome/common/dx_diag_node.cc +++ /dev/null @@ -1,9 +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/dx_diag_node.h" - -DxDiagNode::DxDiagNode() {} - -DxDiagNode::~DxDiagNode() {} diff --git a/chrome/common/dx_diag_node.h b/chrome/common/dx_diag_node.h deleted file mode 100644 index 6522213..0000000 --- a/chrome/common/dx_diag_node.h +++ /dev/null @@ -1,22 +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. -// -// 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_ - -#include <map> -#include <string> - -struct DxDiagNode { - DxDiagNode(); - ~DxDiagNode(); - - std::map<std::string, std::string> values; - std::map<std::string, DxDiagNode> children; -}; - -#endif // CHROME_COMMON_DX_DIAG_NODE_H_ 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_info.cc b/chrome/common/gpu_info.cc deleted file mode 100644 index 3b04528..0000000 --- a/chrome/common/gpu_info.cc +++ /dev/null @@ -1,26 +0,0 @@ -// 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 "chrome/common/gpu_info.h" - -GPUInfo::GPUInfo() - : level(kUninitialized), - vendor_id(0), - device_id(0), - driver_vendor(""), - driver_version(""), - driver_date(""), - pixel_shader_version(0), - vertex_shader_version(0), - gl_version(0), - gl_version_string(""), - gl_vendor(""), - gl_renderer(""), - gl_extensions(""), - can_lose_context(false), - collection_error(false) { -} - -GPUInfo::~GPUInfo() { -} diff --git a/chrome/common/gpu_info.h b/chrome/common/gpu_info.h deleted file mode 100644 index 8ce5b51..0000000 --- a/chrome/common/gpu_info.h +++ /dev/null @@ -1,101 +0,0 @@ -// 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. - -#ifndef CHROME_COMMON_GPU_INFO_H__ -#define CHROME_COMMON_GPU_INFO_H__ -#pragma once - -// Provides access to the GPU information for the system -// on which chrome is currently running. - -#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" - -struct GPUInfo { - GPUInfo(); - ~GPUInfo(); - - enum Level { - kUninitialized, - kPreliminary, - kPartial, - kCompleting, - kComplete, - }; - - // Whether this GPUInfo has been partially or fully initialized with - // information. - Level level; - - // The amount of time taken to get from the process starting to the message - // loop being pumped. - base::TimeDelta initialization_time; - - // The DWORD (uint32) representing the graphics card vendor id. - uint32 vendor_id; - - // The DWORD (uint32) representing the graphics card device id. Device ids - // are unique to vendor, not to one another. - uint32 device_id; - - // The vendor of the graphics driver currently installed. - std::string driver_vendor; - - // The version of the graphics driver currently installed. - std::string driver_version; - - // The date of the graphics driver currently installed. - std::string driver_date; - - // The version of the pixel/fragment shader used by the gpu. Major version in - // the second lowest 8 bits, minor in the lowest 8 bits, eg version 2.5 would - // be 0x00000205. - uint32 pixel_shader_version; - - // The version of the vertex shader used by the gpu. Major version in the - // second lowest 8 bits, minor in the lowest 8 bits, eg version 2.5 would be - // 0x00000205. - uint32 vertex_shader_version; - - // The version of OpenGL we are using. - // Major version in the second lowest 8 bits, minor in the lowest 8 bits, - // eg version 2.5 would be 0x00000205. - // Returns 0 if we're not using OpenGL, say because we're going through - // D3D instead. - // TODO(zmo): should be able to tell if it's GL or GLES. - uint32 gl_version; - - // The GL_VERSION string. "" if we are not using OpenGL. - std::string gl_version_string; - - // The GL_VENDOR string. "" if we are not using OpenGL. - std::string gl_vendor; - - // The GL_RENDERER string. "" if we are not using OpenGL. - std::string gl_renderer; - - // The GL_EXTENSIONS string. "" if we are not using OpenGL. - std::string gl_extensions; - - // The device semantics, i.e. whether the Vista and Windows 7 specific - // semantics are available. - bool can_lose_context; - - // True if there was an error at any stage of collecting GPUInfo data. - // If there was an error, then the GPUInfo fields may be incomplete or set - // to default values such as 0 or empty string. - bool collection_error; - -#if defined(OS_WIN) - // The information returned by the DirectX Diagnostics Tool. - DxDiagNode dx_diagnostics; -#endif -}; - -#endif // CHROME_COMMON_GPU_INFO_H__ diff --git a/chrome/common/gpu_info_unittest.cc b/chrome/common/gpu_info_unittest.cc deleted file mode 100644 index 15fe03c..0000000 --- a/chrome/common/gpu_info_unittest.cc +++ /dev/null @@ -1,26 +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_info.h" -#include "testing/gtest/include/gtest/gtest.h" - -// Test that an empty GPUInfo has valid members -TEST(GPUInfoBasicTest, EmptyGPUInfo) { - GPUInfo gpu_info; - EXPECT_EQ(gpu_info.level, GPUInfo::kUninitialized); - EXPECT_EQ(gpu_info.initialization_time.ToInternalValue(), 0); - EXPECT_EQ(gpu_info.vendor_id, 0u); - EXPECT_EQ(gpu_info.device_id, 0u); - EXPECT_EQ(gpu_info.driver_vendor, ""); - EXPECT_EQ(gpu_info.driver_version, ""); - EXPECT_EQ(gpu_info.driver_date, ""); - EXPECT_EQ(gpu_info.pixel_shader_version, 0u); - EXPECT_EQ(gpu_info.vertex_shader_version, 0u); - EXPECT_EQ(gpu_info.gl_version, 0u); - EXPECT_EQ(gpu_info.gl_version_string, ""); - EXPECT_EQ(gpu_info.gl_vendor, ""); - EXPECT_EQ(gpu_info.gl_renderer, ""); - EXPECT_EQ(gpu_info.gl_extensions, ""); - EXPECT_EQ(gpu_info.can_lose_context, false); -} 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_internal.h b/chrome/common/gpu_messages_internal.h deleted file mode 100644 index 24b36e9..0000000 --- a/chrome/common/gpu_messages_internal.h +++ /dev/null @@ -1,381 +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 <vector> -#include <string> - -#include "base/shared_memory.h" -#include "chrome/common/gpu_info.h" -#include "chrome/common/gpu_video_common.h" -#include "ipc/ipc_message_macros.h" - -#define IPC_MESSAGE_START GpuMsgStart - -namespace gfx { -class Size; -} - -namespace IPC { -struct ChannelHandle; -} - -struct GPUCreateCommandBufferConfig; -struct GPUInfo; - -//------------------------------------------------------------------------------ -// GPU Messages -// These are messages from the browser to the GPU process. - -// Tells the GPU process to initialize itself. The browser explicitly -// requests this be done so that we are guaranteed that the channel is set -// up between the browser and GPU process before doing any work that might -// potentially crash the GPU process. Detection of the child process -// exiting abruptly is predicated on having the IPC channel set up. -IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) - -// Tells the GPU process to create a new channel for communication with a -// given renderer. The channel name is returned in a -// GpuHostMsg_ChannelEstablished message. The renderer ID is passed so that -// the GPU process reuses an existing channel to that process if it exists. -// This ID is a unique opaque identifier generated by the browser process. -IPC_MESSAGE_CONTROL1(GpuMsg_EstablishChannel, - int /* renderer_id */) - -// Tells the GPU process to close the channel identified by IPC channel -// handle. If no channel can be identified, do nothing. -IPC_MESSAGE_CONTROL1(GpuMsg_CloseChannel, - IPC::ChannelHandle /* channel_handle */) - -// Provides a synchronization point to guarantee that the processing of -// previous asynchronous messages (i.e., GpuMsg_EstablishChannel) has -// completed. (This message can't be synchronous because the -// GpuProcessHost uses an IPC::ChannelProxy, which sends all messages -// asynchronously.) Results in a GpuHostMsg_SynchronizeReply. -IPC_MESSAGE_CONTROL0(GpuMsg_Synchronize) - -// Tells the GPU process to create a new command buffer that renders directly -// to a native view. A corresponding GpuCommandBufferStub is created. -IPC_MESSAGE_CONTROL4(GpuMsg_CreateViewCommandBuffer, - gfx::PluginWindowHandle, /* view */ - int32, /* render_view_id */ - int32, /* renderer_id */ - GPUCreateCommandBufferConfig /* init_params */) - -// Tells the GPU process to create a context for collecting graphics card -// information. -IPC_MESSAGE_CONTROL1(GpuMsg_CollectGraphicsInfo, - GPUInfo::Level /* level */) - -#if defined(OS_MACOSX) -// Tells the GPU process that the browser process handled the swap -// buffers request with the given number. Note that it is possible -// for the browser process to coalesce frames; it is not guaranteed -// that every GpuHostMsg_AcceleratedSurfaceBuffersSwapped message -// will result in a buffer swap on the browser side. -IPC_MESSAGE_CONTROL3(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, - int /* renderer_id */, - int32 /* route_id */, - uint64 /* swap_buffers_count */) - -// Tells the GPU process that the IOSurface of the buffer belonging to -// |renderer_route_id| a given id was destroyed, either by the user closing the -// tab hosting the surface, or by the renderer navigating to a new page. -IPC_MESSAGE_CONTROL2(GpuMsg_DidDestroyAcceleratedSurface, - int /* renderer_id */, - int32 /* renderer_route_id */) -#endif - -// Tells the GPU process to crash. -IPC_MESSAGE_CONTROL0(GpuMsg_Crash) - -// Tells the GPU process to hang. -IPC_MESSAGE_CONTROL0(GpuMsg_Hang) - -//------------------------------------------------------------------------------ -// GPU Host Messages -// These are messages to the browser. - -// A renderer sends this when it wants to create a connection to the GPU -// process. The browser will create the GPU process if necessary, and will -// return a handle to the channel via a GpuChannelEstablished message. -IPC_MESSAGE_CONTROL0(GpuHostMsg_EstablishGpuChannel) - -// A renderer sends this to the browser process to provide a synchronization -// point for GPU operations, in particular to make sure the GPU channel has -// been established. -IPC_SYNC_MESSAGE_CONTROL0_0(GpuHostMsg_SynchronizeGpu) - -// A renderer sends this to the browser process when it wants to -// create a GL context associated with the given view_id. -IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_CreateViewCommandBuffer, - int32, /* render_view_id */ - GPUCreateCommandBufferConfig, /* init_params */ - int32 /* route_id */) - -// Response from GPU to a GpuHostMsg_EstablishChannel message. -IPC_MESSAGE_CONTROL2(GpuHostMsg_ChannelEstablished, - IPC::ChannelHandle, /* channel_handle */ - GPUInfo /* GPU logging stats */) - -// Respond from GPU to a GpuMsg_CreateViewCommandBuffer message. -IPC_MESSAGE_CONTROL1(GpuHostMsg_CommandBufferCreated, - int32 /* route_id */) - -// Request from GPU to free the browser resources associated with the -// command buffer. -IPC_MESSAGE_CONTROL3(GpuHostMsg_DestroyCommandBuffer, - gfx::PluginWindowHandle, /* view */ - int32, /* render_view_id */ - int32 /* renderer_id */) - -// Response from GPU to a GpuMsg_CollectGraphicsInfo. -IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected, - GPUInfo /* GPU logging stats */) - -// Message from GPU to add a GPU log message to the about:gpu page. -IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage, - int /*severity*/, - std::string /* header */, - std::string /* message */) - -// Response from GPU to a GpuMsg_Synchronize message. -IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply) - -#if defined(OS_LINUX) && !defined(TOUCH_UI) -// Resize the window that is being drawn into. It's important that this -// resize be synchronized with the swapping of the front and back buffers. -IPC_SYNC_MESSAGE_CONTROL2_1(GpuHostMsg_ResizeXID, - unsigned long, /* xid */ - gfx::Size, /* size */ - bool /* success */) -#elif defined(OS_MACOSX) -// This message, used on Mac OS X 10.6 and later (where IOSurface is -// supported), is sent from the GPU process to the browser to indicate that a -// new backing store was allocated for the given "window" (fake -// PluginWindowHandle). The renderer ID and render view ID are needed in -// order to uniquely identify the RenderWidgetHostView on the browser side. -IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceSetIOSurface, - GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params) - -// This message notifies the browser process that the renderer -// swapped the buffers associated with the given "window", which -// should cause the browser to redraw the compositor's contents. -IPC_MESSAGE_CONTROL1(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, - GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) -#elif defined(OS_WIN) -IPC_MESSAGE_CONTROL2(GpuHostMsg_ScheduleComposite, - int32, /* renderer_id */ - int32 /* render_view_id */) -#endif - -//------------------------------------------------------------------------------ -// GPU Channel Messages -// These are messages from a renderer process to the GPU process. - -// Initialize a channel between a renderer process and a GPU process. The -// renderer passes its process handle to the GPU process, which gives gives the -// GPU process the ability to map handles from the renderer process. This must -// be the first message sent on a newly connected channel. -IPC_MESSAGE_CONTROL1(GpuChannelMsg_Initialize, - base::ProcessHandle /* renderer_process_for_gpu */) - -// Tells the GPU process to create a new command buffer that renders to an -// offscreen frame buffer. If parent_route_id is not zero, the texture backing -// the frame buffer is mapped into the corresponding parent command buffer's -// namespace, with the name of parent_texture_id. This ID is in the parent's -// namespace. -IPC_SYNC_MESSAGE_CONTROL4_1(GpuChannelMsg_CreateOffscreenCommandBuffer, - int32, /* parent_route_id */ - gfx::Size, /* size */ - GPUCreateCommandBufferConfig, /* init_params */ - uint32, /* parent_texture_id */ - int32 /* route_id */) - -// The CommandBufferProxy sends this to the GpuCommandBufferStub in its -// destructor, so that the stub deletes the actual CommandBufferService -// object that it's hosting. -// TODO(apatrick): Implement this. -IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer, - int32 /* instance_id */) - -// Create hardware video decoder && associate it with the output |decoder_id|; -// We need this to be control message because we had to map the GpuChannel and -// |decoder_id|. -IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateVideoDecoder, - int32, /* context_route_id */ - int32) /* decoder_id */ - -// Release all resource of the hardware video decoder which was assocaited -// with the input |decoder_id|. -// TODO(hclam): This message needs to be asynchronous. -IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder, - int32 /* decoder_id */) - -//------------------------------------------------------------------------------ -// GPU Command Buffer Messages -// These are messages between a renderer process to the GPU process relating to -// a single OpenGL context. -// Initialize a command buffer with the given number of command entries. -// Returns the shared memory handle for the command buffer mapped to the -// calling process. -IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize, - base::SharedMemoryHandle /* ring_buffer */, - int32 /* size */, - bool /* result */) - -// Get the current state of the command buffer. -IPC_SYNC_MESSAGE_ROUTED0_1(GpuCommandBufferMsg_GetState, - gpu::CommandBuffer::State /* state */) - -// Get the current state of the command buffer asynchronously. State is -// returned via UpdateState message. -IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_AsyncGetState) - -// Synchronize the put and get offsets of both processes. Caller passes its -// current put offset. Current state (including get offset) is returned. -IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_Flush, - int32 /* put_offset */, - gpu::CommandBuffer::State /* state */) - -// Asynchronously synchronize the put and get offsets of both processes. -// Caller passes its current put offset. Current state (including get offset) -// is returned via an UpdateState message. -IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_AsyncFlush, - int32 /* put_offset */) - -// Return the current state of the command buffer following a request via -// an AsyncGetState or AsyncFlush message. (This message is sent from the -// GPU process to the renderer process.) -IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_UpdateState, - gpu::CommandBuffer::State /* state */) - -// Indicates that a SwapBuffers call has been issued. -IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_SwapBuffers) - -// Create a shared memory transfer buffer. Returns an id that can be used to -// identify the transfer buffer from a comment. -IPC_SYNC_MESSAGE_ROUTED1_1(GpuCommandBufferMsg_CreateTransferBuffer, - int32 /* size */, - int32 /* id */) - -// Register an existing shared memory transfer buffer. Returns an id that can be -// used to identify the transfer buffer from a command buffer. -IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_RegisterTransferBuffer, - base::SharedMemoryHandle /* transfer_buffer */, - size_t /* size */, - int32 /* id */) - -// Destroy a previously created transfer buffer. -IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_DestroyTransferBuffer, - int32 /* id */) - -// Get the shared memory handle for a transfer buffer mapped to the callers -// process. -IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_GetTransferBuffer, - int32 /* id */, - base::SharedMemoryHandle /* transfer_buffer */, - uint32 /* size */) - -// Send from command buffer stub to proxy when window is invalid and must be -// repainted. -IPC_MESSAGE_ROUTED0(GpuCommandBufferMsg_NotifyRepaint) - -// Tells the GPU process to resize an offscreen frame buffer. -IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ResizeOffscreenFrameBuffer, - gfx::Size /* size */) - -#if defined(OS_MACOSX) -// On Mac OS X the GPU plugin must be offscreen, because there is no -// true cross-process window hierarchy. For this reason we must send -// resize events explicitly to the command buffer stub so it can -// reallocate its backing store and send the new one back to the -// browser. This message is currently used only on 10.6 and later. -IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SetWindowSize, - gfx::Size /* size */) -#endif - -//------------------------------------------------------------------------------ -// GPU Video Decoder Messages -// These messages are sent from Renderer process to GPU process. -// Initialize and configure GpuVideoDecoder asynchronously. -IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_Initialize, - GpuVideoDecoderInitParam) - -// Destroy and release GpuVideoDecoder asynchronously. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Destroy) - -// Start decoder flushing operation. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Flush) - -// Tell the decoder to start prerolling. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderMsg_Preroll) - -// Send input buffer to GpuVideoDecoder. -IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_EmptyThisBuffer, - GpuVideoDecoderInputBufferParam) - -// Ask the GPU process to produce a video frame with the ID. -IPC_MESSAGE_ROUTED1(GpuVideoDecoderMsg_ProduceVideoFrame, - int32) /* Video Frame ID */ - -// Sent from Renderer process to the GPU process to notify that textures are -// generated for a video frame. -IPC_MESSAGE_ROUTED2(GpuVideoDecoderMsg_VideoFrameAllocated, - int32, /* Video Frame ID */ - std::vector<uint32>) /* Textures for video frame */ - -//------------------------------------------------------------------------------ -// GPU Video Decoder Host Messages -// These messages are sent from GPU process to Renderer process. -// Inform GpuVideoDecoderHost that a GpuVideoDecoder is created. -IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_CreateVideoDecoderDone, - int32) /* decoder_id */ - -// Confirm GpuVideoDecoder had been initialized or failed to initialize. -// TODO(hclam): Change this to Done instead of ACK. -IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_InitializeACK, - GpuVideoDecoderInitDoneParam) - -// Confrim GpuVideoDecoder had been destroyed properly. -// TODO(hclam): Change this to Done instead of ACK. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_DestroyACK) - -// Confirm decoder had been flushed. -// TODO(hclam): Change this to Done instead of ACK. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_FlushACK) - -// Confirm preroll operation is done. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_PrerollDone) - -// GpuVideoDecoder has consumed input buffer from transfer buffer. -// TODO(hclam): Change this to Done instead of ACK. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferACK) - -// GpuVideoDecoder require new input buffer. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_EmptyThisBufferDone) - -// GpuVideoDecoder reports that a video frame is ready to be consumed. -IPC_MESSAGE_ROUTED4(GpuVideoDecoderHostMsg_ConsumeVideoFrame, - int32, /* Video Frame ID */ - int64, /* Timestamp in microseconds */ - int64, /* Duration in microseconds */ - int32) /* Flags */ - -// Allocate video frames for output of the hardware video decoder. -IPC_MESSAGE_ROUTED4(GpuVideoDecoderHostMsg_AllocateVideoFrames, - int32, /* Number of video frames to generate */ - uint32, /* Width of the video frame */ - uint32, /* Height of the video frame */ - int32 /* Format of the video frame */) - -// Release all video frames allocated for a hardware video decoder. -IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_ReleaseAllVideoFrames) - -// GpuVideoDecoder report output format change. -IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_MediaFormatChange, - GpuVideoDecoderFormatChangeParam) - -// GpuVideoDecoder report error. -IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_ErrorNotification, - GpuVideoDecoderErrorInfoParam) 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, |