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

Unified Diff: chrome/browser/chromeos/system/timezone_settings.cc

Issue 7904012: Make file IO occur on the right thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 9 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/system/timezone_settings.cc
diff --git a/chrome/browser/chromeos/system/timezone_settings.cc b/chrome/browser/chromeos/system/timezone_settings.cc
index 03703a98fee07b975b5d8e7a1b35e4fbaf98ef5e..81aa03db1e3e017ca1a35d8ae48ce94e60b0b152 100644
--- a/chrome/browser/chromeos/system/timezone_settings.cc
+++ b/chrome/browser/chromeos/system/timezone_settings.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/chromeos/system/timezone_settings.h"
+#include "base/bind.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
@@ -12,6 +13,7 @@
#include "base/memory/singleton.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "content/browser/browser_thread.h"
namespace chromeos {
namespace system {
@@ -120,7 +122,12 @@ void TimezoneSettingsImpl::SetTimezone(const icu::TimeZone& timezone) {
std::string id;
UTF16ToUTF8(unicode.getBuffer(), unicode.length(), &id);
VLOG(1) << "Setting timezone to " << id;
- SetTimezoneIDFromString(id);
+ // Change the timezone config files on the FILE thread. It's safe to do this
+ // in the background as the following operations don't depend on the
+ // completion of the config change.
+ BrowserThread::PostTask(BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&SetTimezoneIDFromString, id));
icu::TimeZone::setDefault(timezone);
FOR_EACH_OBSERVER(Observer, observers_, TimezoneChanged(timezone));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698