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

Side by Side Diff: chromeos/settings/timezone_settings.cc

Issue 2854953005: Use constexpr TaskTraits constructor in chromeos. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « chromeos/network/client_cert_resolver.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/settings/timezone_settings.h" 5 #include "chromeos/settings/timezone_settings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // go on with |timezone|. 384 // go on with |timezone|.
385 const icu::TimeZone* known_timezone = GetKnownTimezoneOrNull(timezone); 385 const icu::TimeZone* known_timezone = GetKnownTimezoneOrNull(timezone);
386 if (!known_timezone) 386 if (!known_timezone)
387 known_timezone = &timezone; 387 known_timezone = &timezone;
388 388
389 timezone_.reset(known_timezone->clone()); 389 timezone_.reset(known_timezone->clone());
390 std::string id = base::UTF16ToUTF8(GetTimezoneID(*known_timezone)); 390 std::string id = base::UTF16ToUTF8(GetTimezoneID(*known_timezone));
391 VLOG(1) << "Setting timezone to " << id; 391 VLOG(1) << "Setting timezone to " << id;
392 // It's safe to change the timezone config files in the background as the 392 // It's safe to change the timezone config files in the background as the
393 // following operations don't depend on the completion of the config change. 393 // following operations don't depend on the completion of the config change.
394 base::PostTaskWithTraits( 394 base::PostTaskWithTraits(FROM_HERE,
395 FROM_HERE, base::TaskTraits() 395 {base::MayBlock(), base::TaskPriority::BACKGROUND,
396 .WithShutdownBehavior( 396 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
397 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) 397 base::Bind(&SetTimezoneIDFromString, id));
398 .WithPriority(base::TaskPriority::BACKGROUND)
399 .MayBlock(),
400 base::Bind(&SetTimezoneIDFromString, id));
401 icu::TimeZone::setDefault(*known_timezone); 398 icu::TimeZone::setDefault(*known_timezone);
402 for (auto& observer : observers_) 399 for (auto& observer : observers_)
403 observer.TimezoneChanged(*known_timezone); 400 observer.TimezoneChanged(*known_timezone);
404 } 401 }
405 402
406 // static 403 // static
407 TimezoneSettingsImpl* TimezoneSettingsImpl::GetInstance() { 404 TimezoneSettingsImpl* TimezoneSettingsImpl::GetInstance() {
408 return base::Singleton< 405 return base::Singleton<
409 TimezoneSettingsImpl, 406 TimezoneSettingsImpl,
410 base::DefaultSingletonTraits<TimezoneSettingsImpl>>::get(); 407 base::DefaultSingletonTraits<TimezoneSettingsImpl>>::get();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 } 479 }
483 480
484 // static 481 // static
485 base::string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) { 482 base::string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) {
486 icu::UnicodeString id; 483 icu::UnicodeString id;
487 return base::i18n::UnicodeStringToString16(timezone.getID(id)); 484 return base::i18n::UnicodeStringToString16(timezone.getID(id));
488 } 485 }
489 486
490 } // namespace system 487 } // namespace system
491 } // namespace chromeos 488 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/client_cert_resolver.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698