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

Side by Side Diff: third_party/WebKit/Source/platform/DateComponents.cpp

Issue 2849903002: Replace ASSERT_NOT_REACHED with NOTREACHED in platform/ (Closed)
Patch Set: rebase 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 return DateToDaysFrom1970(year_, month_, 1) * kMsPerDay; 657 return DateToDaysFrom1970(year_, month_, 1) * kMsPerDay;
658 case kTime: 658 case kTime:
659 return MillisecondsSinceEpochForTime(); 659 return MillisecondsSinceEpochForTime();
660 case kWeek: 660 case kWeek:
661 return (DateToDaysFrom1970(year_, 0, 1) + OffsetTo1stWeekStart(year_) + 661 return (DateToDaysFrom1970(year_, 0, 1) + OffsetTo1stWeekStart(year_) +
662 (week_ - 1) * 7) * 662 (week_ - 1) * 7) *
663 kMsPerDay; 663 kMsPerDay;
664 case kInvalid: 664 case kInvalid:
665 break; 665 break;
666 } 666 }
667 ASSERT_NOT_REACHED(); 667 NOTREACHED();
668 return InvalidMilliseconds(); 668 return InvalidMilliseconds();
669 } 669 }
670 670
671 double DateComponents::MonthsSinceEpoch() const { 671 double DateComponents::MonthsSinceEpoch() const {
672 ASSERT(type_ == kMonth); 672 ASSERT(type_ == kMonth);
673 return (year_ - 1970) * 12 + month_; 673 return (year_ - 1970) * 12 + month_;
674 } 674 }
675 675
676 String DateComponents::ToStringForTime(SecondFormat format) const { 676 String DateComponents::ToStringForTime(SecondFormat format) const {
677 ASSERT(type_ == kDateTime || type_ == kDateTimeLocal || type_ == kTime); 677 ASSERT(type_ == kDateTime || type_ == kDateTimeLocal || type_ == kTime);
678 SecondFormat effective_format = format; 678 SecondFormat effective_format = format;
679 if (millisecond_) 679 if (millisecond_)
680 effective_format = kMillisecond; 680 effective_format = kMillisecond;
681 else if (format == kNone && second_) 681 else if (format == kNone && second_)
682 effective_format = kSecond; 682 effective_format = kSecond;
683 683
684 switch (effective_format) { 684 switch (effective_format) {
685 default: 685 default:
686 ASSERT_NOT_REACHED(); 686 NOTREACHED();
687 // Fallback to None. 687 // Fallback to None.
688 case kNone: 688 case kNone:
689 return String::Format("%02d:%02d", hour_, minute_); 689 return String::Format("%02d:%02d", hour_, minute_);
690 case kSecond: 690 case kSecond:
691 return String::Format("%02d:%02d:%02d", hour_, minute_, second_); 691 return String::Format("%02d:%02d:%02d", hour_, minute_, second_);
692 case kMillisecond: 692 case kMillisecond:
693 return String::Format("%02d:%02d:%02d.%03d", hour_, minute_, second_, 693 return String::Format("%02d:%02d:%02d.%03d", hour_, minute_, second_,
694 millisecond_); 694 millisecond_);
695 } 695 }
696 } 696 }
(...skipping 10 matching lines...) Expand all
707 ToStringForTime(format); 707 ToStringForTime(format);
708 case kMonth: 708 case kMonth:
709 return String::Format("%04d-%02d", year_, month_ + 1); 709 return String::Format("%04d-%02d", year_, month_ + 1);
710 case kTime: 710 case kTime:
711 return ToStringForTime(format); 711 return ToStringForTime(format);
712 case kWeek: 712 case kWeek:
713 return String::Format("%04d-W%02d", year_, week_); 713 return String::Format("%04d-W%02d", year_, week_);
714 case kInvalid: 714 case kInvalid:
715 break; 715 break;
716 } 716 }
717 ASSERT_NOT_REACHED(); 717 NOTREACHED();
718 return String("(Invalid DateComponents)"); 718 return String("(Invalid DateComponents)");
719 } 719 }
720 720
721 } // namespace blink 721 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/Crypto.cpp ('k') | third_party/WebKit/Source/platform/Decimal.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698