diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-21 22:32:22 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-21 22:32:22 +0000 |
commit | 4e0ebbaad2c3d16e73f27a7e1380e91a9186e8cf (patch) | |
tree | 9535b539ad4e9a7aad0d7ac5d8b4ba5751b738a8 /chrome/browser/feedback | |
parent | f925d71d1666cd97eb6ff4a0b165a5c9f6521daf (diff) | |
download | chromium_src-4e0ebbaad2c3d16e73f27a7e1380e91a9186e8cf.zip chromium_src-4e0ebbaad2c3d16e73f27a7e1380e91a9186e8cf.tar.gz chromium_src-4e0ebbaad2c3d16e73f27a7e1380e91a9186e8cf.tar.bz2 |
Revert 248648 "Cache feedback reports to disk in case of send fa..."
BUG=345805
> Cache feedback reports to disk in case of send failure.
>
> R=zork@chromium.org
> BUG=249853
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=246992
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=247772
>
> Review URL: https://codereview.chromium.org/141433011
TBR=rkc@chromium.org
Review URL: https://codereview.chromium.org/174313005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252669 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/feedback')
-rw-r--r-- | chrome/browser/feedback/feedback_profile_observer.cc | 60 | ||||
-rw-r--r-- | chrome/browser/feedback/feedback_profile_observer.h | 50 | ||||
-rw-r--r-- | chrome/browser/feedback/feedback_report.h | 67 | ||||
-rw-r--r-- | chrome/browser/feedback/feedback_uploader.cc | 58 | ||||
-rw-r--r-- | chrome/browser/feedback/feedback_uploader.h | 21 | ||||
-rw-r--r-- | chrome/browser/feedback/feedback_uploader_delegate.cc | 6 | ||||
-rw-r--r-- | chrome/browser/feedback/feedback_uploader_delegate.h | 7 | ||||
-rw-r--r-- | chrome/browser/feedback/feedback_uploader_unittest.cc | 64 | ||||
-rw-r--r-- | chrome/browser/feedback/feedback_util.cc | 6 |
9 files changed, 80 insertions, 259 deletions
diff --git a/chrome/browser/feedback/feedback_profile_observer.cc b/chrome/browser/feedback/feedback_profile_observer.cc deleted file mode 100644 index 0ec0b73..0000000 --- a/chrome/browser/feedback/feedback_profile_observer.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/feedback/feedback_profile_observer.h" - -#include "base/callback.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/feedback/feedback_report.h" -#include "chrome/browser/feedback/feedback_uploader.h" -#include "chrome/browser/feedback/feedback_uploader_factory.h" -#include "chrome/browser/profiles/profile.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/notification_service.h" - -using content::BrowserThread; - -static base::LazyInstance<feedback::FeedbackProfileObserver>::Leaky - g_feedback_profile_observer = LAZY_INSTANCE_INITIALIZER; - -namespace feedback { - -// static -void FeedbackProfileObserver::Initialize() { - g_feedback_profile_observer.Get(); -} - -FeedbackProfileObserver::FeedbackProfileObserver() { - prefs_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, - content::NotificationService::AllSources()); -} - -FeedbackProfileObserver::~FeedbackProfileObserver() { - prefs_registrar_.RemoveAll(); -} - -void FeedbackProfileObserver::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CREATED, type); - - Profile* profile = content::Source<Profile>(source).ptr(); - if (!profile->IsOffTheRecord()) - QueueUnsentReports(profile); -} - -void FeedbackProfileObserver::QueueUnsentReports( - content::BrowserContext* context) { - feedback::FeedbackUploader* uploader = - feedback::FeedbackUploaderFactory::GetForBrowserContext(context); - BrowserThread::PostBlockingPoolTask(FROM_HERE, - base::Bind( - &FeedbackReport::LoadReportsAndQueue, context, base::Bind( - &FeedbackUploader::QueueReport, uploader->AsWeakPtr()))); -} - -} // namespace feedback diff --git a/chrome/browser/feedback/feedback_profile_observer.h b/chrome/browser/feedback/feedback_profile_observer.h deleted file mode 100644 index 4a48c99..0000000 --- a/chrome/browser/feedback/feedback_profile_observer.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ -#define CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ - -#include "base/basictypes.h" -#include "base/lazy_instance.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" - -namespace content { -class BrowserContext; -} - -namespace feedback { - -// FeedbackProfileObserver waits on profile creation notifications to check -// if the profile has any pending feedback reports to upload. If it does, it -// queues those reports for upload. -class FeedbackProfileObserver : public content::NotificationObserver { - public: - static void Initialize(); - - private: - friend struct base::DefaultLazyInstanceTraits<FeedbackProfileObserver>; - - FeedbackProfileObserver(); - virtual ~FeedbackProfileObserver(); - - // content::NotificationObserver override - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; - - // Loads any unsent reports from disk and queues them to be uploaded in - // the given browser context. - void QueueUnsentReports(content::BrowserContext* context); - - // Used to track creation of profiles so we can load any unsent reports - // for that profile. - content::NotificationRegistrar prefs_registrar_; - - DISALLOW_COPY_AND_ASSIGN(FeedbackProfileObserver); -}; - -} // namespace feedback - -#endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_PROFILE_OBSERVER_H_ diff --git a/chrome/browser/feedback/feedback_report.h b/chrome/browser/feedback/feedback_report.h deleted file mode 100644 index 2926451..0000000 --- a/chrome/browser/feedback/feedback_report.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_REPORT_H_ -#define CHROME_BROWSER_FEEDBACK_FEEDBACK_REPORT_H_ - -#include <string> - -#include "base/basictypes.h" -#include "base/callback_forward.h" -#include "base/files/file_path.h" -#include "base/memory/ref_counted.h" -#include "base/time/time.h" - -namespace base { -class SequencedTaskRunner; -} - -namespace content { -class BrowserContext; -} - -namespace feedback { - -typedef base::Callback<void(const std::string&)> QueueCallback; - -// This class holds a feedback report. Once a report is created, a disk backup -// for it is created automatically. This backup needs to explicitly be -// deleted by calling DeleteReportOnDisk. -class FeedbackReport : public base::RefCounted<FeedbackReport> { - public: - FeedbackReport(content::BrowserContext* context, - const base::Time& upload_at, - const std::string& data); - - // Stops the disk write of the report and deletes the report file if already - // written. - void DeleteReportOnDisk(); - - const base::Time& upload_at() const { return upload_at_; } - const std::string& data() const { return data_; } - - // Loads the reports still on disk and queues then using the given callback. - // This call blocks on the file reads. - static void LoadReportsAndQueue(content::BrowserContext* context, - QueueCallback callback); - - private: - friend class base::RefCounted<FeedbackReport>; - virtual ~FeedbackReport(); - - // Name of the file corresponding to this report. - base::FilePath file_; - - base::FilePath reports_path_; - base::Time upload_at_; // Upload this report at or after this time. - std::string data_; - - scoped_refptr<base::SequencedTaskRunner> reports_task_runner_; - - DISALLOW_COPY_AND_ASSIGN(FeedbackReport); -}; - -} // namespace feedback - -#endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_REPORT_H_ diff --git a/chrome/browser/feedback/feedback_uploader.cc b/chrome/browser/feedback/feedback_uploader.cc index 75b3a6a..36d5620 100644 --- a/chrome/browser/feedback/feedback_uploader.cc +++ b/chrome/browser/feedback/feedback_uploader.cc @@ -9,7 +9,6 @@ #include "base/files/file_path.h" #include "base/task_runner_util.h" #include "base/threading/sequenced_worker_pool.h" -#include "chrome/browser/feedback/feedback_report.h" #include "chrome/common/chrome_switches.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" @@ -30,9 +29,28 @@ const int64 kRetryDelayMinutes = 60; } // namespace +struct FeedbackReport { + FeedbackReport(const base::Time& upload_at, scoped_ptr<std::string> data) + : upload_at(upload_at), data(data.Pass()) {} + + FeedbackReport(const FeedbackReport& report) { + upload_at = report.upload_at; + data = report.data.Pass(); + } + + FeedbackReport& operator=(const FeedbackReport& report) { + upload_at = report.upload_at; + data = report.data.Pass(); + return *this; + } + + base::Time upload_at; // Upload this report at or after this time. + mutable scoped_ptr<std::string> data; +}; + bool FeedbackUploader::ReportsUploadTimeComparator::operator()( - FeedbackReport* a, FeedbackReport* b) const { - return a->upload_at() > b->upload_at(); + const FeedbackReport& a, const FeedbackReport& b) const { + return a.upload_at > b.upload_at; } FeedbackUploader::FeedbackUploader(content::BrowserContext* context) @@ -43,15 +61,15 @@ FeedbackUploader::FeedbackUploader(content::BrowserContext* context) AsWeakPtr()); } -FeedbackUploader::~FeedbackUploader() {} +FeedbackUploader::~FeedbackUploader() { +} -void FeedbackUploader::QueueReport(const std::string& data) { - reports_queue_.push( - new FeedbackReport(context_, base::Time::Now(), data)); +void FeedbackUploader::QueueReport(scoped_ptr<std::string> data) { + reports_queue_.push(FeedbackReport(base::Time::Now(), data.Pass())); UpdateUploadTimer(); } -void FeedbackUploader::DispatchReport(const std::string& data) { +void FeedbackUploader::DispatchReport(scoped_ptr<std::string> data) { GURL post_url; if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kFeedbackServer)) post_url = GURL(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( @@ -59,14 +77,17 @@ void FeedbackUploader::DispatchReport(const std::string& data) { else post_url = GURL(kFeedbackPostUrl); + // Save the report data pointer since the report.Pass() in the next statement + // will invalidate the scoper. + std::string* data_ptr = data.get(); net::URLFetcher* fetcher = net::URLFetcher::Create( post_url, net::URLFetcher::POST, new FeedbackUploaderDelegate( - data, + data.Pass(), base::Bind(&FeedbackUploader::UpdateUploadTimer, AsWeakPtr()), base::Bind(&FeedbackUploader::RetryReport, AsWeakPtr()))); - fetcher->SetUploadData(std::string(kProtBufMimeType), data); + fetcher->SetUploadData(std::string(kProtBufMimeType), *data_ptr); fetcher->SetRequestContext(context_->GetRequestContext()); fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES); @@ -77,26 +98,25 @@ void FeedbackUploader::UpdateUploadTimer() { if (reports_queue_.empty()) return; - scoped_refptr<FeedbackReport> report = reports_queue_.top(); + const FeedbackReport& report = reports_queue_.top(); base::Time now = base::Time::Now(); - if (report->upload_at() <= now) { + if (report.upload_at <= now) { + scoped_ptr<std::string> data = report.data.Pass(); reports_queue_.pop(); - dispatch_callback_.Run(report->data()); - report->DeleteReportOnDisk(); + dispatch_callback_.Run(data.Pass()); } else { // Stop the old timer and start an updated one. if (upload_timer_.IsRunning()) upload_timer_.Stop(); upload_timer_.Start( - FROM_HERE, report->upload_at() - now, this, + FROM_HERE, report.upload_at - now, this, &FeedbackUploader::UpdateUploadTimer); } } -void FeedbackUploader::RetryReport(const std::string& data) { - reports_queue_.push(new FeedbackReport(context_, - base::Time::Now() + retry_delay_, - data)); +void FeedbackUploader::RetryReport(scoped_ptr<std::string> data) { + reports_queue_.push( + FeedbackReport(base::Time::Now() + retry_delay_, data.Pass())); UpdateUploadTimer(); } diff --git a/chrome/browser/feedback/feedback_uploader.h b/chrome/browser/feedback/feedback_uploader.h index 9ddf3a0..5c31047 100644 --- a/chrome/browser/feedback/feedback_uploader.h +++ b/chrome/browser/feedback/feedback_uploader.h @@ -22,7 +22,7 @@ class BrowserContext; namespace feedback { -class FeedbackReport; +struct FeedbackReport; // FeedbackUploader is used to add a feedback report to the queue of reports // being uploaded. In case uploading a report fails, it is written to disk and @@ -33,27 +33,22 @@ class FeedbackUploader : public BrowserContextKeyedService, explicit FeedbackUploader(content::BrowserContext* context); virtual ~FeedbackUploader(); - // Queues a report for uploading. - void QueueReport(const std::string& data); + void QueueReport(scoped_ptr<std::string> data); private: friend class FeedbackUploaderTest; struct ReportsUploadTimeComparator { - bool operator()(FeedbackReport* a, FeedbackReport* b) const; + bool operator()(const FeedbackReport& a, const FeedbackReport& b) const; }; // Dispatches the report to be uploaded. - void DispatchReport(const std::string& data); - - // Loads any unsent reports from disk and queues them to be uploaded in - // the given browser context. - void QueueUnsentReports(content::BrowserContext* context); + void DispatchReport(scoped_ptr<std::string> data); // Update our timer for uploading the next report. void UpdateUploadTimer(); // Requeue this report with a delay. - void RetryReport(const std::string& data); + void RetryReport(scoped_ptr<std::string> data); void setup_for_test(const ReportDataCallback& dispatch_callback, const base::TimeDelta& retry_delay); @@ -64,10 +59,12 @@ class FeedbackUploader : public BrowserContextKeyedService, base::OneShotTimer<FeedbackUploader> upload_timer_; // Priority queue of reports prioritized by the time the report is supposed // to be uploaded at. - std::priority_queue<scoped_refptr<FeedbackReport>, - std::vector<scoped_refptr<FeedbackReport> >, + std::priority_queue<FeedbackReport, + std::vector<FeedbackReport>, ReportsUploadTimeComparator> reports_queue_; + std::vector<FeedbackReport> loaded_reports_; + ReportDataCallback dispatch_callback_; base::TimeDelta retry_delay_; diff --git a/chrome/browser/feedback/feedback_uploader_delegate.cc b/chrome/browser/feedback/feedback_uploader_delegate.cc index 28256dd..993d590 100644 --- a/chrome/browser/feedback/feedback_uploader_delegate.cc +++ b/chrome/browser/feedback/feedback_uploader_delegate.cc @@ -21,10 +21,10 @@ const int kHttpPostFailServerError = 500; } // namespace FeedbackUploaderDelegate::FeedbackUploaderDelegate( - const std::string& post_body, + scoped_ptr<std::string> post_body, const base::Closure& success_callback, const ReportDataCallback& error_callback) - : post_body_(post_body), + : post_body_(post_body.Pass()), success_callback_(success_callback), error_callback_(error_callback) { } @@ -52,7 +52,7 @@ void FeedbackUploaderDelegate::OnURLFetchComplete( } else { error_stream << "Unknown error: HTTP response code " << response_code; } - error_callback_.Run(post_body_); + error_callback_.Run(post_body_.Pass()); } LOG(WARNING) << "FEEDBACK: Submission to feedback server (" diff --git a/chrome/browser/feedback/feedback_uploader_delegate.h b/chrome/browser/feedback/feedback_uploader_delegate.h index b500104..5da18dd 100644 --- a/chrome/browser/feedback/feedback_uploader_delegate.h +++ b/chrome/browser/feedback/feedback_uploader_delegate.h @@ -9,18 +9,19 @@ #include "base/basictypes.h" #include "base/callback.h" +#include "base/memory/scoped_ptr.h" #include "net/url_request/url_fetcher_delegate.h" namespace feedback { -typedef base::Callback<void(const std::string&)> ReportDataCallback; +typedef base::Callback<void(scoped_ptr<std::string>)> ReportDataCallback; // FeedbackUploaderDelegate is a simple http uploader for a feedback report. On // succes or failure, it deletes itself, but on failure it also notifies the // error callback specified when constructing the class instance. class FeedbackUploaderDelegate : public net::URLFetcherDelegate { public: - FeedbackUploaderDelegate(const std::string& post_body, + FeedbackUploaderDelegate(scoped_ptr<std::string> post_body, const base::Closure& success_callback, const ReportDataCallback& error_callback); virtual ~FeedbackUploaderDelegate(); @@ -29,7 +30,7 @@ class FeedbackUploaderDelegate : public net::URLFetcherDelegate { // Overridden from net::URLFetcherDelegate. virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; - std::string post_body_; + scoped_ptr<std::string> post_body_; base::Closure success_callback_; ReportDataCallback error_callback_; diff --git a/chrome/browser/feedback/feedback_uploader_unittest.cc b/chrome/browser/feedback/feedback_uploader_unittest.cc index 605ce22..407a286 100644 --- a/chrome/browser/feedback/feedback_uploader_unittest.cc +++ b/chrome/browser/feedback/feedback_uploader_unittest.cc @@ -4,8 +4,6 @@ #include "chrome/browser/feedback/feedback_uploader.h" -#include <set> - #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -39,7 +37,6 @@ class FeedbackUploaderTest : public testing::Test { FeedbackUploaderTest() : ui_thread_(content::BrowserThread::UI, &message_loop_), profile_(new TestingProfile()), - dispatched_reports_count_(0), expected_reports_(0) { FeedbackUploaderFactory::GetInstance()->SetTestingFactory( profile_.get(), &CreateFeedbackUploaderService); @@ -57,38 +54,27 @@ class FeedbackUploaderTest : public testing::Test { } void QueueReport(const std::string& data) { - uploader_->QueueReport(data); + uploader_->QueueReport(make_scoped_ptr(new std::string(data))); } void ReportFailure(const std::string& data) { - uploader_->RetryReport(data); + uploader_->RetryReport(make_scoped_ptr(new std::string(data))); } - void MockDispatchReport(const std::string& report_data) { - if (ContainsKey(dispatched_reports_, report_data)) { - dispatched_reports_[report_data]++; - } else { - dispatched_reports_[report_data] = 1; - } - dispatched_reports_count_++; + void MockDispatchReport(scoped_ptr<std::string> report_data) { + dispatched_reports_.push_back(*report_data.get()); // Dispatch will always update the timer, whether successful or not, // simulate the same behavior. uploader_->UpdateUploadTimer(); - if (ProcessingComplete()) { + if (dispatched_reports_.size() >= expected_reports_) { if (run_loop_.get()) run_loop_->Quit(); } } - bool ProcessingComplete() { - return (dispatched_reports_count_ >= expected_reports_); - } - void RunMessageLoop() { - if (ProcessingComplete()) - return; run_loop_.reset(new base::RunLoop()); run_loop_->Run(); } @@ -100,18 +86,11 @@ class FeedbackUploaderTest : public testing::Test { FeedbackUploader* uploader_; - std::map<std::string, unsigned int> dispatched_reports_; - size_t dispatched_reports_count_; + std::vector<std::string> dispatched_reports_; size_t expected_reports_; }; -#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MACOSX) -#define MAYBE_QueueMultiple QueueMultiple -#else -// crbug.com/330547 -#define MAYBE_QueueMultiple DISABLED_QueueMultiple -#endif -TEST_F(FeedbackUploaderTest, MAYBE_QueueMultiple) { +TEST_F(FeedbackUploaderTest, QueueMultiple) { dispatched_reports_.clear(); QueueReport(kReportOne); QueueReport(kReportTwo); @@ -119,21 +98,20 @@ TEST_F(FeedbackUploaderTest, MAYBE_QueueMultiple) { QueueReport(kReportFour); EXPECT_EQ(dispatched_reports_.size(), 4u); - EXPECT_EQ(dispatched_reports_[kReportOne], 1u); - EXPECT_EQ(dispatched_reports_[kReportTwo], 1u); - EXPECT_EQ(dispatched_reports_[kReportThree], 1u); - EXPECT_EQ(dispatched_reports_[kReportFour], 1u); + EXPECT_EQ(dispatched_reports_[0], kReportOne); + EXPECT_EQ(dispatched_reports_[1], kReportTwo); + EXPECT_EQ(dispatched_reports_[2], kReportThree); + EXPECT_EQ(dispatched_reports_[3], kReportFour); } -#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MACOSX) -#define MAYBE_QueueMultipleWithFailures QueueMultipleWithFailures -#else +#if defined(OS_WIN) // crbug.com/330547 #define MAYBE_QueueMultipleWithFailures DISABLED_QueueMultipleWithFailures +#else +#define MAYBE_QueueMultipleWithFailures QueueMultipleWithFailures #endif TEST_F(FeedbackUploaderTest, MAYBE_QueueMultipleWithFailures) { dispatched_reports_.clear(); - QueueReport(kReportOne); QueueReport(kReportTwo); QueueReport(kReportThree); @@ -146,12 +124,14 @@ TEST_F(FeedbackUploaderTest, MAYBE_QueueMultipleWithFailures) { expected_reports_ = 7; RunMessageLoop(); - EXPECT_EQ(dispatched_reports_.size(), 5u); - EXPECT_EQ(dispatched_reports_[kReportOne], 1u); - EXPECT_EQ(dispatched_reports_[kReportTwo], 2u); - EXPECT_EQ(dispatched_reports_[kReportThree], 2u); - EXPECT_EQ(dispatched_reports_[kReportFour], 1u); - EXPECT_EQ(dispatched_reports_[kReportFive], 1u); + EXPECT_EQ(dispatched_reports_.size(), 7u); + EXPECT_EQ(dispatched_reports_[0], kReportOne); + EXPECT_EQ(dispatched_reports_[1], kReportTwo); + EXPECT_EQ(dispatched_reports_[2], kReportThree); + EXPECT_EQ(dispatched_reports_[3], kReportFour); + EXPECT_EQ(dispatched_reports_[4], kReportFive); + EXPECT_EQ(dispatched_reports_[5], kReportThree); + EXPECT_EQ(dispatched_reports_[6], kReportTwo); } } // namespace feedback diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc index 33eabe4..4b33f64 100644 --- a/chrome/browser/feedback/feedback_util.cc +++ b/chrome/browser/feedback/feedback_util.cc @@ -238,12 +238,12 @@ void SendReport(scoped_refptr<FeedbackData> data) { // This pointer will eventually get deleted by the PostCleanup class, after // we've either managed to successfully upload the report or died trying. - std::string post_body; - feedback_data.SerializeToString(&post_body); + scoped_ptr<std::string> post_body(new std::string); + feedback_data.SerializeToString(post_body.get()); feedback::FeedbackUploader *uploader = feedback::FeedbackUploaderFactory::GetForBrowserContext(data->profile()); - uploader->QueueReport(post_body); + uploader->QueueReport(post_body.Pass()); } bool ZipString(const base::FilePath& filename, |