Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Unified Diff: chrome/browser/ui/webui/gpu_internals_ui.cc

Issue 10154004: re-use WebUIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WeakPtr solution Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler.cc ('k') | chrome/browser/ui/webui/help/help_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/gpu_internals_ui.cc
diff --git a/chrome/browser/ui/webui/gpu_internals_ui.cc b/chrome/browser/ui/webui/gpu_internals_ui.cc
index 78b5b565897beac04b45dcf9f74ed56af3cd2705..e05ffda6871571f02dee30708f4bd54f54739863 100644
--- a/chrome/browser/ui/webui/gpu_internals_ui.cc
+++ b/chrome/browser/ui/webui/gpu_internals_ui.cc
@@ -90,6 +90,10 @@ class GpuMessageHandler
scoped_refptr<CrashUploadList> crash_list_;
bool crash_list_available_;
+ // True if observing the GpuDataManager (re-attaching as observer would
+ // DCHECK).
+ bool observing_;
+
DISALLOW_COPY_AND_ASSIGN(GpuMessageHandler);
};
@@ -100,7 +104,8 @@ class GpuMessageHandler
////////////////////////////////////////////////////////////////////////////////
GpuMessageHandler::GpuMessageHandler()
- : crash_list_available_(false) {
+ : crash_list_available_(false),
+ observing_(false) {
crash_list_ = CrashUploadList::Create(this);
}
@@ -176,7 +181,9 @@ void GpuMessageHandler::OnBrowserBridgeInitialized(const ListValue* args) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Watch for changes in GPUInfo
- GpuDataManager::GetInstance()->AddObserver(this);
+ if (!observing_)
+ GpuDataManager::GetInstance()->AddObserver(this);
+ observing_ = true;
// Tell GpuDataManager it should have full GpuInfo. If the
// Gpu process has not run yet, this will trigger its launch.
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler.cc ('k') | chrome/browser/ui/webui/help/help_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698