diff options
-rw-r--r-- | rlz/chromeos/lib/rlz_value_store_chromeos.cc | 7 | ||||
-rw-r--r-- | rlz/chromeos/lib/rlz_value_store_chromeos.h | 6 | ||||
-rw-r--r-- | rlz/lib/financial_ping.cc | 3 | ||||
-rw-r--r-- | rlz/lib/rlz_lib.cc | 4 | ||||
-rw-r--r-- | rlz/lib/rlz_lib.h | 3 |
5 files changed, 19 insertions, 4 deletions
diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.cc b/rlz/chromeos/lib/rlz_value_store_chromeos.cc index 2f75887..ddf73e7 100644 --- a/rlz/chromeos/lib/rlz_value_store_chromeos.cc +++ b/rlz/chromeos/lib/rlz_value_store_chromeos.cc @@ -90,6 +90,12 @@ void RlzValueStoreChromeOS::ResetForTesting() { GetInstance()->ReadPrefs(); } +// static +void RlzValueStoreChromeOS::Cleanup() { + if (created_) + GetInstance()->rlz_store_ = NULL; +} + RlzValueStoreChromeOS::RlzValueStoreChromeOS() { ReadPrefs(); created_ = true; @@ -263,7 +269,6 @@ bool RlzValueStoreChromeOS::RemoveValueFromList(std::string list_name, ScopedRlzValueStoreLock::ScopedRlzValueStoreLock() : store_(RlzValueStoreChromeOS::GetInstance()) { - DCHECK(store_->CalledOnValidThread()); } ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() { diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.h b/rlz/chromeos/lib/rlz_value_store_chromeos.h index 245ae00..c9456a8 100644 --- a/rlz/chromeos/lib/rlz_value_store_chromeos.h +++ b/rlz/chromeos/lib/rlz_value_store_chromeos.h @@ -22,8 +22,7 @@ namespace rlz_lib { // An implementation of RlzValueStore for ChromeOS. Unlike Mac and Win // counterparts, it's non thread-safe and should only be accessed on a single // Thread instance that has a MessageLoop. -class RlzValueStoreChromeOS : public RlzValueStore, - public base::NonThreadSafe { +class RlzValueStoreChromeOS : public RlzValueStore { public: static RlzValueStoreChromeOS* GetInstance(); @@ -31,6 +30,9 @@ class RlzValueStoreChromeOS : public RlzValueStore, // tasks to. Must be called before the first GetInstance() call. static void SetIOTaskRunner(base::SequencedTaskRunner* io_task_runner); + // Must be invoked during shutdown to commit pending I/O. + static void Cleanup(); + // Resets the store to its initial state. Should only be used for testing. // Same restrictions as for calling GetInstance() for the first time apply, // i.e. must call SetIOTaskRunner first. 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. |