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

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

Issue 8390018: Change GpuDataManager to use Observer notifications rather than callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Review fixes Created 9 years, 2 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 | « no previous file | chrome/browser/ui/webui/gpu_internals_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/flash_ui.cc
===================================================================
--- chrome/browser/ui/webui/flash_ui.cc (revision 107010)
+++ chrome/browser/ui/webui/flash_ui.cc (working copy)
@@ -10,7 +10,6 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/callback_old.h"
#include "base/i18n/time_formatting.h"
#include "base/memory/weak_ptr.h"
#include "base/string_number_conversions.h"
@@ -66,10 +65,11 @@
// The handler for JavaScript messages for the about:flags page.
class FlashDOMHandler : public WebUIMessageHandler,
- public CrashUploadList::Delegate {
+ public CrashUploadList::Delegate,
+ public GpuDataManager::Observer {
public:
FlashDOMHandler();
- virtual ~FlashDOMHandler() {}
+ virtual ~FlashDOMHandler();
// WebUIMessageHandler implementation.
virtual void RegisterMessages() OVERRIDE;
@@ -77,12 +77,12 @@
// CrashUploadList::Delegate implementation.
virtual void OnCrashListAvailable() OVERRIDE;
+ // GpuDataManager::Observer implementation.
+ virtual void OnGpuInfoUpdate() OVERRIDE;
+
// Callback for the "requestFlashInfo" message.
void HandleRequestFlashInfo(const ListValue* args);
- // Callback for the GPU information update.
- void OnGpuInfoUpdate();
-
// Callback for the Flash plugin information.
void OnGotPlugins(const std::vector<webkit::WebPluginInfo>& plugins);
@@ -103,7 +103,6 @@
// GPU variables.
GpuDataManager* gpu_data_manager_;
- Callback0::Type* gpu_info_update_callback_;
// Crash list.
scoped_refptr<CrashUploadList> upload_list_;
@@ -135,9 +134,7 @@
// Watch for changes in GPUInfo.
gpu_data_manager_ = GpuDataManager::GetInstance();
- gpu_info_update_callback_ =
- NewCallback(this, &FlashDOMHandler::OnGpuInfoUpdate);
- gpu_data_manager_->AddGpuInfoUpdateCallback(gpu_info_update_callback_);
+ gpu_data_manager_->AddObserver(this);
// Tell GpuDataManager it should have full GpuInfo. If the
// GPU process has not run yet, this will trigger its launch.
@@ -157,6 +154,10 @@
this, &FlashDOMHandler::OnTimeout);
}
+FlashDOMHandler::~FlashDOMHandler() {
+ gpu_data_manager_->RemoveObserver(this);
+}
+
void FlashDOMHandler::RegisterMessages() {
web_ui_->RegisterMessageCallback("requestFlashInfo",
base::Bind(&FlashDOMHandler::HandleRequestFlashInfo,
« no previous file with comments | « no previous file | chrome/browser/ui/webui/gpu_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698