From cf3aef70329cd30fe6e9a85efa404ba5c4750076 Mon Sep 17 00:00:00 2001 From: "ivankr@chromium.org" Date: Fri, 16 Nov 2012 11:16:39 +0000 Subject: [cros,rlz] Financial ping livelock fix and proper shutdown. *) Fix the livelock on RLZ thread in FinancialPing *) RlzValueStore on chromeos destroys JsonPrefStore on proper thread. BUG=157348 Review URL: https://chromiumcodereview.appspot.com/11275284 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168187 0039d316-1c4b-4281-b951-d872f2087c98 --- rlz/lib/financial_ping.cc | 3 ++- rlz/lib/rlz_lib.cc | 4 ++++ rlz/lib/rlz_lib.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'rlz/lib') diff --git a/rlz/lib/financial_ping.cc b/rlz/lib/financial_ping.cc index 9b7e319..9abbd80 100644 --- a/rlz/lib/financial_ping.cc +++ b/rlz/lib/financial_ping.cc @@ -297,10 +297,11 @@ bool FinancialPing::PingServer(const char* request, std::string* response) { fetcher->SetRequestContext(g_context); const base::TimeDelta kTimeout = base::TimeDelta::FromMinutes(5); + MessageLoop::ScopedNestableTaskAllower allow_nested(MessageLoop::current()); MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&net::URLFetcher::Start, base::Unretained(fetcher.get()))); - MessageLoop::current()->PostNonNestableDelayedTask( + MessageLoop::current()->PostDelayedTask( FROM_HERE, loop.QuitClosure(), kTimeout); loop.Run(); diff --git a/rlz/lib/rlz_lib.cc b/rlz/lib/rlz_lib.cc index 0f67cd4..a820d27 100644 --- a/rlz/lib/rlz_lib.cc +++ b/rlz/lib/rlz_lib.cc @@ -222,6 +222,10 @@ bool SetURLRequestContext(net::URLRequestContextGetter* context) { void RLZ_LIB_API SetIOTaskRunner(base::SequencedTaskRunner* io_task_runner) { RlzValueStoreChromeOS::SetIOTaskRunner(io_task_runner); } + +void RLZ_LIB_API CleanupRlz() { + RlzValueStoreChromeOS::Cleanup(); +} #endif bool GetProductEventsAsCgi(Product product, char* cgi, size_t cgi_size) { diff --git a/rlz/lib/rlz_lib.h b/rlz/lib/rlz_lib.h index a840741..956fc9e 100644 --- a/rlz/lib/rlz_lib.h +++ b/rlz/lib/rlz_lib.h @@ -81,6 +81,9 @@ bool RLZ_LIB_API SetURLRequestContext(net::URLRequestContextGetter* context); // Set the MessageLoopProxy used by RLZ store to run I/O tasks on. Should be // called before any other API calls. void RLZ_LIB_API SetIOTaskRunner(base::SequencedTaskRunner* io_task_runner); + +// Must be invoked during shutdown to finish any remaining tasks. +void RLZ_LIB_API CleanupRlz(); #endif // RLZ storage functions. -- cgit v1.1