summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 23:56:55 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 23:56:55 +0000
commita80f5ece3d46eeb0734cfca6c716d69e7ab7aaa2 (patch)
treee1b989fd7c67f745061a481692671b1331cffe02
parent56cbcc3ce45c1b68f9fbdbed6244bebe1f203403 (diff)
downloadchromium_src-a80f5ece3d46eeb0734cfca6c716d69e7ab7aaa2.zip
chromium_src-a80f5ece3d46eeb0734cfca6c716d69e7ab7aaa2.tar.gz
chromium_src-a80f5ece3d46eeb0734cfca6c716d69e7ab7aaa2.tar.bz2
Move GPUInfo to content/public/common and put it into the content namespace.
BUG=98716 Review URL: http://codereview.chromium.org/8363007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106637 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gpu_pixel_browsertest.cc8
-rw-r--r--chrome/browser/ui/webui/flash_ui.cc6
-rw-r--r--chrome/common/child_process_logging.h5
-rw-r--r--chrome/common/child_process_logging_linux.cc4
-rw-r--r--chrome/common/child_process_logging_mac.mm6
-rw-r--r--chrome/common/child_process_logging_win.cc4
-rw-r--r--chrome/common/chrome_content_client.cc2
-rw-r--r--chrome/common/chrome_content_client.h2
-rw-r--r--content/browser/gpu/gpu_blacklist.cc6
-rw-r--r--content/browser/gpu/gpu_blacklist.h9
-rw-r--r--content/browser/gpu/gpu_blacklist_unittest.cc6
-rw-r--r--content/browser/gpu/gpu_data_manager.cc78
-rw-r--r--content/browser/gpu/gpu_data_manager.h17
-rw-r--r--content/browser/gpu/gpu_process_host.cc12
-rw-r--r--content/browser/gpu/gpu_process_host.h8
-rw-r--r--content/browser/renderer_host/gpu_message_filter.cc4
-rw-r--r--content/common/gpu/gpu_channel_manager.cc2
-rw-r--r--content/common/gpu/gpu_info.cc77
-rw-r--r--content/common/gpu/gpu_info_unittest.cc4
-rw-r--r--content/common/gpu/gpu_messages.h10
-rw-r--r--content/content_common.gypi8
-rw-r--r--content/gpu/gpu_child_thread.cc4
-rw-r--r--content/gpu/gpu_child_thread.h7
-rw-r--r--content/gpu/gpu_dx_diagnostics_win.cc6
-rw-r--r--content/gpu/gpu_info_collector.cc8
-rw-r--r--content/gpu/gpu_info_collector.h21
-rw-r--r--content/gpu/gpu_info_collector_linux.cc8
-rw-r--r--content/gpu/gpu_info_collector_mac.mm10
-rw-r--r--content/gpu/gpu_info_collector_unittest.cc22
-rw-r--r--content/gpu/gpu_info_collector_unittest_win.cc6
-rw-r--r--content/gpu/gpu_info_collector_win.cc13
-rw-r--r--content/public/common/content_client.h4
-rw-r--r--content/public/common/dx_diag_node.cc (renamed from content/common/dx_diag_node.cc)6
-rw-r--r--content/public/common/dx_diag_node.h (renamed from content/common/dx_diag_node.h)11
-rw-r--r--content/public/common/gpu_info.cc18
-rw-r--r--content/public/common/gpu_info.h (renamed from content/common/gpu/gpu_info.h)20
-rw-r--r--content/renderer/gpu/gpu_channel_host.cc4
-rw-r--r--content/renderer/gpu/gpu_channel_host.h8
-rw-r--r--content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc2
-rw-r--r--content/renderer/render_thread_impl.cc2
-rw-r--r--content/test/test_content_client.cc2
-rw-r--r--content/test/test_content_client.h2
42 files changed, 242 insertions, 220 deletions
diff --git a/chrome/browser/gpu_pixel_browsertest.cc b/chrome/browser/gpu_pixel_browsertest.cc
index 92d6134..8fa3fa7 100644
--- a/chrome/browser/gpu_pixel_browsertest.cc
+++ b/chrome/browser/gpu_pixel_browsertest.cc
@@ -23,7 +23,7 @@
#include "content/browser/gpu/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/gpu_info.h"
+#include "content/public/common/gpu_info.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -88,9 +88,9 @@ void ResizeTabContainer(Browser* browser, const gfx::Size& desired_size) {
// which should be always collected during browser startup, so no need to run
// GPU information collection here.
// This will return false if we are running in a virtualized environment.
-bool GetGPUInfo(GPUInfo* client_info) {
+bool GetGPUInfo(content::GPUInfo* client_info) {
CHECK(client_info);
- const GPUInfo& info = GpuDataManager::GetInstance()->gpu_info();
+ const content::GPUInfo& info = GpuDataManager::GetInstance()->gpu_info();
if (info.vendor_id == 0 || info.device_id == 0)
return false;
*client_info = info;
@@ -166,7 +166,7 @@ class GpuPixelBrowserTest : public InProcessBrowserTest {
#else
#error "Not implemented for this platform"
#endif
- GPUInfo info;
+ content::GPUInfo info;
if (!GetGPUInfo(&info)) {
LOG(ERROR) << "Could not get gpu info";
return false;
diff --git a/chrome/browser/ui/webui/flash_ui.cc b/chrome/browser/ui/webui/flash_ui.cc
index 074a687..e23de2a7 100644
--- a/chrome/browser/ui/webui/flash_ui.cc
+++ b/chrome/browser/ui/webui/flash_ui.cc
@@ -297,13 +297,13 @@ void FlashDOMHandler::MaybeRespondToPage() {
// GPU information.
AddPair(list, ASCIIToUTF16(""), "--- GPU information ---");
- const GPUInfo& gpu_info = gpu_data_manager_->gpu_info();
+ const content::GPUInfo& gpu_info = gpu_data_manager_->gpu_info();
if (!gpu_data_manager_->GpuAccessAllowed())
AddPair(list, ASCIIToUTF16("WARNING:"), "GPU access is not allowed");
#if defined(OS_WIN)
- const DxDiagNode& node = gpu_info.dx_diagnostics;
- for (std::map<std::string, DxDiagNode>::const_iterator it =
+ const content::DxDiagNode& node = gpu_info.dx_diagnostics;
+ for (std::map<std::string, content::DxDiagNode>::const_iterator it =
node.children.begin();
it != node.children.end();
++it) {
diff --git a/chrome/common/child_process_logging.h b/chrome/common/child_process_logging.h
index 7117962..8b5a733 100644
--- a/chrome/common/child_process_logging.h
+++ b/chrome/common/child_process_logging.h
@@ -14,7 +14,10 @@
#include "googleurl/src/gurl.h"
class CommandLine;
+
+namespace content {
struct GPUInfo;
+}
// The maximum number of active extensions we will report.
// Also used in chrome/app, but we define it here to avoid a common->app
@@ -76,7 +79,7 @@ void SetActiveExtensions(const std::set<std::string>& extension_ids);
void SetNumberOfViews(int number_of_views);
// Sets the data on the gpu to send along with crash reports.
-void SetGpuInfo(const GPUInfo& gpu_info);
+void SetGpuInfo(const content::GPUInfo& gpu_info);
// Sets the command line arguments to send along with crash reports to the
// values in |command_line|.
diff --git a/chrome/common/child_process_logging_linux.cc b/chrome/common/child_process_logging_linux.cc
index 37ae5b8..bae5e0c 100644
--- a/chrome/common/child_process_logging_linux.cc
+++ b/chrome/common/child_process_logging_linux.cc
@@ -10,7 +10,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/installer/util/google_update_settings.h"
-#include "content/common/gpu/gpu_info.h"
+#include "content/public/common/gpu_info.h"
#include "googleurl/src/gurl.h"
namespace child_process_logging {
@@ -83,7 +83,7 @@ void SetActiveExtensions(const std::set<std::string>& extension_ids) {
g_extension_ids[kMaxExtensionSize - 1] = '\0';
}
-void SetGpuInfo(const GPUInfo& gpu_info) {
+void SetGpuInfo(const content::GPUInfo& gpu_info) {
snprintf(g_gpu_vendor_id, kGpuStringSize, "0x%04x", gpu_info.vendor_id);
snprintf(g_gpu_device_id, kGpuStringSize, "0x%04x", gpu_info.device_id);
strncpy(g_gpu_driver_ver,
diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm
index 491432a..21bc369 100644
--- a/chrome/common/child_process_logging_mac.mm
+++ b/chrome/common/child_process_logging_mac.mm
@@ -13,7 +13,7 @@
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/installer/util/google_update_settings.h"
-#include "content/common/gpu/gpu_info.h"
+#include "content/public/common/gpu_info.h"
#include "googleurl/src/gurl.h"
namespace child_process_logging {
@@ -137,7 +137,7 @@ void SetGpuKeyValue(const char* param_name, const std::string& value_str,
set_key_func(key, value);
}
-void SetGpuInfoImpl(const GPUInfo& gpu_info,
+void SetGpuInfoImpl(const content::GPUInfo& gpu_info,
SetCrashKeyValueFuncPtr set_key_func) {
SetGpuKeyValue(kGPUVendorIdParamName,
base::StringPrintf("0x%04x", gpu_info.vendor_id),
@@ -159,7 +159,7 @@ void SetGpuInfoImpl(const GPUInfo& gpu_info,
set_key_func);
}
-void SetGpuInfo(const GPUInfo& gpu_info) {
+void SetGpuInfo(const content::GPUInfo& gpu_info) {
SetGpuInfoImpl(gpu_info, SetCrashKeyValue);
}
diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc
index 512a766..b67d66a 100644
--- a/chrome/common/child_process_logging_win.cc
+++ b/chrome/common/child_process_logging_win.cc
@@ -13,7 +13,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/installer/util/google_update_settings.h"
-#include "content/common/gpu/gpu_info.h"
+#include "content/public/common/gpu_info.h"
#include "googleurl/src/gurl.h"
namespace child_process_logging {
@@ -131,7 +131,7 @@ void SetActiveExtensions(const std::set<std::string>& extension_ids) {
}
}
-void SetGpuInfo(const GPUInfo& gpu_info) {
+void SetGpuInfo(const content::GPUInfo& gpu_info) {
static MainSetGpuInfo set_gpu_info = NULL;
if (!set_gpu_info) {
HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index 2202aa5..127e1df 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -264,7 +264,7 @@ void ChromeContentClient::SetActiveURL(const GURL& url) {
child_process_logging::SetActiveURL(url);
}
-void ChromeContentClient::SetGpuInfo(const GPUInfo& gpu_info) {
+void ChromeContentClient::SetGpuInfo(const content::GPUInfo& gpu_info) {
child_process_logging::SetGpuInfo(gpu_info);
}
diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h
index a1b3bd9..e7b383f 100644
--- a/chrome/common/chrome_content_client.h
+++ b/chrome/common/chrome_content_client.h
@@ -18,7 +18,7 @@ class ChromeContentClient : public content::ContentClient {
static const char* const kNaClOldPluginName;
virtual void SetActiveURL(const GURL& url) OVERRIDE;
- virtual void SetGpuInfo(const GPUInfo& gpu_info) OVERRIDE;
+ virtual void SetGpuInfo(const content::GPUInfo& gpu_info) OVERRIDE;
virtual void AddPepperPlugins(
std::vector<PepperPluginInfo>* plugins) OVERRIDE;
virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE;
diff --git a/content/browser/gpu/gpu_blacklist.cc b/content/browser/gpu/gpu_blacklist.cc
index c81bb48..98186cf 100644
--- a/content/browser/gpu/gpu_blacklist.cc
+++ b/content/browser/gpu/gpu_blacklist.cc
@@ -14,7 +14,7 @@
#include "base/sys_info.h"
#include "base/values.h"
#include "base/version.h"
-#include "content/common/gpu/gpu_info.h"
+#include "content/public/common/gpu_info.h"
namespace {
@@ -581,7 +581,7 @@ void GpuBlacklist::GpuBlacklistEntry::AddBrowserChannel(
bool GpuBlacklist::GpuBlacklistEntry::Contains(
OsType os_type, const Version& os_version, BrowserChannel channel,
- const GPUInfo& gpu_info) const {
+ const content::GPUInfo& gpu_info) const {
DCHECK(os_type != kOsAny);
if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version))
return false;
@@ -740,7 +740,7 @@ bool GpuBlacklist::LoadGpuBlacklist(
GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags(
GpuBlacklist::OsType os,
Version* os_version,
- const GPUInfo& gpu_info) {
+ const content::GPUInfo& gpu_info) {
active_entries_.clear();
GpuFeatureFlags flags;
diff --git a/content/browser/gpu/gpu_blacklist.h b/content/browser/gpu/gpu_blacklist.h
index 9aa81a8..7ee77c2 100644
--- a/content/browser/gpu/gpu_blacklist.h
+++ b/content/browser/gpu/gpu_blacklist.h
@@ -18,12 +18,15 @@
#include "content/common/gpu/gpu_feature_flags.h"
class Version;
-struct GPUInfo;
namespace base {
class DictionaryValue;
}
+namespace content {
+struct GPUInfo;
+}
+
class CONTENT_EXPORT GpuBlacklist {
public:
enum OsType {
@@ -57,7 +60,7 @@ class CONTENT_EXPORT GpuBlacklist {
// current OS version.
GpuFeatureFlags DetermineGpuFeatureFlags(OsType os,
Version* os_version,
- const GPUInfo& gpu_info);
+ const content::GPUInfo& gpu_info);
// Collects the active entries that set the "feature" flag from the last
// DetermineGpuFeatureFlags() call. This tells which entries are responsible
@@ -212,7 +215,7 @@ class CONTENT_EXPORT GpuBlacklist {
bool Contains(OsType os_type,
const Version& os_version,
BrowserChannel channel,
- const GPUInfo& gpu_info) const;
+ const content::GPUInfo& gpu_info) const;
// Returns the OsType.
OsType GetOsType() const;
diff --git a/content/browser/gpu/gpu_blacklist_unittest.cc b/content/browser/gpu/gpu_blacklist_unittest.cc
index 29239f0..a598322 100644
--- a/content/browser/gpu/gpu_blacklist_unittest.cc
+++ b/content/browser/gpu/gpu_blacklist_unittest.cc
@@ -11,7 +11,7 @@
#include "base/path_service.h"
#include "base/version.h"
#include "content/browser/gpu/gpu_blacklist.h"
-#include "content/common/gpu/gpu_info.h"
+#include "content/public/common/gpu_info.h"
#include "testing/gtest/include/gtest/gtest.h"
class GpuBlacklistTest : public testing::Test {
@@ -20,7 +20,7 @@ class GpuBlacklistTest : public testing::Test {
virtual ~GpuBlacklistTest() { }
- const GPUInfo& gpu_info() const {
+ const content::GPUInfo& gpu_info() const {
return gpu_info_;
}
@@ -39,7 +39,7 @@ class GpuBlacklistTest : public testing::Test {
}
private:
- GPUInfo gpu_info_;
+ content::GPUInfo gpu_info_;
};
TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) {
diff --git a/content/browser/gpu/gpu_data_manager.cc b/content/browser/gpu/gpu_data_manager.cc
index f9b8e3d..8bd3bbd 100644
--- a/content/browser/gpu/gpu_data_manager.cc
+++ b/content/browser/gpu/gpu_data_manager.cc
@@ -92,7 +92,7 @@ enum WinSubVersion {
};
// Output DxDiagNode tree as nested array of {description,value} pairs
-ListValue* DxDiagNodeToList(const DxDiagNode& node) {
+ListValue* DxDiagNodeToList(const content::DxDiagNode& node) {
ListValue* list = new ListValue();
for (std::map<std::string, std::string>::const_iterator it =
node.values.begin();
@@ -101,7 +101,7 @@ ListValue* DxDiagNodeToList(const DxDiagNode& node) {
list->Append(NewDescriptionValuePair(it->first, it->second));
}
- for (std::map<std::string, DxDiagNode>::const_iterator it =
+ for (std::map<std::string, content::DxDiagNode>::const_iterator it =
node.children.begin();
it != node.children.end();
++it) {
@@ -197,7 +197,7 @@ void GpuDataManager::Initialize() {
// on UI thread later, and we skip the preliminary gpu info collection
// in such situation.
if (BrowserThread::CurrentlyOn(BrowserThread::FILE)) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info);
UpdateGpuInfo(gpu_info);
}
@@ -232,10 +232,10 @@ void GpuDataManager::RequestCompleteGpuInfoIfNeeded() {
new GpuMsg_CollectGraphicsInfo());
}
-void GpuDataManager::UpdateGpuInfo(const GPUInfo& gpu_info) {
+void GpuDataManager::UpdateGpuInfo(const content::GPUInfo& gpu_info) {
{
base::AutoLock auto_lock(gpu_info_lock_);
- if (!gpu_info_.Merge(gpu_info))
+ if (!Merge(&gpu_info_, gpu_info))
return;
}
@@ -249,7 +249,7 @@ void GpuDataManager::UpdateGpuInfo(const GPUInfo& gpu_info) {
UpdateGpuFeatureFlags();
}
-const GPUInfo& GpuDataManager::gpu_info() const {
+const content::GPUInfo& GpuDataManager::gpu_info() const {
base::AutoLock auto_lock(gpu_info_lock_);
return gpu_info_;
}
@@ -515,7 +515,7 @@ void GpuDataManager::UpdateGpuBlacklist(
void GpuDataManager::HandleGpuSwitch() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectVideoCardInfo(&gpu_info);
LOG(INFO) << "Switching to use GPU: vendor_id = 0x"
<< base::StringPrintf("%04x", gpu_info.vendor_id)
@@ -698,3 +698,67 @@ bool GpuDataManager::UseGLIsOSMesaOrAny() {
user_flags_.use_gl() == gfx::kGLImplementationOSMesaName);
}
+bool GpuDataManager::Merge(content::GPUInfo* object,
+ const content::GPUInfo& other) {
+ if (object->device_id != other.device_id ||
+ object->vendor_id != other.vendor_id) {
+ *object = other;
+ return true;
+ }
+
+ bool changed = false;
+ if (!object->finalized) {
+ object->finalized = other.finalized;
+ object->initialization_time = other.initialization_time;
+
+ if (object->driver_vendor.empty()) {
+ changed |= object->driver_vendor != other.driver_vendor;
+ object->driver_vendor = other.driver_vendor;
+ }
+ if (object->driver_version.empty()) {
+ changed |= object->driver_version != other.driver_version;
+ object->driver_version = other.driver_version;
+ }
+ if (object->driver_date.empty()) {
+ changed |= object->driver_date != other.driver_date;
+ object->driver_date = other.driver_date;
+ }
+ if (object->pixel_shader_version.empty()) {
+ changed |= object->pixel_shader_version != other.pixel_shader_version;
+ object->pixel_shader_version = other.pixel_shader_version;
+ }
+ if (object->vertex_shader_version.empty()) {
+ changed |= object->vertex_shader_version != other.vertex_shader_version;
+ object->vertex_shader_version = other.vertex_shader_version;
+ }
+ if (object->gl_version.empty()) {
+ changed |= object->gl_version != other.gl_version;
+ object->gl_version = other.gl_version;
+ }
+ if (object->gl_version_string.empty()) {
+ changed |= object->gl_version_string != other.gl_version_string;
+ object->gl_version_string = other.gl_version_string;
+ }
+ if (object->gl_vendor.empty()) {
+ changed |= object->gl_vendor != other.gl_vendor;
+ object->gl_vendor = other.gl_vendor;
+ }
+ if (object->gl_renderer.empty()) {
+ changed |= object->gl_renderer != other.gl_renderer;
+ object->gl_renderer = other.gl_renderer;
+ }
+ if (object->gl_extensions.empty()) {
+ changed |= object->gl_extensions != other.gl_extensions;
+ object->gl_extensions = other.gl_extensions;
+ }
+ object->can_lose_context = other.can_lose_context;
+#if defined(OS_WIN)
+ if (object->dx_diagnostics.values.size() == 0 &&
+ object->dx_diagnostics.children.size() == 0) {
+ object->dx_diagnostics = other.dx_diagnostics;
+ changed = true;
+ }
+#endif
+ }
+ return changed;
+}
diff --git a/content/browser/gpu/gpu_data_manager.h b/content/browser/gpu/gpu_data_manager.h
index bac847d..e92f716 100644
--- a/content/browser/gpu/gpu_data_manager.h
+++ b/content/browser/gpu/gpu_data_manager.h
@@ -17,7 +17,7 @@
#include "base/values.h"
#include "content/common/content_export.h"
#include "content/common/gpu/gpu_feature_flags.h"
-#include "content/common/gpu/gpu_info.h"
+#include "content/public/common/gpu_info.h"
class CommandLine;
class GpuBlacklist;
@@ -31,9 +31,9 @@ class CONTENT_EXPORT GpuDataManager {
void RequestCompleteGpuInfoIfNeeded();
// Only update if the current GPUInfo is not finalized.
- void UpdateGpuInfo(const GPUInfo& gpu_info);
+ void UpdateGpuInfo(const content::GPUInfo& gpu_info);
- const GPUInfo& gpu_info() const;
+ const content::GPUInfo& gpu_info() const;
// Returns status of various GPU features. This is two parted:
// {
@@ -178,6 +178,15 @@ class CONTENT_EXPORT GpuDataManager {
// If use-gl switch is osmesa or any, return true.
bool UseGLIsOSMesaOrAny();
+ // Merges the second GPUInfo object with the first.
+ // If it's the same GPU, i.e., device id and vendor id are the same, then
+ // copy over the fields that are not set yet and ignore the rest.
+ // If it's a different GPU, then reset and copy over everything.
+ // Return true if something changes that may affect blacklisting; currently
+ // they are device_id, vendor_id, driver_vendor, driver_version, driver_date,
+ // and gl_renderer.
+ static bool Merge(content::GPUInfo* object, const content::GPUInfo& other);
+
bool complete_gpu_info_already_requested_;
GpuFeatureFlags gpu_feature_flags_;
@@ -185,7 +194,7 @@ class CONTENT_EXPORT GpuDataManager {
UserFlags user_flags_;
- GPUInfo gpu_info_;
+ content::GPUInfo gpu_info_;
mutable base::Lock gpu_info_lock_;
scoped_ptr<GpuBlacklist> gpu_blacklist_;
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 54ccfd9..b3e05a9 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -350,7 +350,7 @@ void GpuProcessHost::EstablishGpuChannel(
if (!GpuDataManager::GetInstance()->GpuAccessAllowed()) {
EstablishChannelError(
wrapped_callback.release(), IPC::ChannelHandle(),
- base::kNullProcessHandle, GPUInfo());
+ base::kNullProcessHandle, content::GPUInfo());
return;
}
@@ -359,7 +359,7 @@ void GpuProcessHost::EstablishGpuChannel(
} else {
EstablishChannelError(
wrapped_callback.release(), IPC::ChannelHandle(),
- base::kNullProcessHandle, GPUInfo());
+ base::kNullProcessHandle, content::GPUInfo());
}
}
@@ -417,7 +417,7 @@ void GpuProcessHost::OnChannelEstablished(
EstablishChannelError(callback.release(),
IPC::ChannelHandle(),
base::kNullProcessHandle,
- GPUInfo());
+ content::GPUInfo());
RouteOnUIThread(GpuHostMsg_OnLogMessage(
logging::LOG_WARNING,
"WARNING",
@@ -452,7 +452,7 @@ void GpuProcessHost::OnDestroyCommandBuffer(
#endif // defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI)
}
-void GpuProcessHost::OnGraphicsInfoCollected(const GPUInfo& gpu_info) {
+void GpuProcessHost::OnGraphicsInfoCollected(const content::GPUInfo& gpu_info) {
GpuDataManager::GetInstance()->UpdateGpuInfo(gpu_info);
}
@@ -597,7 +597,7 @@ void GpuProcessHost::SendOutstandingReplies() {
EstablishChannelError(callback.release(),
IPC::ChannelHandle(),
base::kNullProcessHandle,
- GPUInfo());
+ content::GPUInfo());
}
}
@@ -605,7 +605,7 @@ void GpuProcessHost::EstablishChannelError(
EstablishChannelCallback* callback,
const IPC::ChannelHandle& channel_handle,
base::ProcessHandle renderer_process_for_gpu,
- const GPUInfo& gpu_info) {
+ const content::GPUInfo& gpu_info) {
scoped_ptr<EstablishChannelCallback> wrapped_callback(callback);
wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info);
}
diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h
index b337176..9f2b520 100644
--- a/content/browser/gpu/gpu_process_host.h
+++ b/content/browser/gpu/gpu_process_host.h
@@ -14,8 +14,8 @@
#include "base/threading/non_thread_safe.h"
#include "content/browser/browser_child_process_host.h"
#include "content/common/content_export.h"
-#include "content/common/gpu/gpu_info.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
+#include "content/public/common/gpu_info.h"
#include "ui/gfx/native_widget_types.h"
struct GPUCreateCommandBufferConfig;
@@ -60,7 +60,7 @@ class GpuProcessHost : public BrowserChildProcessHost,
typedef Callback3<const IPC::ChannelHandle&,
base::ProcessHandle,
- const GPUInfo&>::Type
+ const content::GPUInfo&>::Type
EstablishChannelCallback;
// Tells the GPU process to create a new channel for communication with a
@@ -99,7 +99,7 @@ class GpuProcessHost : public BrowserChildProcessHost,
void OnCommandBufferCreated(const int32 route_id);
void OnDestroyCommandBuffer(
gfx::PluginWindowHandle window, int32 renderer_id, int32 render_view_id);
- void OnGraphicsInfoCollected(const GPUInfo& gpu_info);
+ void OnGraphicsInfoCollected(const content::GPUInfo& gpu_info);
bool LaunchGpuProcess();
@@ -108,7 +108,7 @@ class GpuProcessHost : public BrowserChildProcessHost,
EstablishChannelCallback* callback,
const IPC::ChannelHandle& channel_handle,
base::ProcessHandle renderer_process_for_gpu,
- const GPUInfo& gpu_info);
+ const content::GPUInfo& gpu_info);
void CreateCommandBufferError(CreateCommandBufferCallback* callback,
int32 route_id);
diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc
index 22b4c7a..ab9e52b 100644
--- a/content/browser/renderer_host/gpu_message_filter.cc
+++ b/content/browser/renderer_host/gpu_message_filter.cc
@@ -50,7 +50,7 @@ namespace {
class EstablishChannelCallback
: public CallbackRunner<Tuple3<const IPC::ChannelHandle&,
base::ProcessHandle,
- const GPUInfo&> > {
+ const content::GPUInfo&> > {
public:
EstablishChannelCallback(GpuMessageFilter* filter, IPC::Message* reply)
: filter_(filter->AsWeakPtr()),
@@ -63,7 +63,7 @@ class EstablishChannelCallback
void Send(const IPC::ChannelHandle& channel,
base::ProcessHandle gpu_process_for_browser,
- const GPUInfo& gpu_info) {
+ const content::GPUInfo& gpu_info) {
if (!filter_)
return;
diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc
index 6d9db28..346ff7b 100644
--- a/content/common/gpu/gpu_channel_manager.cc
+++ b/content/common/gpu/gpu_channel_manager.cc
@@ -76,7 +76,7 @@ bool GpuChannelManager::Send(IPC::Message* msg) {
void GpuChannelManager::OnEstablishChannel(int renderer_id) {
scoped_refptr<GpuChannel> channel;
IPC::ChannelHandle channel_handle;
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id);
if (iter == gpu_channels_.end())
diff --git a/content/common/gpu/gpu_info.cc b/content/common/gpu/gpu_info.cc
deleted file mode 100644
index afd7686..0000000
--- a/content/common/gpu/gpu_info.cc
+++ /dev/null
@@ -1,77 +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 "content/common/gpu/gpu_info.h"
-
-GPUInfo::GPUInfo()
- : finalized(false),
- vendor_id(0),
- device_id(0),
- can_lose_context(false) {
-}
-
-GPUInfo::~GPUInfo() { }
-
-bool GPUInfo::Merge(const GPUInfo& other) {
- if (device_id != other.device_id || vendor_id != other.vendor_id) {
- *this = other;
- return true;
- }
-
- bool changed = false;
- if (!finalized) {
- finalized = other.finalized;
- initialization_time = other.initialization_time;
-
- if (driver_vendor.empty()) {
- changed |= driver_vendor != other.driver_vendor;
- driver_vendor = other.driver_vendor;
- }
- if (driver_version.empty()) {
- changed |= driver_version != other.driver_version;
- driver_version = other.driver_version;
- }
- if (driver_date.empty()) {
- changed |= driver_date != other.driver_date;
- driver_date = other.driver_date;
- }
- if (pixel_shader_version.empty()) {
- changed |= pixel_shader_version != other.pixel_shader_version;
- pixel_shader_version = other.pixel_shader_version;
- }
- if (vertex_shader_version.empty()) {
- changed |= vertex_shader_version != other.vertex_shader_version;
- vertex_shader_version = other.vertex_shader_version;
- }
- if (gl_version.empty()) {
- changed |= gl_version != other.gl_version;
- gl_version = other.gl_version;
- }
- if (gl_version_string.empty()) {
- changed |= gl_version_string != other.gl_version_string;
- gl_version_string = other.gl_version_string;
- }
- if (gl_vendor.empty()) {
- changed |= gl_vendor != other.gl_vendor;
- gl_vendor = other.gl_vendor;
- }
- if (gl_renderer.empty()) {
- changed |= gl_renderer != other.gl_renderer;
- gl_renderer = other.gl_renderer;
- }
- if (gl_extensions.empty()) {
- changed |= gl_extensions != other.gl_extensions;
- gl_extensions = other.gl_extensions;
- }
- can_lose_context = other.can_lose_context;
-#if defined(OS_WIN)
- if (dx_diagnostics.values.size() == 0 &&
- dx_diagnostics.children.size() == 0) {
- dx_diagnostics = other.dx_diagnostics;
- changed = true;
- }
-#endif
- }
- return changed;
-}
diff --git a/content/common/gpu/gpu_info_unittest.cc b/content/common/gpu/gpu_info_unittest.cc
index 887b5f1..1ce8410 100644
--- a/content/common/gpu/gpu_info_unittest.cc
+++ b/content/common/gpu/gpu_info_unittest.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/gpu/gpu_info.h"
+#include "content/public/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;
+ content::GPUInfo gpu_info;
EXPECT_EQ(gpu_info.finalized, false);
EXPECT_EQ(gpu_info.initialization_time.ToInternalValue(), 0);
EXPECT_EQ(gpu_info.vendor_id, 0u);
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index 6b2a95e..c9ffc4c 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -10,8 +10,8 @@
#include "base/shared_memory.h"
#include "content/common/common_param_traits.h"
-#include "content/common/gpu/gpu_info.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
+#include "content/public/common/gpu_info.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/ipc/gpu_command_buffer_traits.h"
@@ -87,12 +87,12 @@ IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceRelease_Params)
IPC_STRUCT_END()
#endif
-IPC_STRUCT_TRAITS_BEGIN(DxDiagNode)
+IPC_STRUCT_TRAITS_BEGIN(content::DxDiagNode)
IPC_STRUCT_TRAITS_MEMBER(values)
IPC_STRUCT_TRAITS_MEMBER(children)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(GPUInfo)
+IPC_STRUCT_TRAITS_BEGIN(content::GPUInfo)
IPC_STRUCT_TRAITS_MEMBER(finalized)
IPC_STRUCT_TRAITS_MEMBER(initialization_time)
IPC_STRUCT_TRAITS_MEMBER(vendor_id)
@@ -200,7 +200,7 @@ IPC_SYNC_MESSAGE_CONTROL1_3(GpuHostMsg_EstablishGpuChannel,
content::CauseForGpuLaunch,
IPC::ChannelHandle /* handle to channel */,
base::ProcessHandle /* renderer_process_for_gpu */,
- GPUInfo /* stats about GPU process*/)
+ content::GPUInfo /* stats about GPU process*/)
// A renderer sends this to the browser process when it wants to
// create a GL context associated with the given view_id.
@@ -226,7 +226,7 @@ IPC_MESSAGE_CONTROL3(GpuHostMsg_DestroyCommandBuffer,
// Response from GPU to a GpuMsg_CollectGraphicsInfo.
IPC_MESSAGE_CONTROL1(GpuHostMsg_GraphicsInfoCollected,
- GPUInfo /* GPU logging stats */)
+ content::GPUInfo /* GPU logging stats */)
// Message from GPU to add a GPU log message to the about:gpu page.
IPC_MESSAGE_CONTROL3(GpuHostMsg_OnLogMessage,
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 0803eb9..a986170 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -32,6 +32,10 @@
'public/common/child_process_sandbox_support_linux.h',
'public/common/content_switches.cc',
'public/common/content_switches.h',
+ 'public/common/dx_diag_node.cc',
+ 'public/common/dx_diag_node.h',
+ 'public/common/gpu_info.cc',
+ 'public/common/gpu_info.h',
'public/common/page_transition_types.cc',
'public/common/page_transition_types.h',
'public/common/page_type.h',
@@ -89,8 +93,6 @@
'common/dom_storage_common.h',
'common/dom_storage_messages.h',
'common/drag_messages.h',
- 'common/dx_diag_node.cc',
- 'common/dx_diag_node.h',
'common/edit_command.h',
'common/file_system/file_system_dispatcher.cc',
'common/file_system/file_system_dispatcher.h',
@@ -120,8 +122,6 @@
'common/gpu/gpu_config.h',
'common/gpu/gpu_feature_flags.cc',
'common/gpu/gpu_feature_flags.h',
- 'common/gpu/gpu_info.cc',
- 'common/gpu/gpu_info.h',
'common/gpu/gpu_messages.h',
'common/gpu/gpu_process_launch_causes.h',
'common/gpu/gpu_watchdog.h',
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index 5288984..22d7831 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -216,7 +216,7 @@ void GpuChildThread::OnHang() {
void GpuChildThread::CollectDxDiagnostics(GpuChildThread* thread) {
base::win::ScopedCOMInitializer com_initializer;
- DxDiagNode node;
+ content::DxDiagNode node;
gpu_info_collector::GetDxDiagnostics(&node);
thread->message_loop()->PostTask(
@@ -226,7 +226,7 @@ void GpuChildThread::CollectDxDiagnostics(GpuChildThread* thread) {
// Runs on the main thread.
void GpuChildThread::SetDxDiagnostics(GpuChildThread* thread,
- const DxDiagNode& node) {
+ const content::DxDiagNode& node) {
thread->gpu_info_.dx_diagnostics = node;
thread->gpu_info_.finalized = true;
thread->collecting_dx_diagnostics_ = false;
diff --git a/content/gpu/gpu_child_thread.h b/content/gpu/gpu_child_thread.h
index 06643dc..5409963 100644
--- a/content/gpu/gpu_child_thread.h
+++ b/content/gpu/gpu_child_thread.h
@@ -18,8 +18,8 @@
#include "content/common/gpu/gpu_channel.h"
#include "content/common/gpu/gpu_channel_manager.h"
#include "content/common/gpu/gpu_config.h"
-#include "content/common/gpu/gpu_info.h"
#include "content/common/gpu/x_util.h"
+#include "content/public/common/gpu_info.h"
#include "ui/gfx/native_widget_types.h"
namespace IPC {
@@ -62,7 +62,8 @@ class GpuChildThread : public ChildThread {
#if defined(OS_WIN)
static void CollectDxDiagnostics(GpuChildThread* thread);
- static void SetDxDiagnostics(GpuChildThread* thread, const DxDiagNode& node);
+ static void SetDxDiagnostics(GpuChildThread* thread,
+ const content::DxDiagNode& node);
#endif
// Set this flag to true if a fatal error occurred before we receive the
@@ -82,7 +83,7 @@ class GpuChildThread : public ChildThread {
scoped_ptr<GpuChannelManager> gpu_channel_manager_;
// Information about the GPU, such as device and vendor ID.
- GPUInfo gpu_info_;
+ content::GPUInfo gpu_info_;
DISALLOW_COPY_AND_ASSIGN(GpuChildThread);
};
diff --git a/content/gpu/gpu_dx_diagnostics_win.cc b/content/gpu/gpu_dx_diagnostics_win.cc
index 9d9125c..728ab32 100644
--- a/content/gpu/gpu_dx_diagnostics_win.cc
+++ b/content/gpu/gpu_dx_diagnostics_win.cc
@@ -21,7 +21,7 @@ namespace {
// Traverses the IDxDiagContainer tree and populates a tree of DxDiagNode
// structures that contains property name / value pairs and subtrees of DirectX
// diagnostic information.
-void RecurseDiagnosticTree(DxDiagNode* output,
+void RecurseDiagnosticTree(content::DxDiagNode* output,
IDxDiagContainer* container,
int depth) {
HRESULT hr;
@@ -75,7 +75,7 @@ void RecurseDiagnosticTree(DxDiagNode* output,
arraysize(child_name16));
if (SUCCEEDED(hr)) {
std::string child_name8 = WideToUTF8(child_name16);
- DxDiagNode* output_child =
+ content::DxDiagNode* output_child =
&output->children[child_name8];
IDxDiagContainer* child_container = NULL;
@@ -94,7 +94,7 @@ void RecurseDiagnosticTree(DxDiagNode* output,
namespace gpu_info_collector {
-bool GetDxDiagnostics(DxDiagNode* output) {
+bool GetDxDiagnostics(content::DxDiagNode* output) {
HRESULT hr;
bool success = false;
diff --git a/content/gpu/gpu_info_collector.cc b/content/gpu/gpu_info_collector.cc
index 1838be1..a8ae608 100644
--- a/content/gpu/gpu_info_collector.cc
+++ b/content/gpu/gpu_info_collector.cc
@@ -78,9 +78,7 @@ std::string GetVersionFromString(const std::string& version_string) {
namespace gpu_info_collector {
-bool CollectGraphicsInfoGL(GPUInfo* gpu_info) {
- DCHECK(gpu_info);
-
+bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info) {
if (!gfx::GLSurface::InitializeOneOff()) {
LOG(ERROR) << "gfx::GLSurface::InitializeOneOff() failed";
return false;
@@ -106,9 +104,7 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) {
return (validGLVersionInfo && validVideoCardInfo && validDriverInfo);
}
-bool CollectGLVersionInfo(GPUInfo* gpu_info) {
- DCHECK(gpu_info);
-
+bool CollectGLVersionInfo(content::GPUInfo* gpu_info) {
std::string gl_version_string = gpu_info->gl_version_string;
std::string glsl_version_string =
GetGLString(GL_SHADING_LANGUAGE_VERSION);
diff --git a/content/gpu/gpu_info_collector.h b/content/gpu/gpu_info_collector.h
index d2a42ef..b0df5aa 100644
--- a/content/gpu/gpu_info_collector.h
+++ b/content/gpu/gpu_info_collector.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
-#include "content/common/gpu/gpu_info.h"
+#include "content/public/common/gpu_info.h"
struct IDirect3D9;
@@ -17,12 +17,12 @@ namespace gpu_info_collector {
// Populate variables with necessary graphics card information.
// Returns true on success.
-bool CollectGraphicsInfo(GPUInfo* gpu_info);
+bool CollectGraphicsInfo(content::GPUInfo* gpu_info);
// Similar to CollectGraphicsInfo, only this collects a subset of variables
// without creating a GL/DirectX context (and without the danger of crashing).
// The subset each platform collects may be different.
-bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info);
+bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info);
#if defined(OS_WIN)
// Windows provides two ways of doing graphics so we need two ways of
@@ -30,29 +30,30 @@ bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info);
// The selection between the two methods is done in the cc file.
// A D3D argument is passed in for testing purposes
-bool CONTENT_EXPORT CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info);
+bool CONTENT_EXPORT CollectGraphicsInfoD3D(IDirect3D9* d3d,
+ content::GPUInfo* gpu_info);
// Collects D3D driver version/date through registry lookup.
// Note that this does not require a D3D context.
// device_id here is the raw data in DISPLAY_DEVICE.
bool CONTENT_EXPORT CollectDriverInfoD3D(const std::wstring& device_id,
- GPUInfo* gpu_info);
+ content::GPUInfo* gpu_info);
// Collect the DirectX Disagnostics information about the attached displays.
-bool GetDxDiagnostics(DxDiagNode* output);
+bool GetDxDiagnostics(content::DxDiagNode* output);
#endif
// All platforms have a GL version for collecting information
-bool CONTENT_EXPORT CollectGraphicsInfoGL(GPUInfo* gpu_info);
+bool CONTENT_EXPORT CollectGraphicsInfoGL(content::GPUInfo* gpu_info);
// Collect GL and Shading language version information
-bool CollectGLVersionInfo(GPUInfo* gpu_info);
+bool CollectGLVersionInfo(content::GPUInfo* gpu_info);
// Platform specific method for collecting vendor and device ids
-bool CollectVideoCardInfo(GPUInfo* gpu_info);
+bool CollectVideoCardInfo(content::GPUInfo* gpu_info);
// Each platform stores the driver version on the GL_VERSION string differently
-bool CollectDriverInfoGL(GPUInfo* gpu_info);
+bool CollectDriverInfoGL(content::GPUInfo* gpu_info);
} // namespace gpu_info_collector
diff --git a/content/gpu/gpu_info_collector_linux.cc b/content/gpu/gpu_info_collector_linux.cc
index bcd1a78..1e89ca8 100644
--- a/content/gpu/gpu_info_collector_linux.cc
+++ b/content/gpu/gpu_info_collector_linux.cc
@@ -192,7 +192,7 @@ uint32 VendorStringToID(const std::string& vendor_string) {
namespace gpu_info_collector {
-bool CollectGraphicsInfo(GPUInfo* gpu_info) {
+bool CollectGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
if (CommandLine::ForCurrentProcess()->HasSwitch(
@@ -209,7 +209,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) {
return CollectGraphicsInfoGL(gpu_info);
}
-bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) {
+bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
if (!gfx::GLSurface::InitializeOneOff()) {
@@ -232,7 +232,7 @@ bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) {
return rt;
}
-bool CollectVideoCardInfo(GPUInfo* gpu_info) {
+bool CollectVideoCardInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
std::string driver_vendor = CollectDriverVendorGlx();
@@ -332,7 +332,7 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) {
return (gpu_active != NULL);
}
-bool CollectDriverInfoGL(GPUInfo* gpu_info) {
+bool CollectDriverInfoGL(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
std::string gl_version_string = gpu_info->gl_version_string;
diff --git a/content/gpu/gpu_info_collector_mac.mm b/content/gpu/gpu_info_collector_mac.mm
index be6deb5..ace83a4 100644
--- a/content/gpu/gpu_info_collector_mac.mm
+++ b/content/gpu/gpu_info_collector_mac.mm
@@ -59,7 +59,7 @@ UInt32 IntValueOfCFData(CFDataRef data_ref) {
// If more than two cards are located, return false. In such rare situation,
// video card information should be collected through identifying the currently
// in-use card as in CollectVideoCardInfo().
-bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) {
+bool CollectPCIVideoCardInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
// match_dictionary will be consumed by IOServiceGetMatchingServices, no need
@@ -122,7 +122,7 @@ bool CollectPCIVideoCardInfo(GPUInfo* gpu_info) {
namespace gpu_info_collector {
-bool CollectGraphicsInfo(GPUInfo* gpu_info) {
+bool CollectGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
gpu_info->can_lose_context =
@@ -131,7 +131,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) {
return CollectGraphicsInfoGL(gpu_info);
}
-bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) {
+bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
bool rt = true;
@@ -141,7 +141,7 @@ bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) {
return rt;
}
-bool CollectVideoCardInfo(GPUInfo* gpu_info) {
+bool CollectVideoCardInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
UInt32 vendor_id = 0, device_id = 0;
@@ -162,7 +162,7 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) {
return true;
}
-bool CollectDriverInfoGL(GPUInfo* gpu_info) {
+bool CollectDriverInfoGL(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
// Extract the OpenGL driver version string from the GL_VERSION string.
diff --git a/content/gpu/gpu_info_collector_unittest.cc b/content/gpu/gpu_info_collector_unittest.cc
index 9287af2..eaca0f2 100644
--- a/content/gpu/gpu_info_collector_unittest.cc
+++ b/content/gpu/gpu_info_collector_unittest.cc
@@ -3,8 +3,8 @@
// found in the LICENSE file.
#include "base/memory/scoped_ptr.h"
-#include "content/common/gpu/gpu_info.h"
#include "content/gpu/gpu_info_collector.h"
+#include "content/public/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"
@@ -106,7 +106,7 @@ class GPUInfoCollectorTest : public testing::Test {
public:
// Use StrictMock to make 100% sure we know how GL will be called.
scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
- GPUInfo test_values_;
+ content::GPUInfo test_values_;
};
// TODO(rlp): Test the vendor and device id collection if deemed necessary as
@@ -115,7 +115,7 @@ class GPUInfoCollectorTest : public testing::Test {
// TODO(kbr): re-enable these tests; see http://crbug.com/100285 .
TEST_F(GPUInfoCollectorTest, DISABLED_DriverVendorGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.driver_vendor,
gpu_info.driver_vendor);
@@ -124,7 +124,7 @@ TEST_F(GPUInfoCollectorTest, DISABLED_DriverVendorGL) {
// Skip Windows because the driver version is obtained from bot registry.
#if !defined(OS_WIN)
TEST_F(GPUInfoCollectorTest, DISABLED_DriverVersionGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.driver_version,
gpu_info.driver_version);
@@ -132,49 +132,49 @@ TEST_F(GPUInfoCollectorTest, DISABLED_DriverVersionGL) {
#endif
TEST_F(GPUInfoCollectorTest, DISABLED_PixelShaderVersionGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.pixel_shader_version,
gpu_info.pixel_shader_version);
}
TEST_F(GPUInfoCollectorTest, DISABLED_VertexShaderVersionGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.vertex_shader_version,
gpu_info.vertex_shader_version);
}
TEST_F(GPUInfoCollectorTest, DISABLED_GLVersionGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.gl_version,
gpu_info.gl_version);
}
TEST_F(GPUInfoCollectorTest, DISABLED_GLVersionStringGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.gl_version_string,
gpu_info.gl_version_string);
}
TEST_F(GPUInfoCollectorTest, DISABLED_GLRendererGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.gl_renderer,
gpu_info.gl_renderer);
}
TEST_F(GPUInfoCollectorTest, DISABLED_GLVendorGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.gl_vendor,
gpu_info.gl_vendor);
}
TEST_F(GPUInfoCollectorTest, DISABLED_GLExtensionsGL) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
gpu_info_collector::CollectGraphicsInfoGL(&gpu_info);
EXPECT_EQ(test_values_.gl_extensions,
gpu_info.gl_extensions);
diff --git a/content/gpu/gpu_info_collector_unittest_win.cc b/content/gpu/gpu_info_collector_unittest_win.cc
index 8782f10..145b3a9 100644
--- a/content/gpu/gpu_info_collector_unittest_win.cc
+++ b/content/gpu/gpu_info_collector_unittest_win.cc
@@ -3,9 +3,9 @@
// found in the LICENSE file.
#include "base/memory/scoped_ptr.h"
-#include "content/common/gpu/gpu_info.h"
#include "content/gpu/gpu_idirect3d9_mock_win.h"
#include "content/gpu/gpu_info_collector.h"
+#include "content/public/common/gpu_info.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -45,13 +45,13 @@ class GPUInfoTest : public testing::Test {
};
TEST_F(GPUInfoTest, PixelShaderVersionD3D) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info));
EXPECT_EQ(gpu_info.pixel_shader_version, "3.0");
}
TEST_F(GPUInfoTest, VertexShaderVersionD3D) {
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info));
EXPECT_EQ(gpu_info.vertex_shader_version, "3.0");
}
diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc
index dfae814..94fd093 100644
--- a/content/gpu/gpu_info_collector_win.cc
+++ b/content/gpu/gpu_info_collector_win.cc
@@ -60,7 +60,7 @@ typedef BOOL (WINAPI*SetupDiDestroyDeviceInfoListFunc)(
namespace gpu_info_collector {
-bool CollectGraphicsInfo(GPUInfo* gpu_info) {
+bool CollectGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
@@ -98,7 +98,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) {
return true;
}
-bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) {
+bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
bool rt = true;
@@ -108,7 +108,7 @@ bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) {
return rt;
}
-bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) {
+bool CollectGraphicsInfoD3D(IDirect3D9* d3d, content::GPUInfo* gpu_info) {
DCHECK(d3d);
DCHECK(gpu_info);
@@ -143,7 +143,7 @@ bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) {
return true;
}
-bool CollectVideoCardInfo(GPUInfo* gpu_info) {
+bool CollectVideoCardInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
// Taken from http://developer.nvidia.com/object/device_ids.html
@@ -172,7 +172,8 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) {
return false;
}
-bool CollectDriverInfoD3D(const std::wstring& device_id, GPUInfo* gpu_info) {
+bool CollectDriverInfoD3D(const std::wstring& device_id,
+ content::GPUInfo* gpu_info) {
HMODULE lib_setupapi = LoadLibraryW(L"setupapi.dll");
if (!lib_setupapi) {
LOG(ERROR) << "Open setupapi.dll failed";
@@ -255,7 +256,7 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, GPUInfo* gpu_info) {
return found;
}
-bool CollectDriverInfoGL(GPUInfo* gpu_info) {
+bool CollectDriverInfoGL(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
std::string gl_version_string = gpu_info->gl_version_string;
diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h
index 16bec63..1e4f865 100644
--- a/content/public/common/content_client.h
+++ b/content/public/common/content_client.h
@@ -16,7 +16,6 @@
class CommandLine;
class GURL;
-struct GPUInfo;
struct PepperPluginInfo;
namespace IPC {
@@ -38,6 +37,7 @@ class ContentClient;
class ContentPluginClient;
class ContentRendererClient;
class ContentUtilityClient;
+struct GPUInfo;
// Setter and getter for the client. The client should be set early, before any
// content code is called.
@@ -73,7 +73,7 @@ class CONTENT_EXPORT ContentClient {
virtual void SetActiveURL(const GURL& url) = 0;
// Sets the data on the current gpu.
- virtual void SetGpuInfo(const GPUInfo& gpu_info) = 0;
+ virtual void SetGpuInfo(const content::GPUInfo& gpu_info) = 0;
// Gives the embedder a chance to register its own pepper plugins.
virtual void AddPepperPlugins(std::vector<PepperPluginInfo>* plugins) = 0;
diff --git a/content/common/dx_diag_node.cc b/content/public/common/dx_diag_node.cc
index 566cd4a..eb60e0a 100644
--- a/content/common/dx_diag_node.cc
+++ b/content/public/common/dx_diag_node.cc
@@ -2,8 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/dx_diag_node.h"
+#include "content/public/common/dx_diag_node.h"
+
+namespace content {
DxDiagNode::DxDiagNode() {}
DxDiagNode::~DxDiagNode() {}
+
+} // namespace content
diff --git a/content/common/dx_diag_node.h b/content/public/common/dx_diag_node.h
index 8e3f2e3..150d9bb 100644
--- a/content/common/dx_diag_node.h
+++ b/content/public/common/dx_diag_node.h
@@ -5,18 +5,21 @@
// A tree of name value pairs that report contain DirectX diagnostic
// information.
-#ifndef CONTENT_COMMON_DX_DIAG_NODE_H_
-#define CONTENT_COMMON_DX_DIAG_NODE_H_
+#ifndef CONTENT_PUBLIC_COMMON_DX_DIAG_NODE_H_
+#define CONTENT_PUBLIC_COMMON_DX_DIAG_NODE_H_
#include <map>
#include <string>
+namespace content {
+
struct DxDiagNode {
DxDiagNode();
~DxDiagNode();
-
std::map<std::string, std::string> values;
std::map<std::string, DxDiagNode> children;
};
-#endif // CONTENT_COMMON_DX_DIAG_NODE_H_
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_DX_DIAG_NODE_H_
diff --git a/content/public/common/gpu_info.cc b/content/public/common/gpu_info.cc
new file mode 100644
index 0000000..c1c996b
--- /dev/null
+++ b/content/public/common/gpu_info.cc
@@ -0,0 +1,18 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/common/gpu_info.h"
+
+namespace content {
+
+GPUInfo::GPUInfo()
+ : finalized(false),
+ vendor_id(0),
+ device_id(0),
+ can_lose_context(false) {
+}
+
+GPUInfo::~GPUInfo() { }
+
+} // namespace content
diff --git a/content/common/gpu/gpu_info.h b/content/public/common/gpu_info.h
index 46fbf90..9fd0d76 100644
--- a/content/common/gpu/gpu_info.h
+++ b/content/public/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 CONTENT_COMMON_GPU_GPU_INFO_H_
-#define CONTENT_COMMON_GPU_GPU_INFO_H_
+#ifndef CONTENT_PUBLIC_COMMON_GPU_INFO_H_
+#define CONTENT_PUBLIC_COMMON_GPU_INFO_H_
#pragma once
// Provides access to the GPU information for the system
@@ -14,21 +14,15 @@
#include "base/basictypes.h"
#include "base/time.h"
#include "build/build_config.h"
-#include "content/common/dx_diag_node.h"
#include "content/common/content_export.h"
+#include "content/public/common/dx_diag_node.h"
+
+namespace content {
struct CONTENT_EXPORT GPUInfo {
GPUInfo();
~GPUInfo();
- // If it's the same GPU, i.e., device id and vendor id are the same, then
- // copy over the fields that are not set yet and ignore the rest.
- // If it's a different GPU, then reset and copy over everything.
- // Return true if something changes that may affect blacklisting; currently
- // they are device_id, vendor_id, driver_vendor, driver_version, driver_date,
- // and gl_renderer.
- bool Merge(const GPUInfo& other);
-
// Whether more GPUInfo fields might be collected in the future.
bool finalized;
@@ -84,4 +78,6 @@ struct CONTENT_EXPORT GPUInfo {
#endif
};
-#endif // CONTENT_COMMON_GPU_GPU_INFO_H_
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_GPU_INFO_H_
diff --git a/content/renderer/gpu/gpu_channel_host.cc b/content/renderer/gpu/gpu_channel_host.cc
index cfd381e..d66c72a 100644
--- a/content/renderer/gpu/gpu_channel_host.cc
+++ b/content/renderer/gpu/gpu_channel_host.cc
@@ -154,11 +154,11 @@ void GpuChannelHost::Connect(
Send(new GpuChannelMsg_Initialize(renderer_process_for_gpu));
}
-void GpuChannelHost::set_gpu_info(const GPUInfo& gpu_info) {
+void GpuChannelHost::set_gpu_info(const content::GPUInfo& gpu_info) {
gpu_info_ = gpu_info;
}
-const GPUInfo& GpuChannelHost::gpu_info() const {
+const content::GPUInfo& GpuChannelHost::gpu_info() const {
return gpu_info_;
}
diff --git a/content/renderer/gpu/gpu_channel_host.h b/content/renderer/gpu/gpu_channel_host.h
index fcab257..f4a8e19 100644
--- a/content/renderer/gpu/gpu_channel_host.h
+++ b/content/renderer/gpu/gpu_channel_host.h
@@ -15,8 +15,8 @@
#include "base/memory/weak_ptr.h"
#include "base/process_util.h"
#include "base/synchronization/lock.h"
-#include "content/common/gpu/gpu_info.h"
#include "content/common/message_router.h"
+#include "content/public/common/gpu_info.h"
#include "content/renderer/gpu/gpu_video_decode_accelerator_host.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_channel_proxy.h"
@@ -67,8 +67,8 @@ class GpuChannelHost : public IPC::Message::Sender,
void SetStateLost();
// The GPU stats reported by the GPU process.
- void set_gpu_info(const GPUInfo& gpu_info);
- const GPUInfo& gpu_info() const;
+ void set_gpu_info(const content::GPUInfo& gpu_info);
+ const content::GPUInfo& gpu_info() const;
void OnChannelError();
@@ -172,7 +172,7 @@ class GpuChannelHost : public IPC::Message::Sender,
State state_;
- GPUInfo gpu_info_;
+ content::GPUInfo gpu_info_;
scoped_ptr<IPC::SyncChannel> channel_;
scoped_refptr<MessageFilter> channel_filter_;
diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
index cbd9d06..4200c4f 100644
--- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc
@@ -113,7 +113,7 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize(
}
} while (retry);
- const GPUInfo& gpu_info = host_->gpu_info();
+ const content::GPUInfo& gpu_info = host_->gpu_info();
UMA_HISTOGRAM_ENUMERATION(
"GPU.WebGraphicsContext3D_Init_CanLoseContext",
attributes.canRecoverFromContextLoss * 2 + gpu_info.can_lose_context,
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index ee9615a..ae93c3e 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -723,7 +723,7 @@ GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync(
// Ask the browser for the channel name.
IPC::ChannelHandle channel_handle;
base::ProcessHandle renderer_process_for_gpu;
- GPUInfo gpu_info;
+ content::GPUInfo gpu_info;
if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch,
&channel_handle,
&renderer_process_for_gpu,
diff --git a/content/test/test_content_client.cc b/content/test/test_content_client.cc
index 736be6c..82818cc 100644
--- a/content/test/test_content_client.cc
+++ b/content/test/test_content_client.cc
@@ -16,7 +16,7 @@ TestContentClient::~TestContentClient() {
void TestContentClient::SetActiveURL(const GURL& url) {
}
-void TestContentClient::SetGpuInfo(const GPUInfo& gpu_info) {
+void TestContentClient::SetGpuInfo(const content::GPUInfo& gpu_info) {
}
void TestContentClient::AddPepperPlugins(
diff --git a/content/test/test_content_client.h b/content/test/test_content_client.h
index 9244fe4..4423263 100644
--- a/content/test/test_content_client.h
+++ b/content/test/test_content_client.h
@@ -16,7 +16,7 @@ class TestContentClient : public content::ContentClient {
// content::ContentClient:
virtual void SetActiveURL(const GURL& url) OVERRIDE;
- virtual void SetGpuInfo(const GPUInfo& gpu_info) OVERRIDE;
+ virtual void SetGpuInfo(const content::GPUInfo& gpu_info) OVERRIDE;
virtual void AddPepperPlugins(
std::vector<PepperPluginInfo>* plugins) OVERRIDE;
virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE;