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

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

Issue 7562001: Add memory usage info to SyslogsProvider, and clean up bug report screenshot data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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
Index: chrome/browser/ui/webui/bug_report_ui.cc
diff --git a/chrome/browser/ui/webui/bug_report_ui.cc b/chrome/browser/ui/webui/bug_report_ui.cc
index 2e90b3144c362674a16ebc6866bae7c5d2fceeaa..58cfa2444b148322c2cc4db55fd8b1be6ea0a666 100644
--- a/chrome/browser/ui/webui/bug_report_ui.cc
+++ b/chrome/browser/ui/webui/bug_report_ui.cc
@@ -127,20 +127,6 @@ int GetIndexOfFeedbackTab(Browser* browser) {
namespace browser {
-// TODO(rkc): Eventually find a better way to do this
-std::vector<unsigned char>* last_screenshot_png = 0;
-gfx::Rect screen_size;
stevenjb 2011/08/03 01:55:20 Eliminated global variables (including a non basic
-
-void RefreshLastScreenshot(Browser* browser) {
- if (last_screenshot_png)
- last_screenshot_png->clear();
- else
- last_screenshot_png = new std::vector<unsigned char>;
-
- gfx::NativeWindow native_window = browser->window()->GetNativeHandle();
- screen_size = browser::GrabWindowSnapshot(native_window, last_screenshot_png);
-}
-
void ShowHtmlBugReportView(Browser* browser,
const std::string& description_template,
size_t issue_type) {
@@ -155,7 +141,14 @@ void ShowHtmlBugReportView(Browser* browser,
return;
}
- RefreshLastScreenshot(browser);
+ std::vector<unsigned char>* last_screenshot_png =
+ BugReportUtil::GetScreenshotPng();
+ last_screenshot_png->clear();
+
+ gfx::NativeWindow native_window = browser->window()->GetNativeHandle();
+ BugReportUtil::SetScreenshotSize(
+ browser::GrabWindowSnapshot(native_window, last_screenshot_png));
+
std::string bug_report_url = std::string(chrome::kChromeUIBugReportURL) +
"#" + base::IntToString(browser->active_index()) +
"?description=" + EscapeUrlEncodedData(description_template, false) +
@@ -386,55 +379,6 @@ void BugReportUIHTMLSource::StartDataRequest(const std::string& path,
////////////////////////////////////////////////////////////////////////////////
//
-// BugReportData
-//
-////////////////////////////////////////////////////////////////////////////////
-void BugReportData::SendReport() {
stevenjb 2011/08/03 01:55:20 BugReportData member function moved to its proper
-#if defined(OS_CHROMEOS)
- // In case we already got the syslogs and sent the report, leave
- if (sent_report_) return;
- // Set send_report_ so that no one else processes SendReport
- sent_report_ = true;
-#endif
-
- int image_data_size = image_.size();
- char* image_data = image_data_size ?
- reinterpret_cast<char*>(&(image_.front())) : NULL;
- BugReportUtil::SendReport(profile_
- , problem_type_
- , page_url_
- , description_
- , image_data
- , image_data_size
- , browser::screen_size.width()
- , browser::screen_size.height()
-#if defined(OS_CHROMEOS)
- , user_email_
- , zip_content_ ? zip_content_->c_str() : NULL
- , zip_content_ ? zip_content_->length() : 0
- , send_sys_info_ ? sys_info_ : NULL
-#endif
- );
-
-#if defined(OS_CHROMEOS)
- if (sys_info_) {
- delete sys_info_;
- sys_info_ = NULL;
- }
- if (zip_content_) {
- delete zip_content_;
- zip_content_ = NULL;
- }
-#endif
-
- // Once the report has been sent, this object has no purpose in life, delete
- // ourselves.
- delete this;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-//
// BugReportHandler
//
////////////////////////////////////////////////////////////////////////////////
@@ -465,15 +409,15 @@ void BugReportHandler::ClobberScreenshotsSource() {
profile->GetChromeURLDataManager()->AddDataSource(new ScreenshotSource(NULL));
// clobber last screenshot
- if (browser::last_screenshot_png)
- browser::last_screenshot_png->clear();
+ BugReportUtil::GetScreenshotPng()->clear();
}
void BugReportHandler::SetupScreenshotsSource() {
// If we don't already have a screenshot source object created, create one.
- if (!screenshot_source_)
- screenshot_source_ = new ScreenshotSource(browser::last_screenshot_png);
-
+ if (!screenshot_source_) {
+ screenshot_source_ =
+ new ScreenshotSource(BugReportUtil::GetScreenshotPng());
+ }
// Add the source to the data manager.
Profile* profile = Profile::FromBrowserContext(tab_->browser_context());
profile->GetChromeURLDataManager()->AddDataSource(screenshot_source_);
@@ -546,6 +490,7 @@ void BugReportHandler::RegisterMessages() {
}
void BugReportHandler::HandleGetDialogDefaults(const ListValue*) {
+ // Will delete itself when bug_report_->SendReport() is called.
bug_report_ = new BugReportData();
// send back values which the dialog js needs initially

Powered by Google App Engine
This is Rietveld 408576698