diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-11 18:15:10 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-11 18:15:10 +0000 |
commit | dc9a22ac2628693842ee88a3eadae83c470f398d (patch) | |
tree | fdc2f6902640efaa80fe0cb355ca207873011527 /base | |
parent | 4b92c4260c6634b2b3e14960965c15fa45860148 (diff) | |
download | chromium_src-dc9a22ac2628693842ee88a3eadae83c470f398d.zip chromium_src-dc9a22ac2628693842ee88a3eadae83c470f398d.tar.gz chromium_src-dc9a22ac2628693842ee88a3eadae83c470f398d.tar.bz2 |
Make POSIX time routines work on Linux by providing a POSIX-conformant version of TimeTicks::Now() to replace the Mach-specific one used on the Mac.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/SConscript | 1 | ||||
-rw-r--r-- | base/base.xcodeproj/project.pbxproj | 78 | ||||
-rw-r--r-- | base/condition_variable_posix.cc | 13 | ||||
-rw-r--r-- | base/time.h | 4 | ||||
-rw-r--r-- | base/time_posix.cc (renamed from base/time_mac.cc) | 39 |
5 files changed, 76 insertions, 59 deletions
diff --git a/base/SConscript b/base/SConscript index a23672d..24dfe86 100644 --- a/base/SConscript +++ b/base/SConscript @@ -137,6 +137,7 @@ if env['PLATFORM'] in ('darwin', 'linux2'): 'lock_impl_posix.cc', 'thread_posix.cc', 'thread_local_storage_posix.cc', + 'time_posix.cc', 'waitable_event_generic.cc', ]) diff --git a/base/base.xcodeproj/project.pbxproj b/base/base.xcodeproj/project.pbxproj index 14e7d2d..5c2ad2c 100644 --- a/base/base.xcodeproj/project.pbxproj +++ b/base/base.xcodeproj/project.pbxproj @@ -37,6 +37,14 @@ 7B4C5D890E4915D800679E8F /* float_util.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4C5D880E4915D800679E8F /* float_util.h */; }; 7B4C5F490E4B6BF900679E8F /* sys_string_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4C5F470E4B6BF900679E8F /* sys_string_conversions.h */; }; 7B4C5F4A0E4B6BF900679E8F /* sys_string_conversions_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7B4C5F480E4B6BF900679E8F /* sys_string_conversions_mac.cc */; }; + 7BAF4F0B0E50A2FD00CA8A07 /* notimplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BAF4F0A0E50A2FD00CA8A07 /* notimplemented.h */; }; + 7BAF4F7C0E50A3BD00CA8A07 /* logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BAF4F7B0E50A3BD00CA8A07 /* logging.h */; }; + 7BAF4FD20E50B77000CA8A07 /* path_service.cc in Sources */ = {isa = PBXBuildFile; fileRef = ABF4B9B40DC2BC9F00A6E319 /* path_service.cc */; }; + 7BAF501C0E50B84200CA8A07 /* base_paths.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BAF501B0E50B84200CA8A07 /* base_paths.cc */; }; + 7BAF501D0E50B84200CA8A07 /* base_paths.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BAF501B0E50B84200CA8A07 /* base_paths.cc */; }; + 7BAF50760E50B8F100CA8A07 /* file_version_info_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7BAF50740E50B8F100CA8A07 /* file_version_info_mac.mm */; }; + 7BAF50780E50B8F100CA8A07 /* file_version_info_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7BAF50740E50B8F100CA8A07 /* file_version_info_mac.mm */; }; + 7BAF50790E50B8F100CA8A07 /* file_version_info_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BAF50750E50B8F100CA8A07 /* file_version_info_unittest.cc */; }; 820EB4F00E3A610A009668FC /* linked_ptr.h in Headers */ = {isa = PBXBuildFile; fileRef = 820EB4EF0E3A610A009668FC /* linked_ptr.h */; }; 820EB4F70E3A613F009668FC /* string_piece.cc in Sources */ = {isa = PBXBuildFile; fileRef = 820EB4F50E3A613F009668FC /* string_piece.cc */; }; 820EB4F80E3A613F009668FC /* string_piece.h in Headers */ = {isa = PBXBuildFile; fileRef = 820EB4F60E3A613F009668FC /* string_piece.h */; }; @@ -64,7 +72,7 @@ 824653690DC12CF2007C2BAA /* condition_variable.h in Headers */ = {isa = PBXBuildFile; fileRef = 825402EB0D92D1940006B936 /* condition_variable.h */; }; 824653740DC12D0E007C2BAA /* shared_memory_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = 824653730DC12D0E007C2BAA /* shared_memory_posix.cc */; }; 824653750DC12D0F007C2BAA /* shared_memory.h in Headers */ = {isa = PBXBuildFile; fileRef = 825403760D92D2CF0006B936 /* shared_memory.h */; }; - 824654530DC25633007C2BAA /* time_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BEB81490D9B0F33009BA8DD /* time_mac.cc */; }; + 824654530DC25633007C2BAA /* time_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BEB81490D9B0F33009BA8DD /* time_posix.cc */; }; 824654540DC25634007C2BAA /* time.h in Headers */ = {isa = PBXBuildFile; fileRef = 825403840D92D2CF0006B936 /* time.h */; }; 8246548B0DC259DB007C2BAA /* revocable_store.h in Headers */ = {isa = PBXBuildFile; fileRef = 8254035F0D92D27C0006B936 /* revocable_store.h */; }; 8246548C0DC259DB007C2BAA /* revocable_store.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8254035E0D92D27C0006B936 /* revocable_store.cc */; }; @@ -95,7 +103,6 @@ 829E2FA50DBFD79E00819EBF /* skia_utils_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 829E2FA30DBFD79E00819EBF /* skia_utils_mac.cc */; }; 829E31340DBFDB6F00819EBF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 829E31330DBFDB6F00819EBF /* CoreGraphics.framework */; }; 829E35D50DC0DC9400819EBF /* logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 825403270D92D2090006B936 /* logging.cc */; }; - 829E35D60DC0DC9400819EBF /* notimplemented.h in Headers */ = {isa = PBXBuildFile; fileRef = 825403280D92D2090006B936 /* notimplemented.h */; }; 829E35DA0DC0DD0400819EBF /* lock_impl_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BEFC29D0D99832D000829AD /* lock_impl_posix.cc */; }; 829E35DB0DC0DD0500819EBF /* lock_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BEFC29C0D99832D000829AD /* lock_impl.h */; }; 829E36420DC0F69D00819EBF /* string16.h in Headers */ = {isa = PBXBuildFile; fileRef = 821B91680DAABD7F00F350D7 /* string16.h */; }; @@ -108,23 +115,14 @@ 829E36730DC0FBAD00819EBF /* thread_local_storage_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = 829E36720DC0FBAD00819EBF /* thread_local_storage_posix.cc */; }; 829E36740DC0FBB100819EBF /* thread_local_storage.h in Headers */ = {isa = PBXBuildFile; fileRef = 825403820D92D2CF0006B936 /* thread_local_storage.h */; }; A5A026190E48FE1500498DA9 /* base_paths_mac.h in Headers */ = {isa = PBXBuildFile; fileRef = A5A026180E48FE1500498DA9 /* base_paths_mac.h */; }; - A5A0261F0E48FF2200498DA9 /* path_service.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A0261E0E48FF2200498DA9 /* path_service.cc */; }; A5A026550E4A214600498DA9 /* file_util.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A026540E4A214600498DA9 /* file_util.cc */; }; A5A0268E0E4A2BDC00498DA9 /* file_util_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A0268D0E4A2BDC00498DA9 /* file_util_posix.cc */; }; A5A0270B0E4A630D00498DA9 /* file_util_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5A0270A0E4A630D00498DA9 /* file_util_mac.mm */; }; A5A0276C0E4BA33700498DA9 /* build_config.h in Headers */ = {isa = PBXBuildFile; fileRef = A5A0276B0E4BA33700498DA9 /* build_config.h */; }; - A5A0282E0E4CFA8500498DA9 /* file_util_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A0282D0E4CFA8500498DA9 /* file_util_unittest.cc */; }; - A5A028360E4CFBE700498DA9 /* file_version_info_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5A028340E4CFBE700498DA9 /* file_version_info_mac.mm */; }; - A5A028370E4CFBE700498DA9 /* file_version_info_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A028350E4CFBE700498DA9 /* file_version_info_unittest.cc */; }; - A5A028380E4CFBE700498DA9 /* file_version_info_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5A028340E4CFBE700498DA9 /* file_version_info_mac.mm */; }; - A5A028390E4CFBE700498DA9 /* file_version_info_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A028350E4CFBE700498DA9 /* file_version_info_unittest.cc */; }; A5A0284D0E4CFD7500498DA9 /* file_util.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A026540E4A214600498DA9 /* file_util.cc */; }; A5A0284E0E4CFD7B00498DA9 /* file_util_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5A0270A0E4A630D00498DA9 /* file_util_mac.mm */; }; A5A0284F0E4CFD7E00498DA9 /* file_util_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A0268D0E4A2BDC00498DA9 /* file_util_posix.cc */; }; - A5A028510E4CFD9500498DA9 /* path_service.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A0261E0E48FF2200498DA9 /* path_service.cc */; }; A5A028520E4CFDE300498DA9 /* path_service_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E4562AD60E27E27E005E4685 /* path_service_unittest.cc */; }; - A5A028690E4CFFAB00498DA9 /* base_paths.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A028680E4CFFAB00498DA9 /* base_paths.cc */; }; - A5A0286A0E4CFFAB00498DA9 /* base_paths.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A028680E4CFFAB00498DA9 /* base_paths.cc */; }; A5A0286B0E4CFFC700498DA9 /* base_paths_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABF4B98E0DC2BA6900A6E319 /* base_paths_mac.mm */; }; ABF4B98F0DC2BA6900A6E319 /* base_paths_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABF4B98E0DC2BA6900A6E319 /* base_paths_mac.mm */; }; ABF4B99E0DC2BB6000A6E319 /* clipboard.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABF4B99D0DC2BB6000A6E319 /* clipboard.mm */; }; @@ -153,7 +151,6 @@ E49E4C7F0E4CF50300AD47F7 /* pickle_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E4562C680E2803C3005E4685 /* pickle_unittest.cc */; }; E49E4C810E4CF51C00AD47F7 /* pickle.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8254033E0D92D2210006B936 /* pickle.cc */; }; E49E4C880E4CF56100AD47F7 /* string_tokenizer_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E49E4C870E4CF56100AD47F7 /* string_tokenizer_unittest.cc */; }; - E49E4C890E4CF56100AD47F7 /* string_tokenizer_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E49E4C870E4CF56100AD47F7 /* string_tokenizer_unittest.cc */; }; E49E4C8D0E4CF59400AD47F7 /* string_escape_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E49E4C8C0E4CF59400AD47F7 /* string_escape_unittest.cc */; }; E49E4C990E4CF60300AD47F7 /* values_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E49E4C980E4CF60300AD47F7 /* values_unittest.cc */; }; E49E4CA30E4CF67D00AD47F7 /* json_reader_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E4562C3B0E28017F005E4685 /* json_reader_unittest.cc */; }; @@ -351,9 +348,14 @@ 7B4C5F470E4B6BF900679E8F /* sys_string_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sys_string_conversions.h; sourceTree = "<group>"; }; 7B4C5F480E4B6BF900679E8F /* sys_string_conversions_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sys_string_conversions_mac.cc; sourceTree = "<group>"; }; 7B5AD60D0D9DD8050012BCF1 /* scoped_cftyperef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scoped_cftyperef.h; sourceTree = "<group>"; }; + 7BAF4F0A0E50A2FD00CA8A07 /* notimplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = notimplemented.h; sourceTree = "<group>"; }; + 7BAF4F7B0E50A3BD00CA8A07 /* logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = logging.h; sourceTree = "<group>"; }; + 7BAF501B0E50B84200CA8A07 /* base_paths.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = base_paths.cc; sourceTree = "<group>"; }; + 7BAF50740E50B8F100CA8A07 /* file_version_info_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = file_version_info_mac.mm; sourceTree = "<group>"; }; + 7BAF50750E50B8F100CA8A07 /* file_version_info_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_version_info_unittest.cc; sourceTree = "<group>"; }; 7BD9E84E0DA447F800FC7A01 /* singleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = singleton.h; sourceTree = "<group>"; }; 7BEB81100D9AD288009BA8DD /* prcpucfg_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prcpucfg_mac.h; path = third_party/nspr/prcpucfg_mac.h; sourceTree = "<group>"; }; - 7BEB81490D9B0F33009BA8DD /* time_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = time_mac.cc; sourceTree = "<group>"; }; + 7BEB81490D9B0F33009BA8DD /* time_posix.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = time_posix.cc; sourceTree = "<group>"; }; 7BEB834D0D9C4BE0009BA8DD /* string_util_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string_util_mac.cc; sourceTree = "<group>"; }; 7BEE52C10D9D84FD0067FF23 /* string_util_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = string_util_mac.h; sourceTree = "<group>"; }; 7BEFC29C0D99832D000829AD /* lock_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lock_impl.h; sourceTree = "<group>"; }; @@ -416,7 +418,6 @@ 825403250D92D2090006B936 /* lock.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lock.cc; sourceTree = "<group>"; }; 825403260D92D2090006B936 /* lock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lock.h; sourceTree = "<group>"; }; 825403270D92D2090006B936 /* logging.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = logging.cc; sourceTree = "<group>"; }; - 825403280D92D2090006B936 /* notimplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = notimplemented.h; sourceTree = "<group>"; }; 825403290D92D2090006B936 /* md5.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = md5.cc; sourceTree = "<group>"; }; 8254032A0D92D2090006B936 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; }; 8254032B0D92D2090006B936 /* memory_debug.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = memory_debug.cc; sourceTree = "<group>"; }; @@ -505,15 +506,11 @@ 82E23FCB0D9C219600F8B40A /* platform_thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform_thread.h; sourceTree = "<group>"; }; 82E23FCC0D9C219600F8B40A /* platform_thread.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = platform_thread.cc; sourceTree = "<group>"; }; A5A026180E48FE1500498DA9 /* base_paths_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base_paths_mac.h; sourceTree = "<group>"; }; - A5A0261E0E48FF2200498DA9 /* path_service.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = path_service.cc; sourceTree = "<group>"; }; A5A026540E4A214600498DA9 /* file_util.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_util.cc; sourceTree = "<group>"; }; A5A0268D0E4A2BDC00498DA9 /* file_util_posix.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_util_posix.cc; sourceTree = "<group>"; }; A5A0270A0E4A630D00498DA9 /* file_util_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = file_util_mac.mm; sourceTree = "<group>"; }; A5A0276B0E4BA33700498DA9 /* build_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = build_config.h; path = ../build/build_config.h; sourceTree = SOURCE_ROOT; }; A5A0282D0E4CFA8500498DA9 /* file_util_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_util_unittest.cc; sourceTree = "<group>"; }; - A5A028340E4CFBE700498DA9 /* file_version_info_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = file_version_info_mac.mm; sourceTree = "<group>"; }; - A5A028350E4CFBE700498DA9 /* file_version_info_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = file_version_info_unittest.cc; sourceTree = "<group>"; }; - A5A028680E4CFFAB00498DA9 /* base_paths.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = base_paths.cc; sourceTree = "<group>"; }; ABF4B98E0DC2BA6900A6E319 /* base_paths_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = base_paths_mac.mm; sourceTree = "<group>"; }; ABF4B99D0DC2BB6000A6E319 /* clipboard.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = clipboard.mm; sourceTree = "<group>"; }; ABF4B9B40DC2BC9F00A6E319 /* path_service.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = path_service.cc; sourceTree = "<group>"; }; @@ -591,7 +588,6 @@ 825402A80D92D0C60006B936 = { isa = PBXGroup; children = ( - A5A0282D0E4CFA8500498DA9 /* file_util_unittest.cc */, 825402B60D92D0E20006B936 /* base */, 825403B40D92D2EC0006B936 /* base_gfx */, 829E2FA80DBFD7D500819EBF /* Frameworks */, @@ -602,14 +598,6 @@ 825402B60D92D0E20006B936 /* base */ = { isa = PBXGroup; children = ( - A5A028680E4CFFAB00498DA9 /* base_paths.cc */, - A5A028340E4CFBE700498DA9 /* file_version_info_mac.mm */, - A5A028350E4CFBE700498DA9 /* file_version_info_unittest.cc */, - A5A0270A0E4A630D00498DA9 /* file_util_mac.mm */, - A5A0268D0E4A2BDC00498DA9 /* file_util_posix.cc */, - A5A026540E4A214600498DA9 /* file_util.cc */, - A5A0261E0E48FF2200498DA9 /* path_service.cc */, - A5A026180E48FE1500498DA9 /* base_paths_mac.h */, E49115EB0E47B461001EE8C3 /* at_exit.h */, E49115EC0E47B461001EE8C3 /* at_exit.cc */, E49115F30E47B496001EE8C3 /* at_exit_unittest.cc */, @@ -617,7 +605,9 @@ 825402C60D92D1390006B936 /* base_drag_source.h */, 825402C70D92D1390006B936 /* base_drop_target.cc */, 825402C80D92D1390006B936 /* base_drop_target.h */, + A5A026180E48FE1500498DA9 /* base_paths_mac.h */, ABF4B98E0DC2BA6900A6E319 /* base_paths_mac.mm */, + 7BAF501B0E50B84200CA8A07 /* base_paths.cc */, 825402CA0D92D1390006B936 /* base_paths.h */, 825402CB0D92D1390006B936 /* base_switches.cc */, 825402CC0D92D1390006B936 /* base_switches.h */, @@ -640,7 +630,13 @@ 825402F20D92D1AC0006B936 /* debug_util.cc */, 825402FF0D92D1BC0006B936 /* event_recorder.cc */, 825403000D92D1BC0006B936 /* event_recorder.h */, + A5A0270A0E4A630D00498DA9 /* file_util_mac.mm */, + A5A0268D0E4A2BDC00498DA9 /* file_util_posix.cc */, + A5A0282D0E4CFA8500498DA9 /* file_util_unittest.cc */, 825403030D92D1C50006B936 /* file_util.h */, + A5A026540E4A214600498DA9 /* file_util.cc */, + 7BAF50740E50B8F100CA8A07 /* file_version_info_mac.mm */, + 7BAF50750E50B8F100CA8A07 /* file_version_info_unittest.cc */, 825403070D92D1CD0006B936 /* file_version_info.h */, 8254030B0D92D1D10006B936 /* fix_wp64.h */, 7B4C5D880E4915D800679E8F /* float_util.h */, @@ -667,14 +663,14 @@ 7BEFC29C0D99832D000829AD /* lock_impl.h */, 7BEFC29D0D99832D000829AD /* lock_impl_posix.cc */, 825403270D92D2090006B936 /* logging.cc */, - 825403280D92D2090006B936 /* notimplemented.h */, - 825403280D92D2090006B936 /* notimplemented.h */, + 7BAF4F7B0E50A3BD00CA8A07 /* logging.h */, 825403290D92D2090006B936 /* md5.cc */, 8254032A0D92D2090006B936 /* md5.h */, 8254032B0D92D2090006B936 /* memory_debug.cc */, 8254032C0D92D2090006B936 /* memory_debug.h */, 822BDC710DF739F000034F4C /* message_loop_mac.mm */, 825403360D92D2110006B936 /* message_loop.h */, + 7BAF4F0A0E50A2FD00CA8A07 /* notimplemented.h */, E4562C580E2802AC005E4685 /* observer_list_unittest.cc */, 825403390D92D2210006B936 /* observer_list.h */, E4562AD60E27E27E005E4685 /* path_service_unittest.cc */, @@ -744,7 +740,7 @@ 825403820D92D2CF0006B936 /* thread_local_storage.h */, 825403840D92D2CF0006B936 /* time.h */, 824654900DC25A8C007C2BAA /* time.cc */, - 7BEB81490D9B0F33009BA8DD /* time_mac.cc */, + 7BEB81490D9B0F33009BA8DD /* time_posix.cc */, 825403850D92D2CF0006B936 /* timer.cc */, 825403860D92D2CF0006B936 /* timer.h */, 820EB4FB0E3A618B009668FC /* tracked_objects.cc */, @@ -887,8 +883,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 829E35D60DC0DC9400819EBF /* notimplemented.h in Headers */, - 829E35D60DC0DC9400819EBF /* notimplemented.h in Headers */, 829E35DB0DC0DD0500819EBF /* lock_impl.h in Headers */, 829E36420DC0F69D00819EBF /* string16.h in Headers */, 829E36430DC0F69E00819EBF /* string_util_mac.h in Headers */, @@ -928,6 +922,8 @@ 7B4C5D890E4915D800679E8F /* float_util.h in Headers */, 7B4C5F490E4B6BF900679E8F /* sys_string_conversions.h in Headers */, A5A0276C0E4BA33700498DA9 /* build_config.h in Headers */, + 7BAF4F0B0E50A2FD00CA8A07 /* notimplemented.h in Headers */, + 7BAF4F7C0E50A3BD00CA8A07 /* logging.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1168,7 +1164,7 @@ 824653450DC1230B007C2BAA /* lock.cc in Sources */, 824653680DC12CEC007C2BAA /* condition_variable_posix.cc in Sources */, 824653740DC12D0E007C2BAA /* shared_memory_posix.cc in Sources */, - 824654530DC25633007C2BAA /* time_mac.cc in Sources */, + 824654530DC25633007C2BAA /* time_posix.cc in Sources */, 8246548C0DC259DB007C2BAA /* revocable_store.cc in Sources */, 824654910DC25A8C007C2BAA /* time.cc in Sources */, 824654A60DC25CD7007C2BAA /* pickle.cc in Sources */, @@ -1198,16 +1194,12 @@ E45062A60E40A9BE0025A81A /* base_switches.cc in Sources */, E49357220E422A36008F8B09 /* timer.cc in Sources */, E49115EF0E47B461001EE8C3 /* at_exit.cc in Sources */, - A5A0261F0E48FF2200498DA9 /* path_service.cc in Sources */, A5A026550E4A214600498DA9 /* file_util.cc in Sources */, A5A0268E0E4A2BDC00498DA9 /* file_util_posix.cc in Sources */, A5A0270B0E4A630D00498DA9 /* file_util_mac.mm in Sources */, 7B4C5F4A0E4B6BF900679E8F /* sys_string_conversions_mac.cc in Sources */, - A5A0282E0E4CFA8500498DA9 /* file_util_unittest.cc in Sources */, - A5A028360E4CFBE700498DA9 /* file_version_info_mac.mm in Sources */, - A5A028370E4CFBE700498DA9 /* file_version_info_unittest.cc in Sources */, - A5A028690E4CFFAB00498DA9 /* base_paths.cc in Sources */, - E49E4C890E4CF56100AD47F7 /* string_tokenizer_unittest.cc in Sources */, + 7BAF501C0E50B84200CA8A07 /* base_paths.cc in Sources */, + 7BAF50760E50B8F100CA8A07 /* file_version_info_mac.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1235,7 +1227,6 @@ files = ( A5A0286B0E4CFFC700498DA9 /* base_paths_mac.mm in Sources */, A5A028520E4CFDE300498DA9 /* path_service_unittest.cc in Sources */, - A5A028510E4CFD9500498DA9 /* path_service.cc in Sources */, A5A0284F0E4CFD7E00498DA9 /* file_util_posix.cc in Sources */, A5A0284E0E4CFD7B00498DA9 /* file_util_mac.mm in Sources */, A5A0284D0E4CFD7500498DA9 /* file_util.cc in Sources */, @@ -1256,9 +1247,6 @@ E49F197C0E4CBDF400386AEC /* stack_container_unittest.cc in Sources */, E49F19A40E4CBFE900386AEC /* sys_string_conversions_mac.cc in Sources */, E49F1A330E4CCCF200386AEC /* command_line.cc in Sources */, - A5A028380E4CFBE700498DA9 /* file_version_info_mac.mm in Sources */, - A5A028390E4CFBE700498DA9 /* file_version_info_unittest.cc in Sources */, - A5A0286A0E4CFFAB00498DA9 /* base_paths.cc in Sources */, E49F1A390E4CCD6400386AEC /* command_line_unittest.cc in Sources */, E49F1A5E0E4CD6E200386AEC /* run_all_unittests.cc in Sources */, E49F1A7B0E4CD99D00386AEC /* icu_util.cc in Sources */, @@ -1274,6 +1262,10 @@ E49E4CAC0E4CF6DB00AD47F7 /* sha2_unittest.cc in Sources */, E49E4CAE0E4CF6EC00AD47F7 /* sha2.cc in Sources */, E49E4CB10E4CF71900AD47F7 /* sha512.cc in Sources */, + 7BAF4FD20E50B77000CA8A07 /* path_service.cc in Sources */, + 7BAF501D0E50B84200CA8A07 /* base_paths.cc in Sources */, + 7BAF50780E50B8F100CA8A07 /* file_version_info_mac.mm in Sources */, + 7BAF50790E50B8F100CA8A07 /* file_version_info_unittest.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/base/condition_variable_posix.cc b/base/condition_variable_posix.cc index e234ece..5f9af5f 100644 --- a/base/condition_variable_posix.cc +++ b/base/condition_variable_posix.cc @@ -59,15 +59,12 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) { struct timeval now; gettimeofday(&now, NULL); - const int kMicrosPerUnit = 1000000; - const int kNanosPerMicro = 1000; - const int kNanosPerUnit = kMicrosPerUnit * kNanosPerMicro; - struct timespec abstime; - abstime.tv_sec = now.tv_sec + (usecs / kMicrosPerUnit); - abstime.tv_nsec = (now.tv_usec + (usecs % kMicrosPerUnit)) * kNanosPerMicro; - abstime.tv_sec += abstime.tv_nsec / kNanosPerUnit; - abstime.tv_nsec %= kNanosPerUnit; + abstime.tv_sec = now.tv_sec + (usecs / Time::kMicrosecondsPerSecond); + abstime.tv_nsec = (now.tv_usec + (usecs % Time::kMicrosecondsPerSecond)) * + Time::kNanosecondsPerMicrosecond; + abstime.tv_sec += abstime.tv_nsec / Time::kNanosecondsPerSecond; + abstime.tv_nsec %= Time::kNanosecondsPerSecond; DCHECK(abstime.tv_sec >= now.tv_sec); // Overflow paranoia int rv = pthread_cond_timedwait(&condition_, user_mutex_, &abstime); diff --git a/base/time.h b/base/time.h index 306a67c..1a0d504 100644 --- a/base/time.h +++ b/base/time.h @@ -48,6 +48,7 @@ #define BASE_TIME_H_ #include <time.h> + #include "base/basictypes.h" #include "testing/gtest/include/gtest/gtest_prod.h" @@ -196,6 +197,9 @@ class Time { static const int64 kMicrosecondsPerHour = kMicrosecondsPerMinute * 60; static const int64 kMicrosecondsPerDay = kMicrosecondsPerHour * 24; static const int64 kMicrosecondsPerWeek = kMicrosecondsPerDay * 7; + static const int64 kNanosecondsPerMicrosecond = 1000; + static const int64 kNanosecondsPerSecond = kNanosecondsPerMicrosecond * + kMicrosecondsPerSecond; // Represents an exploded time that can be formatted nicely. This is kind of // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few diff --git a/base/time_mac.cc b/base/time_posix.cc index bd4be21..de08c90 100644 --- a/base/time_mac.cc +++ b/base/time_posix.cc @@ -29,15 +29,18 @@ #include "base/time.h" +#ifdef OS_MACOSX #include <mach/mach_time.h> +#endif #include <sys/time.h> #include <time.h> + #include "base/basictypes.h" #include "base/logging.h" // The Time routines in this file use standard POSIX routines, or almost- -// standard routines in the case of timegm. -// The TimeTicks routines are Mach-specific. +// standard routines in the case of timegm. We need to use a Mach-specific +// function for TimeTicks::Now() on Mac OS X. // Time ----------------------------------------------------------------------- @@ -55,7 +58,7 @@ int64 Time::CurrentWallclockMicroseconds() { } // Combine seconds and microseconds in a 64-bit field containing microseconds // since the epoch. That's enough for nearly 600 centuries. - return tv.tv_sec * GG_UINT64_C(1000000) + tv.tv_usec; + return tv.tv_sec * kMicrosecondsPerSecond + tv.tv_usec; } // static @@ -110,8 +113,12 @@ void Time::Explode(bool is_local, Exploded* exploded) const { // static TimeTicks TimeTicks::Now() { + uint64_t absolute_micro; + +#if defined(OS_MACOSX) + static bool has_timebase_info = false; - static mach_timebase_info_data_t timebase_info; + static mach_timebase_info_data_t timebase_info = {1, 1}; if (!has_timebase_info) { has_timebase_info = mach_timebase_info(&timebase_info) == KERN_SUCCESS; } @@ -121,15 +128,31 @@ TimeTicks TimeTicks::Now() { // with less precision (such as TickCount) just call through to // mach_absolute_time. - // timebase_info converts absolute time tick units into nanoseconds. Divide - // by 1000 to get microseconds up front to stave off overflows. - uint64_t absolute_micro = mach_absolute_time() / 1000 * timebase_info.numer / - timebase_info.denom; + // timebase_info converts absolute time tick units into nanoseconds. Convert + // to microseconds up front to stave off overflows. + absolute_micro = mach_absolute_time() / Time::kNanosecondsPerMicrosecond * + timebase_info.numer / timebase_info.denom; // Don't bother with the rollover handling that the Windows version does. // With numer and denom = 1 (the expected case), the 64-bit absolute time // reported in nanoseconds is enough to last nearly 585 years. +#elif defined(OS_POSIX) && \ + defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 + struct timespec ts; + if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { + NOTREACHED() << "clock_gettime(CLOCK_MONOTONIC) failed."; + return TimeTicks(); + } + + absolute_micro = + (static_cast<int64>(ts.tv_sec) * Time::kMicrosecondsPerSecond) + + (static_cast<int64>(ts.tv_nsec) / Time::kNanosecondsPerMicrosecond); + +#else // _POSIX_MONOTONIC_CLOCK +#error No usable tick clock function on this platform. +#endif // _POSIX_MONOTONIC_CLOCK + return TimeTicks(absolute_micro); } |