diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 22:37:07 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 22:37:07 +0000 |
commit | 6e3a70077033a4d37cb87bf521d5f99cc91921c8 (patch) | |
tree | b16ade911872e86f9e18378dacd0eb081494e13b /chrome/common | |
parent | 4ef777e8a4bebda665adb30c6631b4551e6b25b6 (diff) | |
download | chromium_src-6e3a70077033a4d37cb87bf521d5f99cc91921c8.zip chromium_src-6e3a70077033a4d37cb87bf521d5f99cc91921c8.tar.gz chromium_src-6e3a70077033a4d37cb87bf521d5f99cc91921c8.tar.bz2 |
Revert 72704 - Defered collect DirectX diagnostics until they are needed for about:gpu.
This is because collecting the stats often crashes.
Added a guard to prevent the collection of diagnostics on multiple threads simultaneously.
Renamed GPUInfo::Progress to GPUInfo::Level.
TEST=try, about:gpu does not cause concurrent diagnostics collection
BUG=none
Review URL: http://codereview.chromium.org/6364013
TBR=apatrick@chromium.org
Review URL: http://codereview.chromium.org/6370013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72707 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/gpu_info.cc | 10 | ||||
-rw-r--r-- | chrome/common/gpu_info.h | 9 | ||||
-rw-r--r-- | chrome/common/gpu_info_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/common/gpu_messages.cc | 28 | ||||
-rw-r--r-- | chrome/common/gpu_messages_internal.h | 4 | ||||
-rw-r--r-- | chrome/common/gpu_messages_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/common/gpu_param_traits.h | 8 |
7 files changed, 18 insertions, 47 deletions
diff --git a/chrome/common/gpu_info.cc b/chrome/common/gpu_info.cc index 8b47973..5a88e34 100644 --- a/chrome/common/gpu_info.cc +++ b/chrome/common/gpu_info.cc @@ -5,7 +5,7 @@ #include "chrome/common/gpu_info.h" GPUInfo::GPUInfo() - : level_(kUninitialized), + : progress_(kUninitialized), vendor_id_(0), device_id_(0), driver_vendor_(""), @@ -20,8 +20,8 @@ GPUInfo::GPUInfo() can_lose_context_(false) { } -GPUInfo::Level GPUInfo::level() const { - return level_; +GPUInfo::Progress GPUInfo::progress() const { + return progress_; } base::TimeDelta GPUInfo::initialization_time() const { @@ -76,8 +76,8 @@ bool GPUInfo::can_lose_context() const { return can_lose_context_; } -void GPUInfo::SetLevel(Level level) { - level_ = level; +void GPUInfo::SetProgress(Progress progress) { + progress_ = progress; } void GPUInfo::SetInitializationTime( diff --git a/chrome/common/gpu_info.h b/chrome/common/gpu_info.h index 3989c7a..95c2237 100644 --- a/chrome/common/gpu_info.h +++ b/chrome/common/gpu_info.h @@ -22,16 +22,15 @@ class GPUInfo { GPUInfo(); ~GPUInfo() {} - enum Level { + enum Progress { kUninitialized, kPartial, - kCompleting, kComplete, }; // Returns whether this GPUInfo has been partially or fully initialized with // information. - Level level() const; + Progress progress() const; // The amount of time taken to get from the process starting to the message // loop being pumped. @@ -88,7 +87,7 @@ class GPUInfo { // semantics are available. bool can_lose_context() const; - void SetLevel(Level level); + void SetProgress(Progress progress); void SetInitializationTime(const base::TimeDelta& initialization_time); @@ -120,7 +119,7 @@ class GPUInfo { #endif private: - Level level_; + Progress progress_; base::TimeDelta initialization_time_; uint32 vendor_id_; uint32 device_id_; diff --git a/chrome/common/gpu_info_unittest.cc b/chrome/common/gpu_info_unittest.cc index 34630e8..57227e8 100644 --- a/chrome/common/gpu_info_unittest.cc +++ b/chrome/common/gpu_info_unittest.cc @@ -8,7 +8,7 @@ // 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.progress(), GPUInfo::kUninitialized); EXPECT_EQ(gpu_info.initialization_time().ToInternalValue(), 0); EXPECT_EQ(gpu_info.vendor_id(), 0u); EXPECT_EQ(gpu_info.device_id(), 0u); diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc index 65a39d4..7f1f5c0 100644 --- a/chrome/common/gpu_messages.cc +++ b/chrome/common/gpu_messages.cc @@ -128,7 +128,7 @@ void ParamTraits<GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params> ::Log( #endif // if defined(OS_MACOSX) void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) { - WriteParam(m, static_cast<int32>(p.level())); + WriteParam(m, static_cast<int32>(p.progress())); WriteParam(m, p.initialization_time()); WriteParam(m, p.vendor_id()); WriteParam(m, p.device_id()); @@ -149,7 +149,7 @@ void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) { } bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { - int32 level; + int32 progress; base::TimeDelta initialization_time; uint32 vendor_id; uint32 device_id; @@ -163,7 +163,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { std::string gl_renderer; std::string gl_extensions; bool can_lose_context; - bool ret = ReadParam(m, iter, &level); + bool ret = ReadParam(m, iter, &progress); ret = ret && ReadParam(m, iter, &initialization_time); ret = ret && ReadParam(m, iter, &vendor_id); ret = ret && ReadParam(m, iter, &device_id); @@ -177,7 +177,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { ret = ret && ReadParam(m, iter, &gl_renderer); ret = ret && ReadParam(m, iter, &gl_extensions); ret = ret && ReadParam(m, iter, &can_lose_context); - p->SetLevel(static_cast<GPUInfo::Level>(level)); + p->SetProgress(static_cast<GPUInfo::Progress>(progress)); if (!ret) return false; @@ -205,7 +205,7 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { void ParamTraits<GPUInfo> ::Log(const param_type& p, std::string* l) { l->append(base::StringPrintf("<GPUInfo> %d %d %x %x %s %s %x %x %x %d", - p.level(), + p.progress(), static_cast<int32>( p.initialization_time().InMilliseconds()), p.vendor_id(), @@ -218,24 +218,6 @@ void ParamTraits<GPUInfo> ::Log(const param_type& p, std::string* l) { 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); diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h index 6a488c3..22da39a 100644 --- a/chrome/common/gpu_messages_internal.h +++ b/chrome/common/gpu_messages_internal.h @@ -6,7 +6,6 @@ #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" @@ -56,8 +55,7 @@ IPC_MESSAGE_CONTROL0(GpuMsg_Synchronize) // Tells the GPU process to create a context for collecting graphics card // information. -IPC_MESSAGE_CONTROL1(GpuMsg_CollectGraphicsInfo, - GPUInfo::Level /* level */) +IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo) #if defined(OS_MACOSX) // Tells the GPU process that the browser process handled the swap diff --git a/chrome/common/gpu_messages_unittest.cc b/chrome/common/gpu_messages_unittest.cc index 4e2da79..b3f2c34 100644 --- a/chrome/common/gpu_messages_unittest.cc +++ b/chrome/common/gpu_messages_unittest.cc @@ -13,7 +13,7 @@ TEST(GPUIPCMessageTest, GPUInfo) { GPUInfo input; // Test variables taken from HP Z600 Workstation - input.SetLevel(GPUInfo::kPartial); + input.SetProgress(GPUInfo::kPartial); input.SetInitializationTime(base::TimeDelta::FromMilliseconds(100)); input.SetVideoCardInfo(0x10de, 0x0658); input.SetDriverInfo("NVIDIA", "195.36.24"); @@ -31,7 +31,7 @@ TEST(GPUIPCMessageTest, GPUInfo) { GPUInfo output; void* iter = NULL; EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); - EXPECT_EQ(input.level(), output.level()); + EXPECT_EQ(input.progress(), output.progress()); EXPECT_EQ(input.initialization_time().InMilliseconds(), output.initialization_time().InMilliseconds()); EXPECT_EQ(input.vendor_id(), output.vendor_id()); diff --git a/chrome/common/gpu_param_traits.h b/chrome/common/gpu_param_traits.h index 4f13ab9..3ebaca0 100644 --- a/chrome/common/gpu_param_traits.h +++ b/chrome/common/gpu_param_traits.h @@ -72,14 +72,6 @@ struct ParamTraits<GPUInfo> { }; 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); |