Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PLATFORM_GLOBALS_H_ | 5 #ifndef PLATFORM_GLOBALS_H_ |
| 6 #define PLATFORM_GLOBALS_H_ | 6 #define PLATFORM_GLOBALS_H_ |
| 7 | 7 |
| 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to | 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
| 9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
| 10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 const int kMicrosecondsPerMillisecond = 1000; | 319 const int kMicrosecondsPerMillisecond = 1000; |
| 320 const int kMicrosecondsPerSecond = (kMicrosecondsPerMillisecond * | 320 const int kMicrosecondsPerSecond = (kMicrosecondsPerMillisecond * |
| 321 kMillisecondsPerSecond); | 321 kMillisecondsPerSecond); |
| 322 const int kNanosecondsPerMicrosecond = 1000; | 322 const int kNanosecondsPerMicrosecond = 1000; |
| 323 const int kNanosecondsPerMillisecond = (kNanosecondsPerMicrosecond * | 323 const int kNanosecondsPerMillisecond = (kNanosecondsPerMicrosecond * |
| 324 kMicrosecondsPerMillisecond); | 324 kMicrosecondsPerMillisecond); |
| 325 const int kNanosecondsPerSecond = (kNanosecondsPerMicrosecond * | 325 const int kNanosecondsPerSecond = (kNanosecondsPerMicrosecond * |
| 326 kMicrosecondsPerSecond); | 326 kMicrosecondsPerSecond); |
| 327 | 327 |
| 328 // Helpers to round micro second times to human understandable values. | 328 // Helpers to round micro second times to human understandable values. |
| 329 inline double RoundMicrosecondsToSeconds(int64_t micros) { | 329 inline int64_t RoundMicrosecondsToSeconds(int64_t micros) { |
|
Ivan Posva
2014/03/10 13:00:36
We should keep these as double and drop the roundi
| |
| 330 const int k1M = 1000000; // Converting us to secs. | 330 const int k1M = 1000000; // Converting us to secs. |
| 331 return static_cast<double>(micros + (k1M >> 1)) / k1M; | 331 return (micros + (k1M >> 1)) / k1M; |
| 332 } | 332 } |
| 333 inline double RoundMicrosecondsToMilliseconds(int64_t micros) { | 333 inline int64_t RoundMicrosecondsToMilliseconds(int64_t micros) { |
|
Ivan Posva
2014/03/10 13:00:36
ditto.
| |
| 334 const int k1K = 1000; // Conversting us to ms. | 334 const int k1K = 1000; // Converting us to ms. |
| 335 return static_cast<double>(micros + (k1K >> 1)) / k1K; | 335 return (micros + (k1K >> 1)) / k1K; |
| 336 } | 336 } |
| 337 | 337 |
| 338 // A macro to disallow the copy constructor and operator= functions. | 338 // A macro to disallow the copy constructor and operator= functions. |
| 339 // This should be used in the private: declarations for a class. | 339 // This should be used in the private: declarations for a class. |
| 340 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | 340 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
| 341 private: \ | 341 private: \ |
| 342 TypeName(const TypeName&); \ | 342 TypeName(const TypeName&); \ |
| 343 void operator=(const TypeName&) | 343 void operator=(const TypeName&) |
| 344 | 344 |
| 345 | 345 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods | 500 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods |
| 501 // have an implicit 'this' argument, the arguments of such methods | 501 // have an implicit 'this' argument, the arguments of such methods |
| 502 // should be counted from two, not one." | 502 // should be counted from two, not one." |
| 503 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 503 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
| 504 __attribute__((__format__(__printf__, string_index, first_to_check))) | 504 __attribute__((__format__(__printf__, string_index, first_to_check))) |
| 505 #else | 505 #else |
| 506 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 506 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
| 507 #endif | 507 #endif |
| 508 | 508 |
| 509 #endif // PLATFORM_GLOBALS_H_ | 509 #endif // PLATFORM_GLOBALS_H_ |
| OLD | NEW |