Pull the new r369476 of base library from Chromium
The merge was done against r369476 which corresponds to git commit
0471d0e2e2ef4a544a63481a389e1df33ea7c00a of Jan 14, 2016
Change-Id: Ie6894cf65424cc5ad115110faccd51602b2d1234
Reviewed-on: https://weave-review.googlesource.com/2225
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/third_party/chromium/base/time/time_posix.cc b/third_party/chromium/base/time/time_posix.cc
index e8e56c2..4b37b4a 100644
--- a/third_party/chromium/base/time/time_posix.cc
+++ b/third_party/chromium/base/time/time_posix.cc
@@ -15,7 +15,6 @@
#include <limits>
#include <ostream>
-#include "base/basictypes.h"
#include "base/logging.h"
#include "build/build_config.h"
@@ -60,8 +59,8 @@
}
#endif // OS_ANDROID
-int64 ConvertTimespecToMicros(const struct timespec& ts) {
- base::CheckedNumeric<int64> result(ts.tv_sec);
+int64_t ConvertTimespecToMicros(const struct timespec& ts) {
+ base::CheckedNumeric<int64_t> result(ts.tv_sec);
result *= base::Time::kMicrosecondsPerSecond;
result += (ts.tv_nsec / base::Time::kNanosecondsPerMicrosecond);
return result.ValueOrDie();
@@ -74,7 +73,7 @@
#if (defined(OS_POSIX) && \
defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0) || \
defined(OS_BSD) || defined(OS_ANDROID)
-int64 ClockNow(clockid_t clk_id) {
+int64_t ClockNow(clockid_t clk_id) {
struct timespec ts;
if (clock_gettime(clk_id, &ts) != 0) {
NOTREACHED() << "clock_gettime(" << clk_id << ") failed.";
@@ -92,7 +91,7 @@
namespace base {
struct timespec TimeDelta::ToTimeSpec() const {
- int64 microseconds = InMicroseconds();
+ int64_t microseconds = InMicroseconds();
time_t seconds = 0;
if (microseconds >= Time::kMicrosecondsPerSecond) {
seconds = InSeconds();
@@ -117,16 +116,16 @@
// => Thu Jan 01 00:00:00 UTC 1970
// irb(main):011:0> Time.at(-11644473600).getutc()
// => Mon Jan 01 00:00:00 UTC 1601
-static const int64 kWindowsEpochDeltaSeconds = 11644473600ll;
+static const int64_t kWindowsEpochDeltaSeconds = 11644473600ll;
// static
-const int64 Time::kWindowsEpochDeltaMicroseconds =
+const int64_t Time::kWindowsEpochDeltaMicroseconds =
kWindowsEpochDeltaSeconds * Time::kMicrosecondsPerSecond;
// Some functions in time.cc use time_t directly, so we provide an offset
// to convert from time_t (Unix epoch) and internal (Windows epoch).
// static
-const int64 Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds;
+const int64_t Time::kTimeTToMicrosecondsOffset = kWindowsEpochDeltaMicroseconds;
// static
Time Time::Now() {
@@ -156,9 +155,9 @@
// Time stores times with microsecond resolution, but Exploded only carries
// millisecond resolution, so begin by being lossy. Adjust from Windows
// epoch (1601) to Unix epoch (1970);
- int64 microseconds = us_ - kWindowsEpochDeltaMicroseconds;
+ int64_t microseconds = us_ - kWindowsEpochDeltaMicroseconds;
// The following values are all rounded towards -infinity.
- int64 milliseconds; // Milliseconds since epoch.
+ int64_t milliseconds; // Milliseconds since epoch.
SysTime seconds; // Seconds since epoch.
int millisecond; // Exploded millisecond value (0-999).
if (microseconds >= 0) {
@@ -208,8 +207,7 @@
timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore
#endif
-
- int64 milliseconds;
+ int64_t milliseconds;
SysTime seconds;
// Certain exploded dates do not really exist due to daylight saving times,
@@ -227,11 +225,11 @@
// to UTC 00:00:00 that isn't -1.
timestruct = timestruct0;
timestruct.tm_isdst = 0;
- int64 seconds_isdst0 = SysTimeFromTimeStruct(×truct, is_local);
+ int64_t seconds_isdst0 = SysTimeFromTimeStruct(×truct, is_local);
timestruct = timestruct0;
timestruct.tm_isdst = 1;
- int64 seconds_isdst1 = SysTimeFromTimeStruct(×truct, is_local);
+ int64_t seconds_isdst1 = SysTimeFromTimeStruct(×truct, is_local);
// seconds_isdst0 or seconds_isdst1 can be -1 for some timezones.
// E.g. "CLST" (Chile Summer Time) returns -1 for 'tm_isdt == 1'.
@@ -264,14 +262,14 @@
// 999ms to avoid the time being less than any other possible value that
// this function can return.
- // On Android, SysTime is int64, special care must be taken to avoid
+ // On Android, SysTime is int64_t, special care must be taken to avoid
// overflows.
- const int64 min_seconds = (sizeof(SysTime) < sizeof(int64))
- ? std::numeric_limits<SysTime>::min()
- : std::numeric_limits<int32_t>::min();
- const int64 max_seconds = (sizeof(SysTime) < sizeof(int64))
- ? std::numeric_limits<SysTime>::max()
- : std::numeric_limits<int32_t>::max();
+ const int64_t min_seconds = (sizeof(SysTime) < sizeof(int64_t))
+ ? std::numeric_limits<SysTime>::min()
+ : std::numeric_limits<int32_t>::min();
+ const int64_t max_seconds = (sizeof(SysTime) < sizeof(int64_t))
+ ? std::numeric_limits<SysTime>::max()
+ : std::numeric_limits<int32_t>::max();
if (exploded.year < 1969) {
milliseconds = min_seconds * kMillisecondsPerSecond;
} else {
@@ -309,27 +307,6 @@
#endif
}
-// Use the Chrome OS specific system-wide clock.
-#if defined(OS_CHROMEOS)
-// static
-TraceTicks TraceTicks::Now() {
- struct timespec ts;
- if (clock_gettime(kClockSystemTrace, &ts) != 0) {
- // NB: fall-back for a chrome os build running on linux
- return TraceTicks(ClockNow(CLOCK_MONOTONIC));
- }
- return TraceTicks(ConvertTimespecToMicros(ts));
-}
-
-#else // !defined(OS_CHROMEOS)
-
-// static
-TraceTicks TraceTicks::Now() {
- return TraceTicks(ClockNow(CLOCK_MONOTONIC));
-}
-
-#endif // defined(OS_CHROMEOS)
-
#endif // !OS_MACOSX
// static
@@ -341,10 +318,8 @@
if (t.tv_usec == static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1 &&
t.tv_sec == std::numeric_limits<time_t>::max())
return Max();
- return Time(
- (static_cast<int64>(t.tv_sec) * Time::kMicrosecondsPerSecond) +
- t.tv_usec +
- kTimeTToMicrosecondsOffset);
+ return Time((static_cast<int64_t>(t.tv_sec) * Time::kMicrosecondsPerSecond) +
+ t.tv_usec + kTimeTToMicrosecondsOffset);
}
struct timeval Time::ToTimeVal() const {
@@ -359,7 +334,7 @@
result.tv_usec = static_cast<suseconds_t>(Time::kMicrosecondsPerSecond) - 1;
return result;
}
- int64 us = us_ - kTimeTToMicrosecondsOffset;
+ int64_t us = us_ - kTimeTToMicrosecondsOffset;
result.tv_sec = us / Time::kMicrosecondsPerSecond;
result.tv_usec = us % Time::kMicrosecondsPerSecond;
return result;