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

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

Issue 9706037: Display crash report IDs in about:gpu (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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/resources/gpu_internals/info_view.js ('k') | no next file » | 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
===================================================================
--- chrome/browser/ui/webui/gpu_internals_ui.cc (revision 126529)
+++ chrome/browser/ui/webui/gpu_internals_ui.cc (working copy)
@@ -9,14 +9,17 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
+#include "base/i18n/time_formatting.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "base/sys_info.h"
#include "base/values.h"
+#include "chrome/browser/crash_upload_list.h"
#include "chrome/browser/gpu_blacklist.h"
#include "chrome/browser/gpu_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
+#include "chrome/browser/ui/webui/crashes_ui.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -53,7 +56,8 @@
class GpuMessageHandler
: public WebUIMessageHandler,
public base::SupportsWeakPtr<GpuMessageHandler>,
- public content::GpuDataManagerObserver {
+ public content::GpuDataManagerObserver,
+ public CrashUploadList::Delegate {
public:
GpuMessageHandler();
virtual ~GpuMessageHandler();
@@ -64,6 +68,9 @@
// GpuDataManagerObserver implementation.
virtual void OnGpuInfoUpdate() OVERRIDE;
+ // CrashUploadList::Delegate implemenation.
+ virtual void OnCrashListAvailable() OVERRIDE;
+
// Messages
void OnBrowserBridgeInitialized(const ListValue* list);
void OnCallAsync(const ListValue* list);
@@ -71,6 +78,7 @@
// Submessages dispatched from OnCallAsync
Value* OnRequestClientInfo(const ListValue* list);
Value* OnRequestLogMessages(const ListValue* list);
+ Value* OnRequestCrashList(const ListValue* list);
// Executes the javascript function |function_name| in the renderer, passing
// it the argument |value|.
@@ -78,6 +86,9 @@
const Value* value);
private:
+ scoped_refptr<CrashUploadList> crash_list_;
+ bool crash_list_available_;
+
DISALLOW_COPY_AND_ASSIGN(GpuMessageHandler);
};
@@ -87,17 +98,22 @@
//
////////////////////////////////////////////////////////////////////////////////
-GpuMessageHandler::GpuMessageHandler() {
+GpuMessageHandler::GpuMessageHandler()
+ : crash_list_available_(false) {
+ crash_list_ = CrashUploadList::Create(this);
}
GpuMessageHandler::~GpuMessageHandler() {
GpuDataManager::GetInstance()->RemoveObserver(this);
+ crash_list_->ClearDelegate();
}
/* BrowserBridge.callAsync prepends a requestID to these messages. */
void GpuMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ crash_list_->LoadCrashListAsynchronously();
+
web_ui()->RegisterMessageCallback("browserBridgeInitialized",
base::Bind(&GpuMessageHandler::OnBrowserBridgeInitialized,
base::Unretained(this)));
@@ -134,6 +150,8 @@
ret = OnRequestClientInfo(submessageArgs);
} else if (submessage == "requestLogMessages") {
ret = OnRequestLogMessages(submessageArgs);
+ } else if (submessage == "requestCrashList") {
+ ret = OnRequestCrashList(submessageArgs);
} else { // unrecognized submessage
NOTREACHED();
delete submessageArgs;
@@ -214,6 +232,33 @@
return GpuDataManager::GetInstance()->GetLogMessages().DeepCopy();
}
+Value* GpuMessageHandler::OnRequestCrashList(const ListValue*) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (!CrashesUI::CrashReportingEnabled()) {
+ // We need to return an empty list instead of NULL.
+ return new ListValue;
+ }
+ if (!crash_list_available_) {
+ // If we are still obtaining crash list, then return null so another
+ // request will be scheduled.
+ return NULL;
+ }
+
+ ListValue* list_value = new ListValue;
+ std::vector<CrashUploadList::CrashInfo> crashes;
+ crash_list_->GetUploadedCrashes(50, &crashes);
+ for (std::vector<CrashUploadList::CrashInfo>::iterator i = crashes.begin();
+ i != crashes.end(); ++i) {
+ DictionaryValue* crash = new DictionaryValue();
+ crash->SetString("id", i->crash_id);
+ crash->SetString("time",
+ base::TimeFormatFriendlyDateAndTime(i->crash_time));
+ list_value->Append(crash);
+ }
+ return list_value;
+}
+
void GpuMessageHandler::OnGpuInfoUpdate() {
// Get GPU Info.
scoped_ptr<base::DictionaryValue> gpu_info_val(
@@ -229,6 +274,10 @@
*(gpu_info_val.get()));
}
+void GpuMessageHandler::OnCrashListAvailable() {
+ crash_list_available_ = true;
+}
+
} // namespace
« no previous file with comments | « chrome/browser/resources/gpu_internals/info_view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698