diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-09-26 13:24:57 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-09-26 13:24:57 +0100 |
commit | 68043e1e95eeb07d5cae7aca370b26518b0867d6 (patch) | |
tree | cc6a216bce6aa9319a216327b73a07f49200dab5 /base | |
parent | cede44592cfb9ec370925d10c2df733349a94a82 (diff) | |
download | chromium_org-68043e1e95eeb07d5cae7aca370b26518b0867d6.tar.gz |
Merge from Chromium at DEPS revision 225410
This commit was generated by merge_to_master.py.
Change-Id: Ifa1539ca216abb163295ee7a77f81bb67f52e178
Diffstat (limited to 'base')
90 files changed, 1254 insertions, 378 deletions
diff --git a/base/allocator/allocator_extension_thunks.target.darwin-arm.mk b/base/allocator/allocator_extension_thunks.target.darwin-arm.mk index 4b71c99588..58dfdf9438 100644 --- a/base/allocator/allocator_extension_thunks.target.darwin-arm.mk +++ b/base/allocator/allocator_extension_thunks.target.darwin-arm.mk @@ -64,7 +64,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -147,7 +146,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/allocator/allocator_extension_thunks.target.darwin-mips.mk b/base/allocator/allocator_extension_thunks.target.darwin-mips.mk index 3cc9503cab..a396d5c272 100644 --- a/base/allocator/allocator_extension_thunks.target.darwin-mips.mk +++ b/base/allocator/allocator_extension_thunks.target.darwin-mips.mk @@ -64,7 +64,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -147,7 +146,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/allocator/allocator_extension_thunks.target.darwin-x86.mk b/base/allocator/allocator_extension_thunks.target.darwin-x86.mk index 6c3a44d866..250823e4ae 100644 --- a/base/allocator/allocator_extension_thunks.target.darwin-x86.mk +++ b/base/allocator/allocator_extension_thunks.target.darwin-x86.mk @@ -66,7 +66,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -152,7 +151,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/allocator/allocator_extension_thunks.target.linux-arm.mk b/base/allocator/allocator_extension_thunks.target.linux-arm.mk index 4b71c99588..58dfdf9438 100644 --- a/base/allocator/allocator_extension_thunks.target.linux-arm.mk +++ b/base/allocator/allocator_extension_thunks.target.linux-arm.mk @@ -64,7 +64,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -147,7 +146,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/allocator/allocator_extension_thunks.target.linux-mips.mk b/base/allocator/allocator_extension_thunks.target.linux-mips.mk index 3cc9503cab..a396d5c272 100644 --- a/base/allocator/allocator_extension_thunks.target.linux-mips.mk +++ b/base/allocator/allocator_extension_thunks.target.linux-mips.mk @@ -64,7 +64,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -147,7 +146,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/allocator/allocator_extension_thunks.target.linux-x86.mk b/base/allocator/allocator_extension_thunks.target.linux-x86.mk index 6c3a44d866..250823e4ae 100644 --- a/base/allocator/allocator_extension_thunks.target.linux-x86.mk +++ b/base/allocator/allocator_extension_thunks.target.linux-x86.mk @@ -66,7 +66,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -152,7 +151,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base.gyp b/base/base.gyp index 39f6015dba..4aae198229 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -77,6 +77,14 @@ '../build/linux/system.gyp:x11', ], }], + ['use_aura==1 and use_x11==1', { + 'dependencies': [ + '../build/linux/system.gyp:xrandr', + ], + 'export_dependent_settings': [ + '../build/linux/system.gyp:xrandr', + ], + }], ['OS == "android" and _toolset == "host"', { # Always build base as a static_library for host toolset, even if # we're doing a component build. Specifically, we only care about the @@ -461,6 +469,7 @@ 'build_time_unittest.cc', 'callback_helpers_unittest.cc', 'callback_registry_unittest.cc', + 'callback_registry_unittest.nc', 'callback_unittest.cc', 'callback_unittest.nc', 'cancelable_callback_unittest.cc', @@ -809,6 +818,11 @@ 'win/win_util_unittest.cc', ], }], + ['use_aura==1 and use_x11==1', { + 'sources': [ + 'x11/edid_parser_x11_unittest.cc', + ], + }], ['use_system_nspr==1', { 'dependencies': [ 'third_party/nspr/nspr.gyp:nspr', diff --git a/base/base.gypi b/base/base.gypi index 8caee68d5e..cafb10dc90 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -669,6 +669,12 @@ 'win/wrapped_window_proc.h', ], 'conditions': [ + ['use_aura==1 and use_x11==1', { + 'sources': [ + 'x11/edid_parser_x11.cc', + 'x11/edid_parser_x11.h', + ], + }], ['google_tv==1', { 'sources': [ 'android/context_types.cc', diff --git a/base/base.target.darwin-arm.mk b/base/base.target.darwin-arm.mk index 8c74c8dc1b..3c84a8b6dd 100644 --- a/base/base.target.darwin-arm.mk +++ b/base/base.target.darwin-arm.mk @@ -272,7 +272,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -357,7 +356,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base.target.darwin-mips.mk b/base/base.target.darwin-mips.mk index 5940894ab2..94099ef239 100644 --- a/base/base.target.darwin-mips.mk +++ b/base/base.target.darwin-mips.mk @@ -271,7 +271,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -355,7 +354,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base.target.darwin-x86.mk b/base/base.target.darwin-x86.mk index e4dde9947d..45133415ec 100644 --- a/base/base.target.darwin-x86.mk +++ b/base/base.target.darwin-x86.mk @@ -275,7 +275,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -363,7 +362,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base.target.linux-arm.mk b/base/base.target.linux-arm.mk index 8c74c8dc1b..3c84a8b6dd 100644 --- a/base/base.target.linux-arm.mk +++ b/base/base.target.linux-arm.mk @@ -272,7 +272,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -357,7 +356,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base.target.linux-mips.mk b/base/base.target.linux-mips.mk index 5940894ab2..94099ef239 100644 --- a/base/base.target.linux-mips.mk +++ b/base/base.target.linux-mips.mk @@ -271,7 +271,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -355,7 +354,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base.target.linux-x86.mk b/base/base.target.linux-x86.mk index e4dde9947d..45133415ec 100644 --- a/base/base.target.linux-x86.mk +++ b/base/base.target.linux-x86.mk @@ -275,7 +275,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -363,7 +362,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_i18n.target.darwin-arm.mk b/base/base_i18n.target.darwin-arm.mk index 81decf1c8a..661a31130e 100644 --- a/base/base_i18n.target.darwin-arm.mk +++ b/base/base_i18n.target.darwin-arm.mk @@ -76,7 +76,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -164,7 +163,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_i18n.target.darwin-mips.mk b/base/base_i18n.target.darwin-mips.mk index 06edc88b22..e1a60d0639 100644 --- a/base/base_i18n.target.darwin-mips.mk +++ b/base/base_i18n.target.darwin-mips.mk @@ -75,7 +75,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -162,7 +161,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_i18n.target.darwin-x86.mk b/base/base_i18n.target.darwin-x86.mk index e17d043e8e..4090d58253 100644 --- a/base/base_i18n.target.darwin-x86.mk +++ b/base/base_i18n.target.darwin-x86.mk @@ -78,7 +78,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -169,7 +168,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_i18n.target.linux-arm.mk b/base/base_i18n.target.linux-arm.mk index 81decf1c8a..661a31130e 100644 --- a/base/base_i18n.target.linux-arm.mk +++ b/base/base_i18n.target.linux-arm.mk @@ -76,7 +76,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -164,7 +163,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_i18n.target.linux-mips.mk b/base/base_i18n.target.linux-mips.mk index 06edc88b22..e1a60d0639 100644 --- a/base/base_i18n.target.linux-mips.mk +++ b/base/base_i18n.target.linux-mips.mk @@ -75,7 +75,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -162,7 +161,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_i18n.target.linux-x86.mk b/base/base_i18n.target.linux-x86.mk index e17d043e8e..4090d58253 100644 --- a/base/base_i18n.target.linux-x86.mk +++ b/base/base_i18n.target.linux-x86.mk @@ -78,7 +78,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -169,7 +168,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_activity_state.target.darwin-arm.mk b/base/base_java_activity_state.target.darwin-arm.mk index 9788b2f614..a84201a1d0 100644 --- a/base/base_java_activity_state.target.darwin-arm.mk +++ b/base/base_java_activity_state.target.darwin-arm.mk @@ -77,7 +77,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -157,7 +156,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_activity_state.target.darwin-mips.mk b/base/base_java_activity_state.target.darwin-mips.mk index 4ee3c301a5..18592248a5 100644 --- a/base/base_java_activity_state.target.darwin-mips.mk +++ b/base/base_java_activity_state.target.darwin-mips.mk @@ -76,7 +76,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,7 +154,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_activity_state.target.darwin-x86.mk b/base/base_java_activity_state.target.darwin-x86.mk index c47eb38fc3..e17493d5dd 100644 --- a/base/base_java_activity_state.target.darwin-x86.mk +++ b/base/base_java_activity_state.target.darwin-x86.mk @@ -79,7 +79,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -162,7 +161,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_activity_state.target.linux-arm.mk b/base/base_java_activity_state.target.linux-arm.mk index 9788b2f614..a84201a1d0 100644 --- a/base/base_java_activity_state.target.linux-arm.mk +++ b/base/base_java_activity_state.target.linux-arm.mk @@ -77,7 +77,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -157,7 +156,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_activity_state.target.linux-mips.mk b/base/base_java_activity_state.target.linux-mips.mk index 4ee3c301a5..18592248a5 100644 --- a/base/base_java_activity_state.target.linux-mips.mk +++ b/base/base_java_activity_state.target.linux-mips.mk @@ -76,7 +76,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,7 +154,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_activity_state.target.linux-x86.mk b/base/base_java_activity_state.target.linux-x86.mk index c47eb38fc3..e17493d5dd 100644 --- a/base/base_java_activity_state.target.linux-x86.mk +++ b/base/base_java_activity_state.target.linux-x86.mk @@ -79,7 +79,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -162,7 +161,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_memory_pressure_level_list.target.darwin-arm.mk b/base/base_java_memory_pressure_level_list.target.darwin-arm.mk index de4f0960a5..854a90c6cf 100644 --- a/base/base_java_memory_pressure_level_list.target.darwin-arm.mk +++ b/base/base_java_memory_pressure_level_list.target.darwin-arm.mk @@ -77,7 +77,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -157,7 +156,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_memory_pressure_level_list.target.darwin-mips.mk b/base/base_java_memory_pressure_level_list.target.darwin-mips.mk index d9db736fad..3b20e07ed6 100644 --- a/base/base_java_memory_pressure_level_list.target.darwin-mips.mk +++ b/base/base_java_memory_pressure_level_list.target.darwin-mips.mk @@ -76,7 +76,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,7 +154,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_memory_pressure_level_list.target.darwin-x86.mk b/base/base_java_memory_pressure_level_list.target.darwin-x86.mk index fd94130d4a..2cc92a5b51 100644 --- a/base/base_java_memory_pressure_level_list.target.darwin-x86.mk +++ b/base/base_java_memory_pressure_level_list.target.darwin-x86.mk @@ -79,7 +79,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -162,7 +161,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_memory_pressure_level_list.target.linux-arm.mk b/base/base_java_memory_pressure_level_list.target.linux-arm.mk index de4f0960a5..854a90c6cf 100644 --- a/base/base_java_memory_pressure_level_list.target.linux-arm.mk +++ b/base/base_java_memory_pressure_level_list.target.linux-arm.mk @@ -77,7 +77,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -157,7 +156,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_memory_pressure_level_list.target.linux-mips.mk b/base/base_java_memory_pressure_level_list.target.linux-mips.mk index d9db736fad..3b20e07ed6 100644 --- a/base/base_java_memory_pressure_level_list.target.linux-mips.mk +++ b/base/base_java_memory_pressure_level_list.target.linux-mips.mk @@ -76,7 +76,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,7 +154,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_java_memory_pressure_level_list.target.linux-x86.mk b/base/base_java_memory_pressure_level_list.target.linux-x86.mk index fd94130d4a..2cc92a5b51 100644 --- a/base/base_java_memory_pressure_level_list.target.linux-x86.mk +++ b/base/base_java_memory_pressure_level_list.target.linux-x86.mk @@ -79,7 +79,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -162,7 +161,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_jni_headers.target.darwin-arm.mk b/base/base_jni_headers.target.darwin-arm.mk index 66bf97611e..2f2eddb53f 100644 --- a/base/base_jni_headers.target.darwin-arm.mk +++ b/base/base_jni_headers.target.darwin-arm.mk @@ -210,7 +210,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -290,7 +289,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_jni_headers.target.darwin-mips.mk b/base/base_jni_headers.target.darwin-mips.mk index 2e4a9599ba..bafa26f599 100644 --- a/base/base_jni_headers.target.darwin-mips.mk +++ b/base/base_jni_headers.target.darwin-mips.mk @@ -209,7 +209,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -288,7 +287,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_jni_headers.target.darwin-x86.mk b/base/base_jni_headers.target.darwin-x86.mk index b6004d9548..819af1015c 100644 --- a/base/base_jni_headers.target.darwin-x86.mk +++ b/base/base_jni_headers.target.darwin-x86.mk @@ -212,7 +212,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -295,7 +294,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_jni_headers.target.linux-arm.mk b/base/base_jni_headers.target.linux-arm.mk index 66bf97611e..2f2eddb53f 100644 --- a/base/base_jni_headers.target.linux-arm.mk +++ b/base/base_jni_headers.target.linux-arm.mk @@ -210,7 +210,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -290,7 +289,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_jni_headers.target.linux-mips.mk b/base/base_jni_headers.target.linux-mips.mk index 2e4a9599ba..bafa26f599 100644 --- a/base/base_jni_headers.target.linux-mips.mk +++ b/base/base_jni_headers.target.linux-mips.mk @@ -209,7 +209,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -288,7 +287,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_jni_headers.target.linux-x86.mk b/base/base_jni_headers.target.linux-x86.mk index b6004d9548..819af1015c 100644 --- a/base/base_jni_headers.target.linux-x86.mk +++ b/base/base_jni_headers.target.linux-x86.mk @@ -212,7 +212,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -295,7 +294,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_prefs.target.darwin-arm.mk b/base/base_prefs.target.darwin-arm.mk index b6979f29f0..effb9962aa 100644 --- a/base/base_prefs.target.darwin-arm.mk +++ b/base/base_prefs.target.darwin-arm.mk @@ -74,7 +74,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -157,7 +156,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_prefs.target.darwin-mips.mk b/base/base_prefs.target.darwin-mips.mk index 8d64cb56f1..ff61157a5a 100644 --- a/base/base_prefs.target.darwin-mips.mk +++ b/base/base_prefs.target.darwin-mips.mk @@ -73,7 +73,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,7 +154,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_prefs.target.darwin-x86.mk b/base/base_prefs.target.darwin-x86.mk index 77334a5348..1a3a8f9f09 100644 --- a/base/base_prefs.target.darwin-x86.mk +++ b/base/base_prefs.target.darwin-x86.mk @@ -76,7 +76,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -162,7 +161,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_prefs.target.linux-arm.mk b/base/base_prefs.target.linux-arm.mk index b6979f29f0..effb9962aa 100644 --- a/base/base_prefs.target.linux-arm.mk +++ b/base/base_prefs.target.linux-arm.mk @@ -74,7 +74,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -157,7 +156,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_prefs.target.linux-mips.mk b/base/base_prefs.target.linux-mips.mk index 8d64cb56f1..ff61157a5a 100644 --- a/base/base_prefs.target.linux-mips.mk +++ b/base/base_prefs.target.linux-mips.mk @@ -73,7 +73,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,7 +154,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_prefs.target.linux-x86.mk b/base/base_prefs.target.linux-x86.mk index 77334a5348..1a3a8f9f09 100644 --- a/base/base_prefs.target.linux-x86.mk +++ b/base/base_prefs.target.linux-x86.mk @@ -76,7 +76,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -162,7 +161,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_static.target.darwin-arm.mk b/base/base_static.target.darwin-arm.mk index 6428454ebe..2c941b0378 100644 --- a/base/base_static.target.darwin-arm.mk +++ b/base/base_static.target.darwin-arm.mk @@ -61,7 +61,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -142,7 +141,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_static.target.darwin-mips.mk b/base/base_static.target.darwin-mips.mk index 79ae3e6028..c7cf9193bc 100644 --- a/base/base_static.target.darwin-mips.mk +++ b/base/base_static.target.darwin-mips.mk @@ -60,7 +60,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -140,7 +139,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_static.target.darwin-x86.mk b/base/base_static.target.darwin-x86.mk index 3272f0b4ac..c9244729ec 100644 --- a/base/base_static.target.darwin-x86.mk +++ b/base/base_static.target.darwin-x86.mk @@ -63,7 +63,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -147,7 +146,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_static.target.linux-arm.mk b/base/base_static.target.linux-arm.mk index 6428454ebe..2c941b0378 100644 --- a/base/base_static.target.linux-arm.mk +++ b/base/base_static.target.linux-arm.mk @@ -61,7 +61,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -142,7 +141,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_static.target.linux-mips.mk b/base/base_static.target.linux-mips.mk index 79ae3e6028..c7cf9193bc 100644 --- a/base/base_static.target.linux-mips.mk +++ b/base/base_static.target.linux-mips.mk @@ -60,7 +60,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -140,7 +139,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/base_static.target.linux-x86.mk b/base/base_static.target.linux-x86.mk index 3272f0b4ac..c9244729ec 100644 --- a/base/base_static.target.linux-x86.mk +++ b/base/base_static.target.linux-x86.mk @@ -63,7 +63,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -147,7 +146,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/callback_registry.h b/base/callback_registry.h index fcacbf549f..dcdeb81d01 100644 --- a/base/callback_registry.h +++ b/base/callback_registry.h @@ -1,3 +1,8 @@ +// This file was GENERATED by command: +// pump.py callback_registry.h.pump +// DO NOT EDIT BY HAND!!! + + // Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +14,7 @@ #include "base/basictypes.h" #include "base/callback.h" +#include "base/callback_internal.h" #include "base/compiler_specific.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -28,8 +34,8 @@ // // typedef base::Callback<void(const Foo&)> OnFooCallback; // -// scoped_ptr<base::CallbackRegistry<Foo>::Subscription> RegisterCallback( -// const OnFooCallback& cb) { +// scoped_ptr<base::CallbackRegistry<void(const Foo&)>::Subscription> +// RegisterCallback(const OnFooCallback& cb) { // return callback_registry_.Add(cb); // } // @@ -38,7 +44,7 @@ // callback_registry_.Notify(foo); // } // -// base::CallbackRegistry<Foo> callback_registry_; +// base::CallbackRegistry<void(const Foo&)> callback_registry_; // }; // // @@ -59,7 +65,8 @@ // // Do something. // } // -// scoped_ptr<base::CallbackRegistry<Foo>::Subscription> foo_subscription_; +// scoped_ptr<base::CallbackRegistry<void(const Foo&)>::Subscription> +// foo_subscription_; // }; namespace base { @@ -173,37 +180,199 @@ class CallbackRegistryBase { } // namespace internal -template <typename Details> -class CallbackRegistry - : public internal::CallbackRegistryBase<Callback<void(const Details&)> > { +template <typename Sig> class CallbackRegistry; + +template <> +class CallbackRegistry<void(void)> + : public internal::CallbackRegistryBase<Callback<void(void)> > { public: + typedef Callback<void(void)> CallbackType; + CallbackRegistry() {} - // Execute all active callbacks with |details| parameter. - void Notify(const Details& details) { - typename internal::CallbackRegistryBase< - Callback<void(const Details&)> >::Iterator it = this->GetIterator(); - Callback<void(const Details&)>* cb; + void Notify() { + internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); + CallbackType* cb; while((cb = it.GetNext()) != NULL) { - cb->Run(details); + cb->Run(); } } -private: + private: DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); }; -template <> class CallbackRegistry<void> - : public internal::CallbackRegistryBase<Closure> { +template <typename A1> +class CallbackRegistry<void(A1)> + : public internal::CallbackRegistryBase< + Callback<void(A1)> > { public: + typedef Callback<void(A1)> CallbackType; + CallbackRegistry() {} - // Execute all active callbacks. - void Notify() { - Iterator it = this->GetIterator(); - Closure* cb; + void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1) { + typename internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); + CallbackType* cb; while((cb = it.GetNext()) != NULL) { - cb->Run(); + cb->Run(a1); + } + } + + private: + DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); +}; + +template <typename A1, typename A2> +class CallbackRegistry<void(A1, A2)> + : public internal::CallbackRegistryBase< + Callback<void(A1, A2)> > { + public: + typedef Callback<void(A1, A2)> CallbackType; + + CallbackRegistry() {} + + void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, + typename internal::CallbackParamTraits<A2>::ForwardType a2) { + typename internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); + CallbackType* cb; + while((cb = it.GetNext()) != NULL) { + cb->Run(a1, a2); + } + } + + private: + DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); +}; + +template <typename A1, typename A2, typename A3> +class CallbackRegistry<void(A1, A2, A3)> + : public internal::CallbackRegistryBase< + Callback<void(A1, A2, A3)> > { + public: + typedef Callback<void(A1, A2, A3)> CallbackType; + + CallbackRegistry() {} + + void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, + typename internal::CallbackParamTraits<A2>::ForwardType a2, + typename internal::CallbackParamTraits<A3>::ForwardType a3) { + typename internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); + CallbackType* cb; + while((cb = it.GetNext()) != NULL) { + cb->Run(a1, a2, a3); + } + } + + private: + DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); +}; + +template <typename A1, typename A2, typename A3, typename A4> +class CallbackRegistry<void(A1, A2, A3, A4)> + : public internal::CallbackRegistryBase< + Callback<void(A1, A2, A3, A4)> > { + public: + typedef Callback<void(A1, A2, A3, A4)> CallbackType; + + CallbackRegistry() {} + + void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, + typename internal::CallbackParamTraits<A2>::ForwardType a2, + typename internal::CallbackParamTraits<A3>::ForwardType a3, + typename internal::CallbackParamTraits<A4>::ForwardType a4) { + typename internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); + CallbackType* cb; + while((cb = it.GetNext()) != NULL) { + cb->Run(a1, a2, a3, a4); + } + } + + private: + DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); +}; + +template <typename A1, typename A2, typename A3, typename A4, typename A5> +class CallbackRegistry<void(A1, A2, A3, A4, A5)> + : public internal::CallbackRegistryBase< + Callback<void(A1, A2, A3, A4, A5)> > { + public: + typedef Callback<void(A1, A2, A3, A4, A5)> CallbackType; + + CallbackRegistry() {} + + void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, + typename internal::CallbackParamTraits<A2>::ForwardType a2, + typename internal::CallbackParamTraits<A3>::ForwardType a3, + typename internal::CallbackParamTraits<A4>::ForwardType a4, + typename internal::CallbackParamTraits<A5>::ForwardType a5) { + typename internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); + CallbackType* cb; + while((cb = it.GetNext()) != NULL) { + cb->Run(a1, a2, a3, a4, a5); + } + } + + private: + DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); +}; + +template <typename A1, typename A2, typename A3, typename A4, typename A5, + typename A6> +class CallbackRegistry<void(A1, A2, A3, A4, A5, A6)> + : public internal::CallbackRegistryBase< + Callback<void(A1, A2, A3, A4, A5, A6)> > { + public: + typedef Callback<void(A1, A2, A3, A4, A5, A6)> CallbackType; + + CallbackRegistry() {} + + void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, + typename internal::CallbackParamTraits<A2>::ForwardType a2, + typename internal::CallbackParamTraits<A3>::ForwardType a3, + typename internal::CallbackParamTraits<A4>::ForwardType a4, + typename internal::CallbackParamTraits<A5>::ForwardType a5, + typename internal::CallbackParamTraits<A6>::ForwardType a6) { + typename internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); + CallbackType* cb; + while((cb = it.GetNext()) != NULL) { + cb->Run(a1, a2, a3, a4, a5, a6); + } + } + + private: + DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); +}; + +template <typename A1, typename A2, typename A3, typename A4, typename A5, + typename A6, typename A7> +class CallbackRegistry<void(A1, A2, A3, A4, A5, A6, A7)> + : public internal::CallbackRegistryBase< + Callback<void(A1, A2, A3, A4, A5, A6, A7)> > { + public: + typedef Callback<void(A1, A2, A3, A4, A5, A6, A7)> CallbackType; + + CallbackRegistry() {} + + void Notify(typename internal::CallbackParamTraits<A1>::ForwardType a1, + typename internal::CallbackParamTraits<A2>::ForwardType a2, + typename internal::CallbackParamTraits<A3>::ForwardType a3, + typename internal::CallbackParamTraits<A4>::ForwardType a4, + typename internal::CallbackParamTraits<A5>::ForwardType a5, + typename internal::CallbackParamTraits<A6>::ForwardType a6, + typename internal::CallbackParamTraits<A7>::ForwardType a7) { + typename internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); + CallbackType* cb; + while((cb = it.GetNext()) != NULL) { + cb->Run(a1, a2, a3, a4, a5, a6, a7); } } @@ -213,4 +382,4 @@ template <> class CallbackRegistry<void> } // namespace base -#endif // BASE_CALLBACK_REGISTRY_H_ +#endif // BASE_CALLBACK_REGISTRY_H diff --git a/base/callback_registry.h.pump b/base/callback_registry.h.pump new file mode 100644 index 0000000000..fff1dc89e7 --- /dev/null +++ b/base/callback_registry.h.pump @@ -0,0 +1,243 @@ +$$ This is a pump file for generating file templates. Pump is a python +$$ script that is part of the Google Test suite of utilities. Description +$$ can be found here: +$$ +$$ http://code.google.com/p/googletest/wiki/PumpManual +$$ + +$$ See comment for MAX_ARITY in base/bind.h.pump. +$var MAX_ARITY = 7 + +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_CALLBACK_REGISTRY_H_ +#define BASE_CALLBACK_REGISTRY_H_ + +#include <list> + +#include "base/basictypes.h" +#include "base/callback.h" +#include "base/callback_internal.h" +#include "base/compiler_specific.h" +#include "base/logging.h" +#include "base/memory/scoped_ptr.h" + +// OVERVIEW: +// +// A container for a list of callbacks. Unlike a normal STL vector or list, +// this container can be modified during iteration without invalidating the +// iterator. It safely handles the case of a callback removing itself +// or another callback from the list while callbacks are being run. +// +// TYPICAL USAGE: +// +// class MyWidget { +// public: +// ... +// +// typedef base::Callback<void(const Foo&)> OnFooCallback; +// +// scoped_ptr<base::CallbackRegistry<void(const Foo&)>::Subscription> +// RegisterCallback(const OnFooCallback& cb) { +// return callback_registry_.Add(cb); +// } +// +// private: +// void NotifyFoo(const Foo& foo) { +// callback_registry_.Notify(foo); +// } +// +// base::CallbackRegistry<void(const Foo&)> callback_registry_; +// }; +// +// +// class MyWidgetListener { +// public: +// MyWidgetListener::MyWidgetListener() { +// foo_subscription_ = MyWidget::GetCurrent()->RegisterCallback( +// base::Bind(&MyWidgetListener::OnFoo, this))); +// } +// +// MyWidgetListener::~MyWidgetListener() { +// // Subscription gets deleted automatically and will deregister +// // the callback in the process. +// } +// +// private: +// void OnFoo(const Foo& foo) { +// // Do something. +// } +// +// scoped_ptr<base::CallbackRegistry<Foo>::Subscription> foo_subscription_; +// }; + +namespace base { + +namespace internal { + +template <typename CallbackType> +class CallbackRegistryBase { + public: + class Subscription { + public: + Subscription(CallbackRegistryBase<CallbackType>* list, + typename std::list<CallbackType>::iterator iter) + : list_(list), + iter_(iter) {} + + ~Subscription() { + if (list_->active_iterator_count_) + (*iter_).Reset(); + else + list_->callbacks_.erase(iter_); + } + + private: + CallbackRegistryBase<CallbackType>* list_; + typename std::list<CallbackType>::iterator iter_; + + DISALLOW_COPY_AND_ASSIGN(Subscription); + }; + + // Add a callback to the list. The callback will remain registered until the + // returned Subscription is destroyed, which must occur before the + // CallbackRegistry is destroyed. + scoped_ptr<Subscription> Add(const CallbackType& cb) { + DCHECK(!cb.is_null()); + return scoped_ptr<Subscription>( + new Subscription(this, callbacks_.insert(callbacks_.end(), cb))); + } + + protected: + // An iterator class that can be used to access the list of callbacks. + class Iterator { + public: + explicit Iterator(CallbackRegistryBase<CallbackType>* list) + : list_(list), + list_iter_(list_->callbacks_.begin()) { + ++list_->active_iterator_count_; + } + + Iterator(const Iterator& iter) + : list_(iter.list_), + list_iter_(iter.list_iter_) { + ++list_->active_iterator_count_; + } + + ~Iterator() { + if (list_ && --list_->active_iterator_count_ == 0) { + list_->Compact(); + } + } + + CallbackType* GetNext() { + while ((list_iter_ != list_->callbacks_.end()) && list_iter_->is_null()) + ++list_iter_; + + CallbackType* cb = NULL; + if (list_iter_ != list_->callbacks_.end()) { + cb = &(*list_iter_); + ++list_iter_; + } + return cb; + } + + private: + CallbackRegistryBase<CallbackType>* list_; + typename std::list<CallbackType>::iterator list_iter_; + }; + + CallbackRegistryBase() + : active_iterator_count_(0) {} + + ~CallbackRegistryBase() { + DCHECK_EQ(0, active_iterator_count_); + DCHECK_EQ(0U, callbacks_.size()); + } + + // Returns an instance of a CallbackRegistryBase::Iterator which can be used + // to run callbacks. + Iterator GetIterator() { + return Iterator(this); + } + + // Compact the list: remove any entries which were NULLed out during + // iteration. + void Compact() { + typename std::list<CallbackType>::iterator it = callbacks_.begin(); + while (it != callbacks_.end()) { + if ((*it).is_null()) + it = callbacks_.erase(it); + else + ++it; + } + } + + private: + std::list<CallbackType> callbacks_; + int active_iterator_count_; + + DISALLOW_COPY_AND_ASSIGN(CallbackRegistryBase); +}; + +} // namespace internal + +template <typename Sig> class CallbackRegistry; + + +$range ARITY 0..MAX_ARITY +$for ARITY [[ +$range ARG 1..ARITY + +$if ARITY == 0 [[ +template <> +class CallbackRegistry<void(void)> + : public internal::CallbackRegistryBase<Callback<void(void)> > { +]] $else [[ +template <$for ARG , [[typename A$(ARG)]]> +class CallbackRegistry<void($for ARG , [[A$(ARG)]])> + : public internal::CallbackRegistryBase< + Callback<void($for ARG , [[A$(ARG)]])> > { +]] + + public: +$if ARITY == 0 [[ + + typedef Callback<void(void)> CallbackType; +]] $else [[ + + typedef Callback<void($for ARG , [[A$(ARG)]])> CallbackType; +]] + + + CallbackRegistry() {} + + void Notify($for ARG , + [[typename internal::CallbackParamTraits<A$(ARG)>::ForwardType a$(ARG)]]) { +$if ARITY == 0 [[ + + internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); +]] $else [[ + + typename internal::CallbackRegistryBase<CallbackType>::Iterator it = + this->GetIterator(); +]] + + CallbackType* cb; + while((cb = it.GetNext()) != NULL) { + cb->Run($for ARG , [[a$(ARG)]]); + } + } + + private: + DISALLOW_COPY_AND_ASSIGN(CallbackRegistry); +}; + + +]] $$ for ARITY +} // namespace base + +#endif // BASE_CALLBACK_REGISTRY_H diff --git a/base/callback_registry_unittest.cc b/base/callback_registry_unittest.cc index 3459c073f1..826aa0da6f 100644 --- a/base/callback_registry_unittest.cc +++ b/base/callback_registry_unittest.cc @@ -18,7 +18,7 @@ class Listener { Listener() : total_(0), scaler_(1) {} explicit Listener(int scaler) : total_(0), scaler_(scaler) {} void IncrementTotal() { total_++; } - void IncrementByMultipleOfScaler(const int& x) { total_ += x * scaler_; } + void IncrementByMultipleOfScaler(int x) { total_ += x * scaler_; } int total_; @@ -35,20 +35,20 @@ class Remover { removal_subscription_.reset(); } void SetSubscriptionToRemove( - scoped_ptr<CallbackRegistry<void>::Subscription> sub) { + scoped_ptr<CallbackRegistry<void(void)>::Subscription> sub) { removal_subscription_ = sub.Pass(); } int total_; private: - scoped_ptr<CallbackRegistry<void>::Subscription> removal_subscription_; + scoped_ptr<CallbackRegistry<void(void)>::Subscription> removal_subscription_; DISALLOW_COPY_AND_ASSIGN(Remover); }; class Adder { public: - explicit Adder(CallbackRegistry<void>* cb_reg) + explicit Adder(CallbackRegistry<void(void)>* cb_reg) : added_(false), total_(0), cb_reg_(cb_reg) {} @@ -65,20 +65,88 @@ class Adder { int total_; private: - CallbackRegistry<void>* cb_reg_; - scoped_ptr<CallbackRegistry<void>::Subscription> subscription_; + CallbackRegistry<void(void)>* cb_reg_; + scoped_ptr<CallbackRegistry<void(void)>::Subscription> subscription_; DISALLOW_COPY_AND_ASSIGN(Adder); }; +class Summer { + public: + Summer() : value_(0) {} + + void AddOneParam(int a) { value_ = a; } + void AddTwoParam(int a, int b) { value_ = a + b; } + void AddThreeParam(int a, int b, int c) { value_ = a + b + c; } + void AddFourParam(int a, int b, int c, int d) { value_ = a + b + c + d; } + void AddFiveParam(int a, int b, int c, int d, int e) { + value_ = a + b + c + d + e; + } + void AddSixParam(int a, int b, int c, int d, int e , int f) { + value_ = a + b + c + d + e + f; + } + + int value_; + + private: + DISALLOW_COPY_AND_ASSIGN(Summer); +}; + +// Sanity check that we can instantiate a CallbackRegistry for each arity. +TEST(CallbackRegistryTest, ArityTest) { + Summer s; + + CallbackRegistry<void(int)> c1; + scoped_ptr<CallbackRegistry<void(int)>::Subscription> subscription1 = + c1.Add(Bind(&Summer::AddOneParam, Unretained(&s))); + + c1.Notify(1); + EXPECT_EQ(1, s.value_); + + CallbackRegistry<void(int, int)> c2; + scoped_ptr<CallbackRegistry<void(int, int)>::Subscription> subscription2 = + c2.Add(Bind(&Summer::AddTwoParam, Unretained(&s))); + + c2.Notify(1, 2); + EXPECT_EQ(3, s.value_); + + CallbackRegistry<void(int, int, int)> c3; + scoped_ptr<CallbackRegistry<void(int, int, int)>::Subscription> + subscription3 = c3.Add(Bind(&Summer::AddThreeParam, Unretained(&s))); + + c3.Notify(1, 2, 3); + EXPECT_EQ(6, s.value_); + + CallbackRegistry<void(int, int, int, int)> c4; + scoped_ptr<CallbackRegistry<void(int, int, int, int)>::Subscription> + subscription4 = c4.Add(Bind(&Summer::AddFourParam, Unretained(&s))); + + c4.Notify(1, 2, 3, 4); + EXPECT_EQ(10, s.value_); + + CallbackRegistry<void(int, int, int, int, int)> c5; + scoped_ptr<CallbackRegistry<void(int, int, int, int, int)>::Subscription> + subscription5 = c5.Add(Bind(&Summer::AddFiveParam, Unretained(&s))); + + c5.Notify(1, 2, 3, 4, 5); + EXPECT_EQ(15, s.value_); + + CallbackRegistry<void(int, int, int, int, int, int)> c6; + scoped_ptr<CallbackRegistry<void(int, int, int, int, int, int)>::Subscription> + subscription6 = c6.Add(Bind(&Summer::AddSixParam, Unretained(&s))); + + c6.Notify(1, 2, 3, 4, 5, 6); + EXPECT_EQ(21, s.value_); +} + // Sanity check that closures added to the list will be run, and those removed // from the list will not be run. TEST(CallbackRegistryTest, BasicTest) { - CallbackRegistry<void> cb_reg; + CallbackRegistry<void(void)> cb_reg; Listener a, b, c; - scoped_ptr<CallbackRegistry<void>::Subscription> a_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription = cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&a))); - scoped_ptr<CallbackRegistry<void>::Subscription> b_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription = cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b))); EXPECT_TRUE(a_subscription.get()); @@ -91,7 +159,7 @@ TEST(CallbackRegistryTest, BasicTest) { b_subscription.reset(); - scoped_ptr<CallbackRegistry<void>::Subscription> c_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> c_subscription = cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&c))); cb_reg.Notify(); @@ -108,12 +176,12 @@ TEST(CallbackRegistryTest, BasicTest) { // Sanity check that callbacks with details added to the list will be run, with // the correct details, and those removed from the list will not be run. TEST(CallbackRegistryTest, BasicTestWithParams) { - CallbackRegistry<int> cb_reg; + CallbackRegistry<void(int)> cb_reg; Listener a(1), b(-1), c(1); - scoped_ptr<CallbackRegistry<int>::Subscription> a_subscription = + scoped_ptr<CallbackRegistry<void(int)>::Subscription> a_subscription = cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&a))); - scoped_ptr<CallbackRegistry<int>::Subscription> b_subscription = + scoped_ptr<CallbackRegistry<void(int)>::Subscription> b_subscription = cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&b))); EXPECT_TRUE(a_subscription.get()); @@ -126,7 +194,7 @@ TEST(CallbackRegistryTest, BasicTestWithParams) { b_subscription.reset(); - scoped_ptr<CallbackRegistry<int>::Subscription> c_subscription = + scoped_ptr<CallbackRegistry<void(int)>::Subscription> c_subscription = cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&c))); cb_reg.Notify(10); @@ -143,23 +211,23 @@ TEST(CallbackRegistryTest, BasicTestWithParams) { // Test the a callback can remove itself or a different callback from the list // during iteration without invalidating the iterator. TEST(CallbackRegistryTest, RemoveCallbacksDuringIteration) { - CallbackRegistry<void> cb_reg; + CallbackRegistry<void(void)> cb_reg; Listener a, b; Remover remover_1, remover_2; - scoped_ptr<CallbackRegistry<void>::Subscription> remover_1_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> remover_1_sub = cb_reg.Add(Bind(&Remover::IncrementTotalAndRemove, Unretained(&remover_1))); - scoped_ptr<CallbackRegistry<void>::Subscription> remover_2_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> remover_2_sub = cb_reg.Add(Bind(&Remover::IncrementTotalAndRemove, Unretained(&remover_2))); - scoped_ptr<CallbackRegistry<void>::Subscription> a_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription = cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&a))); - scoped_ptr<CallbackRegistry<void>::Subscription> b_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription = cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b))); // |remover_1| will remove itself. - remover_1.SetSubscriptionToRemove(remover_1_subscription.Pass()); + remover_1.SetSubscriptionToRemove(remover_1_sub.Pass()); // |remover_2| will remove a. remover_2.SetSubscriptionToRemove(a_subscription.Pass()); @@ -185,12 +253,12 @@ TEST(CallbackRegistryTest, RemoveCallbacksDuringIteration) { // without invalidating the iterator. The newly added callback should be run on // the current iteration as will all other callbacks in the list. TEST(CallbackRegistryTest, AddCallbacksDuringIteration) { - CallbackRegistry<void> cb_reg; + CallbackRegistry<void(void)> cb_reg; Adder a(&cb_reg); Listener b; - scoped_ptr<CallbackRegistry<void>::Subscription> a_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription = cb_reg.Add(Bind(&Adder::AddCallback, Unretained(&a))); - scoped_ptr<CallbackRegistry<void>::Subscription> b_subscription = + scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription = cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b))); cb_reg.Notify(); @@ -207,7 +275,7 @@ TEST(CallbackRegistryTest, AddCallbacksDuringIteration) { // Sanity check: notifying an empty list is a no-op. TEST(CallbackRegistryTest, EmptyList) { - CallbackRegistry<void> cb_reg; + CallbackRegistry<void(void)> cb_reg; cb_reg.Notify(); } diff --git a/base/callback_registry_unittest.nc b/base/callback_registry_unittest.nc new file mode 100644 index 0000000000..d67ad81b17 --- /dev/null +++ b/base/callback_registry_unittest.nc @@ -0,0 +1,51 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/callback_registry.h" + +#include "base/basictypes.h" +#include "base/bind.h" +#include "base/bind_helpers.h" +#include "base/memory/scoped_ptr.h" + +namespace base { + +class Foo { + public: + Foo() {} + ~Foo() {} +}; + +class FooListener { + public: + FooListener() {} + + void GotAScopedFoo(scoped_ptr<Foo> f) { foo_ = f.Pass(); } + + scoped_ptr<Foo> foo_; + + private: + DISALLOW_COPY_AND_ASSIGN(FooListener); +}; + + +#if defined(NCTEST_MOVE_ONLY_TYPE_PARAMETER) // [r"calling a private constructor of class"] + +// Callbacks run with a move-only typed parameter. +// +// CallbackRegistry does not support move-only typed parameters. Notify() is +// designed to take zero or more parameters, and run each registered callback +// with them. With move-only types, the parameter will be set to NULL after the +// first callback has been run. +void WontCompile() { + FooListener f; + CallbackRegistry<void(scoped_ptr<Foo>)> c1; + scoped_ptr<CallbackRegistry<void(scoped_ptr<Foo>)>::Subscription> sub = + c1.Add(Bind(&FooListener::GotAScopedFoo, Unretained(&f))); + c1.Notify(scoped_ptr<Foo>(new Foo())); +} + +#endif + +} // namespace base diff --git a/base/command_line.cc b/base/command_line.cc index 36ac88f12c..7050242e67 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -27,17 +27,22 @@ CommandLine* CommandLine::current_process_commandline_ = NULL; namespace { const CommandLine::CharType kSwitchTerminator[] = FILE_PATH_LITERAL("--"); const CommandLine::CharType kSwitchValueSeparator[] = FILE_PATH_LITERAL("="); + // Since we use a lazy match, make sure that longer versions (like "--") are // listed before shorter versions (like "-") of similar prefixes. #if defined(OS_WIN) +// By putting slash last, we can control whether it is treaded as a switch +// value by changing the value of switch_prefix_count to be one less than +// the array size. const CommandLine::CharType* const kSwitchPrefixes[] = {L"--", L"-", L"/"}; #elif defined(OS_POSIX) // Unixes don't use slash as a switch. const CommandLine::CharType* const kSwitchPrefixes[] = {"--", "-"}; #endif +size_t switch_prefix_count = arraysize(kSwitchPrefixes); size_t GetSwitchPrefixLength(const CommandLine::StringType& string) { - for (size_t i = 0; i < arraysize(kSwitchPrefixes); ++i) { + for (size_t i = 0; i < switch_prefix_count; ++i) { CommandLine::StringType prefix(kSwitchPrefixes[i]); if (string.compare(0, prefix.length(), prefix) == 0) return prefix.length(); @@ -169,6 +174,15 @@ CommandLine::CommandLine(const StringVector& argv) CommandLine::~CommandLine() { } +#if defined(OS_WIN) +// static +void CommandLine::set_slash_is_not_a_switch() { + // The last switch prefix should be slash, so adjust the size to skip it. + DCHECK(wcscmp(kSwitchPrefixes[arraysize(kSwitchPrefixes) - 1], L"/") == 0); + switch_prefix_count = arraysize(kSwitchPrefixes) - 1; +} +#endif + // static bool CommandLine::Init(int argc, const char* const* argv) { if (current_process_commandline_) { diff --git a/base/command_line.h b/base/command_line.h index ed46c4f0d1..81bd4b7376 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -53,6 +53,17 @@ class BASE_EXPORT CommandLine { ~CommandLine(); +#if defined(OS_WIN) + // By default this class will treat command-line arguments beginning with + // slashes as switches on Windows, but not other platforms. + // + // If this behavior is inappropriate for your application, you can call this + // function BEFORE initializing the current process' global command line + // object and the behavior will be the same as Posix systems (only hyphens + // begin switches, everything else will be an arg). + static void set_slash_is_not_a_switch(); +#endif + // Initialize the current process CommandLine singleton. On Windows, ignores // its arguments (we instead parse GetCommandLineW() directly) because we // don't trust the CRT's parsing of the command line, but it still must be diff --git a/base/file_util.cc b/base/file_util.cc index e980676385..308b150a1d 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -23,8 +23,6 @@ namespace base { namespace { -const FilePath::CharType kExtensionSeparator = FILE_PATH_LITERAL('.'); - // The maximum number of 'uniquified' files we will try to create. // This is used when the filename we're trying to download is already in use, // so we create a new unique filename by appending " (nnn)" before the @@ -157,7 +155,6 @@ namespace file_util { using base::FileEnumerator; using base::FilePath; -using base::kExtensionSeparator; using base::kMaxUniqueFiles; bool IsDirectoryEmpty(const FilePath& dir_path) { diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index 787b6d50ba..1ca70b4f89 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -244,108 +244,6 @@ uint64 FileTimeAsUint64(const FILETIME& ft) { } #endif -const struct append_case { - const wchar_t* path; - const wchar_t* ending; - const wchar_t* result; -} append_cases[] = { -#if defined(OS_WIN) - {L"c:\\colon\\backslash", L"path", L"c:\\colon\\backslash\\path"}, - {L"c:\\colon\\backslash\\", L"path", L"c:\\colon\\backslash\\path"}, - {L"c:\\colon\\backslash\\\\", L"path", L"c:\\colon\\backslash\\\\path"}, - {L"c:\\colon\\backslash\\", L"", L"c:\\colon\\backslash\\"}, - {L"c:\\colon\\backslash", L"", L"c:\\colon\\backslash\\"}, - {L"", L"path", L"\\path"}, - {L"", L"", L"\\"}, -#elif defined(OS_POSIX) - {L"/foo/bar", L"path", L"/foo/bar/path"}, - {L"/foo/bar/", L"path", L"/foo/bar/path"}, - {L"/foo/bar//", L"path", L"/foo/bar//path"}, - {L"/foo/bar/", L"", L"/foo/bar/"}, - {L"/foo/bar", L"", L"/foo/bar/"}, - {L"", L"path", L"/path"}, - {L"", L"", L"/"}, -#endif -}; - -static const struct filename_case { - const wchar_t* path; - const wchar_t* filename; -} filename_cases[] = { -#if defined(OS_WIN) - {L"c:\\colon\\backslash", L"backslash"}, - {L"c:\\colon\\backslash\\", L""}, - {L"\\\\filename.exe", L"filename.exe"}, - {L"filename.exe", L"filename.exe"}, - {L"", L""}, - {L"\\\\\\", L""}, - {L"c:/colon/backslash", L"backslash"}, - {L"c:/colon/backslash/", L""}, - {L"//////", L""}, - {L"///filename.exe", L"filename.exe"}, -#elif defined(OS_POSIX) - {L"/foo/bar", L"bar"}, - {L"/foo/bar/", L""}, - {L"/filename.exe", L"filename.exe"}, - {L"filename.exe", L"filename.exe"}, - {L"", L""}, - {L"/", L""}, -#endif -}; - -// Test finding the file type from a path name -static const struct extension_case { - const wchar_t* path; - const wchar_t* extension; -} extension_cases[] = { -#if defined(OS_WIN) - {L"C:\\colon\\backslash\\filename.extension", L"extension"}, - {L"C:\\colon\\backslash\\filename.", L""}, - {L"C:\\colon\\backslash\\filename", L""}, - {L"C:\\colon\\backslash\\", L""}, - {L"C:\\colon\\backslash.\\", L""}, - {L"C:\\colon\\backslash\filename.extension.extension2", L"extension2"}, -#elif defined(OS_POSIX) - {L"/foo/bar/filename.extension", L"extension"}, - {L"/foo/bar/filename.", L""}, - {L"/foo/bar/filename", L""}, - {L"/foo/bar/", L""}, - {L"/foo/bar./", L""}, - {L"/foo/bar/filename.extension.extension2", L"extension2"}, - {L".", L""}, - {L"..", L""}, - {L"./foo", L""}, - {L"./foo.extension", L"extension"}, - {L"/foo.extension1/bar.extension2", L"extension2"}, -#endif -}; - -// Test finding the directory component of a path -static const struct dir_case { - const wchar_t* full_path; - const wchar_t* directory; -} dir_cases[] = { -#if defined(OS_WIN) - {L"C:\\WINDOWS\\system32\\gdi32.dll", L"C:\\WINDOWS\\system32"}, - {L"C:\\WINDOWS\\system32\\not_exist_thx_1138", L"C:\\WINDOWS\\system32"}, - {L"C:\\WINDOWS\\system32\\", L"C:\\WINDOWS\\system32"}, - {L"C:\\WINDOWS\\system32\\\\", L"C:\\WINDOWS\\system32"}, - {L"C:\\WINDOWS\\system32", L"C:\\WINDOWS"}, - {L"C:\\WINDOWS\\system32.\\", L"C:\\WINDOWS\\system32."}, - {L"C:\\", L"C:\\"}, -#elif defined(OS_POSIX) - {L"/foo/bar/gdi32.dll", L"/foo/bar"}, - {L"/foo/bar/not_exist_thx_1138", L"/foo/bar"}, - {L"/foo/bar/", L"/foo/bar"}, - {L"/foo/bar//", L"/foo/bar"}, - {L"/foo/bar", L"/foo"}, - {L"/foo/bar./", L"/foo/bar."}, - {L"/", L"/"}, - {L".", L"."}, - {L"..", L"."}, // yes, ".." technically lives in "." -#endif -}; - TEST_F(FileUtilTest, FileAndDirectorySize) { // Create three files of 20, 30 and 3 chars (utf8). ComputeDirectorySize // should return 53 bytes. diff --git a/base/logging.h b/base/logging.h index 859f2602fc..71f391f8af 100644 --- a/base/logging.h +++ b/base/logging.h @@ -776,7 +776,12 @@ const LogSeverity LOG_DCHECK = LOG_INFO; #define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2) #define DCHECK_GT(val1, val2) DCHECK_OP(GT, > , val1, val2) +#if defined(NDEBUG) && defined(OS_CHROMEOS) +#define NOTREACHED() LOG(ERROR) << "NOTREACHED() hit in " << \ + __FUNCTION__ << ". " +#else #define NOTREACHED() DCHECK(false) +#endif // Redefine the standard assert to use our nice log files #undef assert diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc index e6745ea3a7..efb0caf5bc 100644 --- a/base/memory/shared_memory_posix.cc +++ b/base/memory/shared_memory_posix.cc @@ -34,10 +34,6 @@ namespace base { namespace { -// Paranoia. Semaphores and shared memory segments should live in different -// namespaces, but who knows what's out there. -const char kSemaphoreSuffix[] = "-sem"; - LazyInstance<Lock>::Leaky g_thread_lock_ = LAZY_INSTANCE_INITIALIZER; } diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc index 87a0b63173..7cd22a8765 100644 --- a/base/message_loop/message_loop.cc +++ b/base/message_loop/message_loop.cc @@ -695,12 +695,6 @@ void MessageLoop::ReleaseSoonInternal( //------------------------------------------------------------------------------ // MessageLoopForUI -#if defined(OS_WIN) -void MessageLoopForUI::DidProcessMessage(const MSG& message) { - pump_win()->DidProcessMessage(message); -} -#endif // defined(OS_WIN) - #if defined(OS_ANDROID) void MessageLoopForUI::Start() { // No Histogram support for UI message loop as it is managed by Java side diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index 3520b72516..0eb180352d 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h @@ -586,10 +586,6 @@ class BASE_EXPORT MessageLoopForUI : public MessageLoop { return static_cast<MessageLoopForUI*>(loop); } -#if defined(OS_WIN) - void DidProcessMessage(const MSG& message); -#endif // defined(OS_WIN) - #if defined(OS_IOS) // On iOS, the main message loop cannot be Run(). Instead call Attach(), // which connects this MessageLoop to the UI thread's CFRunLoop and allows diff --git a/base/message_loop/message_loop_unittest.cc b/base/message_loop/message_loop_unittest.cc index ab05b3cb5a..bd464fad9e 100644 --- a/base/message_loop/message_loop_unittest.cc +++ b/base/message_loop/message_loop_unittest.cc @@ -609,7 +609,9 @@ void RunTest_Nesting(MessageLoop::Type message_loop_type) { EXPECT_EQ(depth, 0); } -const wchar_t* const kMessageBoxTitle = L"MessageLoop Unit Test"; +#if defined(OS_WIN) +const wchar_t kMessageBoxTitle[] = L"MessageLoop Unit Test"; +#endif // defined(OS_WIN) enum TaskType { MESSAGEBOX, diff --git a/base/observer_list.h b/base/observer_list.h index b44e33f56c..bd1dc64055 100644 --- a/base/observer_list.h +++ b/base/observer_list.h @@ -203,14 +203,15 @@ class ObserverList : public ObserverListBase<ObserverType> { } }; -#define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \ - do { \ - if ((observer_list).might_have_observers()) { \ - ObserverListBase<ObserverType>::Iterator it(observer_list); \ - ObserverType* obs; \ - while ((obs = it.GetNext()) != NULL) \ - obs->func; \ - } \ +#define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \ + do { \ + if ((observer_list).might_have_observers()) { \ + ObserverListBase<ObserverType>::Iterator \ + it_inside_observer_macro(observer_list); \ + ObserverType* obs; \ + while ((obs = it_inside_observer_macro.GetNext()) != NULL) \ + obs->func; \ + } \ } while (0) #endif // BASE_OBSERVER_LIST_H__ diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc index 046af915b3..198159848e 100644 --- a/base/prefs/pref_service.cc +++ b/base/prefs/pref_service.cc @@ -87,11 +87,6 @@ void PrefService::InitFromStorage(bool async) { } } -bool PrefService::ReloadPersistentPrefs() { - return user_pref_store_->ReadPrefs() == - PersistentPrefStore::PREF_READ_ERROR_NONE; -} - void PrefService::CommitPendingWrite() { DCHECK(CalledOnValidThread()); user_pref_store_->CommitPendingWrite(); diff --git a/base/prefs/pref_service.h b/base/prefs/pref_service.h index 8af042f40b..757be202d7 100644 --- a/base/prefs/pref_service.h +++ b/base/prefs/pref_service.h @@ -150,11 +150,6 @@ class BASE_PREFS_EXPORT PrefService : public base::NonThreadSafe { bool async); virtual ~PrefService(); - // Reloads the data from file. This should only be called when the importer - // is running during first run, and the main process may not change pref - // values while the importer process is running. Returns true on success. - bool ReloadPersistentPrefs(); - // Lands pending writes to disk. This should only be used if we need to save // immediately (basically, during shutdown). void CommitPendingWrite(); diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc index 44be9f4a27..3e723a3b6e 100644 --- a/base/process/process_util_unittest.cc +++ b/base/process/process_util_unittest.cc @@ -54,12 +54,6 @@ using base::FilePath; namespace { -#if defined(OS_WIN) -const wchar_t kProcessName[] = L"base_unittests.exe"; -#else -const wchar_t kProcessName[] = L"base_unittests"; -#endif // defined(OS_WIN) - #if defined(OS_ANDROID) const char kShellPath[] = "/system/bin/sh"; const char kPosixShell[] = "sh"; @@ -69,7 +63,6 @@ const char kPosixShell[] = "bash"; #endif const char kSignalFileSlow[] = "SlowChildProcess.die"; -const char kSignalFileCrash[] = "CrashingChildProcess.die"; const char kSignalFileKill[] = "KilledChildProcess.die"; #if defined(OS_WIN) @@ -221,6 +214,7 @@ TEST_F(ProcessUtilTest, GetProcId) { // TODO(gspencer): turn this test process into a very small program // with no symbols (instead of using the multiprocess testing // framework) to reduce the ReportCrash overhead. +const char kSignalFileCrash[] = "CrashingChildProcess.die"; MULTIPROCESS_TEST_MAIN(CrashingChildProcess) { WaitToDie(ProcessUtilTest::GetSignalFilePath(kSignalFileCrash).c_str()); diff --git a/base/sys_byteorder.h b/base/sys_byteorder.h index 97e33acfda..17b662c58f 100644 --- a/base/sys_byteorder.h +++ b/base/sys_byteorder.h @@ -25,7 +25,7 @@ #include <stdlib.h> #elif defined(OS_MACOSX) #include <libkern/OSByteOrder.h> -#elif defined(OS_OPENBSD) +#elif defined(OS_BSD) #include <sys/endian.h> #else #include <byteswap.h> @@ -42,6 +42,8 @@ inline uint16 ByteSwap(uint16 x) { return OSSwapInt16(x); #elif defined(OS_OPENBSD) return swap16(x); +#elif defined(OS_FREEBSD) + return bswap16(x); #else return bswap_16(x); #endif @@ -53,6 +55,8 @@ inline uint32 ByteSwap(uint32 x) { return OSSwapInt32(x); #elif defined(OS_OPENBSD) return swap32(x); +#elif defined(OS_FREEBSD) + return bswap32(x); #else return bswap_32(x); #endif @@ -64,6 +68,8 @@ inline uint64 ByteSwap(uint64 x) { return OSSwapInt64(x); #elif defined(OS_OPENBSD) return swap64(x); +#elif defined(OS_FREEBSD) + return bswap64(x); #else return bswap_64(x); #endif diff --git a/base/test/parallel_test_launcher.cc b/base/test/parallel_test_launcher.cc index cbcac9a001..0883946bb6 100644 --- a/base/test/parallel_test_launcher.cc +++ b/base/test/parallel_test_launcher.cc @@ -45,9 +45,10 @@ const int kOutputTimeoutSeconds = 15; void RunCallback( const ParallelTestLauncher::LaunchChildGTestProcessCallback& callback, int exit_code, + const TimeDelta& elapsed_time, bool was_timeout, const std::string& output) { - callback.Run(exit_code, was_timeout, output); + callback.Run(exit_code, elapsed_time, was_timeout, output); } void DoLaunchChildTestProcess( @@ -55,6 +56,8 @@ void DoLaunchChildTestProcess( base::TimeDelta timeout, scoped_refptr<MessageLoopProxy> message_loop_proxy, const ParallelTestLauncher::LaunchChildGTestProcessCallback& callback) { + TimeTicks start_time = TimeTicks::Now(); + // Redirect child process output to a file. base::FilePath output_file; CHECK(file_util::CreateTemporaryFile(&output_file)); @@ -107,7 +110,10 @@ void DoLaunchChildTestProcess( std::string output_file_contents; CHECK(base::ReadFileToString(output_file, &output_file_contents)); - CHECK(base::DeleteFile(output_file, false)); + if (!base::DeleteFile(output_file, false)) { + // This needs to be non-fatal at least for Windows. + LOG(WARNING) << "Failed to delete " << output_file.AsUTF8Unsafe(); + } // Run target callback on the thread it was originating from, not on // a worker pool thread. @@ -116,6 +122,7 @@ void DoLaunchChildTestProcess( Bind(&RunCallback, callback, exit_code, + TimeTicks::Now() - start_time, was_timeout, output_file_contents)); } @@ -147,6 +154,43 @@ void ParallelTestLauncher::LaunchChildGTestProcess( const LaunchChildGTestProcessCallback& callback) { DCHECK(thread_checker_.CalledOnValidThread()); + LaunchSequencedChildGTestProcess( + worker_pool_owner_->pool()->GetSequenceToken(), + command_line, + wrapper, + timeout, + callback); +} + +void ParallelTestLauncher::LaunchNamedSequencedChildGTestProcess( + const std::string& token_name, + const CommandLine& command_line, + const std::string& wrapper, + base::TimeDelta timeout, + const LaunchChildGTestProcessCallback& callback) { + DCHECK(thread_checker_.CalledOnValidThread()); + + LaunchSequencedChildGTestProcess( + worker_pool_owner_->pool()->GetNamedSequenceToken(token_name), + command_line, + wrapper, + timeout, + callback); +} + +void ParallelTestLauncher::ResetOutputWatchdog() { + DCHECK(thread_checker_.CalledOnValidThread()); + timer_.Reset(); +} + +void ParallelTestLauncher::LaunchSequencedChildGTestProcess( + SequencedWorkerPool::SequenceToken sequence_token, + const CommandLine& command_line, + const std::string& wrapper, + base::TimeDelta timeout, + const LaunchChildGTestProcessCallback& callback) { + DCHECK(thread_checker_.CalledOnValidThread()); + // Record the exact command line used to launch the child. CommandLine new_command_line( PrepareCommandLineForGTest(command_line, wrapper)); @@ -154,7 +198,8 @@ void ParallelTestLauncher::LaunchChildGTestProcess( running_processes_map_.insert( std::make_pair(launch_sequence_number_, new_command_line)); - worker_pool_owner_->pool()->PostWorkerTask( + worker_pool_owner_->pool()->PostSequencedWorkerTask( + sequence_token, FROM_HERE, Bind(&DoLaunchChildTestProcess, new_command_line, @@ -166,20 +211,16 @@ void ParallelTestLauncher::LaunchChildGTestProcess( callback))); } -void ParallelTestLauncher::ResetOutputWatchdog() { - DCHECK(thread_checker_.CalledOnValidThread()); - timer_.Reset(); -} - void ParallelTestLauncher::OnLaunchTestProcessFinished( size_t sequence_number, const LaunchChildGTestProcessCallback& callback, int exit_code, + const TimeDelta& elapsed_time, bool was_timeout, const std::string& output) { DCHECK(thread_checker_.CalledOnValidThread()); running_processes_map_.erase(sequence_number); - callback.Run(exit_code, was_timeout, output); + callback.Run(exit_code, elapsed_time, was_timeout, output); } void ParallelTestLauncher::OnOutputTimeout() { diff --git a/base/test/parallel_test_launcher.h b/base/test/parallel_test_launcher.h index e7b07df955..6d9d228bcf 100644 --- a/base/test/parallel_test_launcher.h +++ b/base/test/parallel_test_launcher.h @@ -9,6 +9,7 @@ #include <string> #include "base/callback.h" +#include "base/threading/sequenced_worker_pool.h" #include "base/threading/thread_checker.h" #include "base/time/time.h" #include "base/timer/timer.h" @@ -29,10 +30,10 @@ class ParallelTestLauncher { ~ParallelTestLauncher(); // Callback called after a child process finishes. First argument is the exit - // code, second one is true if the child process was terminated because of - // a timeout, and third one contains output of the child (stdout and stderr - // together). - typedef Callback<void(int, bool, const std::string&)> + // code, second one is child process elapsed time, third one is true if + // the child process was terminated because of a timeout, and fourth one + // contains output of the child (stdout and stderr together). + typedef Callback<void(int, const TimeDelta&, bool, const std::string&)> LaunchChildGTestProcessCallback; // Launches a child process (assumed to be gtest-based binary) using @@ -45,23 +46,47 @@ class ParallelTestLauncher { base::TimeDelta timeout, const LaunchChildGTestProcessCallback& callback); + // Similar to above, but with processes sharing the same value of |token_name| + // being serialized, with order matching order of calls of this method. + void LaunchNamedSequencedChildGTestProcess( + const std::string& token_name, + const CommandLine& command_line, + const std::string& wrapper, + base::TimeDelta timeout, + const LaunchChildGTestProcessCallback& callback); + // Resets the output watchdog, indicating some test results have been printed // out. If a pause between the calls exceeds an internal treshold, a message // will be printed listing all child processes we're still waiting for. void ResetOutputWatchdog(); private: + void LaunchSequencedChildGTestProcess( + SequencedWorkerPool::SequenceToken sequence_token, + const CommandLine& command_line, + const std::string& wrapper, + base::TimeDelta timeout, + const LaunchChildGTestProcessCallback& callback); + // Called on a worker thread after a child process finishes. void OnLaunchTestProcessFinished( size_t sequence_number, const LaunchChildGTestProcessCallback& callback, int exit_code, + const TimeDelta& elapsed_time, bool was_timeout, const std::string& output); // Called by the delay timer when no output was made for a while. void OnOutputTimeout(); + // Make sure we don't accidentally call the wrong methods e.g. on the worker + // pool thread. With lots of callbacks used this is non-trivial. + // Should be the first member so that it's destroyed last: when destroying + // other members, especially the worker pool, we may check the code is running + // on the correct thread. + ThreadChecker thread_checker_; + // Watchdog timer to make sure we do not go without output for too long. DelayTimer<ParallelTestLauncher> timer_; @@ -76,10 +101,6 @@ class ParallelTestLauncher { // Worker pool used to launch processes in parallel. scoped_ptr<SequencedWorkerPoolOwner> worker_pool_owner_; - // Make sure we don't accidentally call the wrong methods e.g. on the worker - // pool thread. With lots of callbacks used this is non-trivial. - ThreadChecker thread_checker_; - DISALLOW_COPY_AND_ASSIGN(ParallelTestLauncher); }; diff --git a/base/test/test_launcher.cc b/base/test/test_launcher.cc index ff884c8113..23fe90430e 100644 --- a/base/test/test_launcher.cc +++ b/base/test/test_launcher.cc @@ -219,6 +219,8 @@ class ResultsPrinter { void PrintTestsByStatus(TestResult::Status status, const std::string& description); + ThreadChecker thread_checker_; + // Test results grouped by test case name. typedef std::map<std::string, std::vector<TestResult> > ResultsMap; ResultsMap results_; @@ -237,8 +239,6 @@ class ResultsPrinter { RunTestsCallback callback_; - ThreadChecker thread_checker_; - WeakPtrFactory<ResultsPrinter> weak_ptr_; DISALLOW_COPY_AND_ASSIGN(ResultsPrinter); @@ -483,10 +483,13 @@ void RunTests(TestLauncherDelegate* launcher_delegate, continue; } + std::string filtering_test_name = + launcher_delegate->GetTestNameForFiltering(test_case, test_info); + // Skip the test that doesn't match the filter string (if given). if ((!positive_filter.empty() && - !MatchesFilter(test_name, positive_filter)) || - MatchesFilter(test_name, negative_filter)) { + !MatchesFilter(filtering_test_name, positive_filter)) || + MatchesFilter(filtering_test_name, negative_filter)) { continue; } @@ -561,14 +564,41 @@ const char kGTestRepeatFlag[] = "gtest_repeat"; const char kGTestRunDisabledTestsFlag[] = "gtest_also_run_disabled_tests"; const char kGTestOutputFlag[] = "gtest_output"; -const char kHelpFlag[] = "help"; - TestResult::TestResult() : status(TEST_UNKNOWN) { } TestLauncherDelegate::~TestLauncherDelegate() { } +void PrintTestOutputSnippetOnFailure(const TestResult& result, + const std::string& full_output) { + if (result.status == TestResult::TEST_SUCCESS) + return; + + size_t run_pos = full_output.find(std::string("[ RUN ] ") + + result.GetFullName()); + if (run_pos == std::string::npos) + return; + + size_t end_pos = full_output.find(std::string("[ FAILED ] ") + + result.GetFullName(), + run_pos); + if (end_pos != std::string::npos) { + size_t newline_pos = full_output.find("\n", end_pos); + if (newline_pos != std::string::npos) + end_pos = newline_pos + 1; + } + + std::string snippet(full_output.substr(run_pos)); + if (end_pos != std::string::npos) + snippet = full_output.substr(run_pos, end_pos - run_pos); + + // TODO(phajdan.jr): Indent each line of the snippet so it's more + // noticeable. + fprintf(stdout, "%s", snippet.c_str()); + fflush(stdout); +} + int LaunchChildGTestProcess(const CommandLine& command_line, const std::string& wrapper, base::TimeDelta timeout, diff --git a/base/test/test_launcher.h b/base/test/test_launcher.h index 739cbdd19a..fac72972a8 100644 --- a/base/test/test_launcher.h +++ b/base/test/test_launcher.h @@ -68,6 +68,15 @@ struct TestResult { // which tests and how are run. class TestLauncherDelegate { public: + // Called to get a test name for filtering purposes. Usually it's + // test case's name and test's name joined by a dot (e.g. + // "TestCaseName.TestName"). + // TODO(phajdan.jr): Remove after transitioning away from run_test_cases.py, + // http://crbug.com/236893 . + virtual std::string GetTestNameForFiltering( + const testing::TestCase* test_case, + const testing::TestInfo* test_info) = 0; + // Called before a test is considered for running. If it returns false, // the test is not run. If it returns true, the test will be run provided // it is part of the current shard. @@ -91,6 +100,11 @@ class TestLauncherDelegate { virtual ~TestLauncherDelegate(); }; +// If |result| is not successful, prints that test's failure message +// (extracted from |full_output|) to stdout. +void PrintTestOutputSnippetOnFailure(const TestResult& result, + const std::string& full_output); + // Launches a child process (assumed to be gtest-based binary) // using |command_line|. If |wrapper| is not empty, it is prepended // to the final command line. If the child process is still running diff --git a/base/test/test_switches.cc b/base/test/test_switches.cc index b1c57f7700..0c7a6f52e5 100644 --- a/base/test/test_switches.cc +++ b/base/test/test_switches.cc @@ -18,6 +18,7 @@ const char switches::kTestLauncherJobs[] = "test-launcher-jobs"; const char switches::kTestLauncherOutput[] = "test-launcher-output"; // Time (in milliseconds) that the tests should wait before timing out. +const char switches::kTestLauncherTimeout[] = "test-launcher-timeout"; // TODO(phajdan.jr): Clean up the switch names. const char switches::kTestTinyTimeout[] = "test-tiny-timeout"; const char switches::kUiTestActionTimeout[] = "ui-test-action-timeout"; diff --git a/base/test/test_switches.h b/base/test/test_switches.h index ea00a20238..bc6a1fb112 100644 --- a/base/test/test_switches.h +++ b/base/test/test_switches.h @@ -13,6 +13,7 @@ extern const char kTestLargeTimeout[]; extern const char kTestLauncherBatchLimit[]; extern const char kTestLauncherJobs[]; extern const char kTestLauncherOutput[]; +extern const char kTestLauncherTimeout[]; extern const char kTestTinyTimeout[]; extern const char kUiTestActionTimeout[]; extern const char kUiTestActionMaxTimeout[]; diff --git a/base/test/test_timeouts.cc b/base/test/test_timeouts.cc index ed689c2842..fa8a2ea071 100644 --- a/base/test/test_timeouts.cc +++ b/base/test/test_timeouts.cc @@ -66,6 +66,8 @@ int TestTimeouts::action_max_timeout_ms_ = 30000; #endif // NDEBUG int TestTimeouts::large_test_timeout_ms_ = 10 * 60 * 1000; +int TestTimeouts::test_launcher_timeout_ms_ = 45000; + // static void TestTimeouts::Initialize() { if (initialized_) { @@ -91,8 +93,14 @@ void TestTimeouts::Initialize() { InitializeTimeout(switches::kTestLargeTimeout, action_max_timeout_ms_, &large_test_timeout_ms_); + // Test launcher timeout is independent from anything above action timeout. + InitializeTimeout(switches::kTestLauncherTimeout, action_timeout_ms_, + &test_launcher_timeout_ms_); + // The timeout values should be increasing in the right order. CHECK(tiny_timeout_ms_ <= action_timeout_ms_); CHECK(action_timeout_ms_ <= action_max_timeout_ms_); CHECK(action_max_timeout_ms_ <= large_test_timeout_ms_); + + CHECK(action_timeout_ms_ <= test_launcher_timeout_ms_); } diff --git a/base/test/test_timeouts.h b/base/test/test_timeouts.h index 1778926f83..f08c697675 100644 --- a/base/test/test_timeouts.h +++ b/base/test/test_timeouts.h @@ -44,6 +44,13 @@ class TestTimeouts { return base::TimeDelta::FromMilliseconds(large_test_timeout_ms_); } + // Timeout for a single test launched used built-in test launcher. + // Do not use outside of the test launcher. + static base::TimeDelta test_launcher_timeout() { + DCHECK(initialized_); + return base::TimeDelta::FromMilliseconds(test_launcher_timeout_ms_); + } + private: static bool initialized_; @@ -51,6 +58,7 @@ class TestTimeouts { static int action_timeout_ms_; static int action_max_timeout_ms_; static int large_test_timeout_ms_; + static int test_launcher_timeout_ms_; DISALLOW_IMPLICIT_CONSTRUCTORS(TestTimeouts); }; diff --git a/base/test/unit_test_launcher.cc b/base/test/unit_test_launcher.cc index cc7f5b9a83..daf264d830 100644 --- a/base/test/unit_test_launcher.cc +++ b/base/test/unit_test_launcher.cc @@ -99,6 +99,14 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { TestResultCallback callback; }; + virtual std::string GetTestNameForFiltering( + const testing::TestCase* test_case, + const testing::TestInfo* test_info) OVERRIDE { + DCHECK(thread_checker_.CalledOnValidThread()); + + return std::string(test_case->name()) + "." + test_info->name(); + } + virtual bool ShouldRunTest(const testing::TestCase* test_case, const testing::TestInfo* test_info) OVERRIDE { DCHECK(thread_checker_.CalledOnValidThread()); @@ -151,7 +159,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { // Note: do NOT parse child's stdout to do that, it's known to be // unreliable (e.g. buffering issues can mix up the output). base::TimeDelta timeout = - test_names.size() * TestTimeouts::action_timeout(); + test_names.size() * TestTimeouts::test_launcher_timeout(); parallel_launcher_.LaunchChildGTestProcess( cmd_line, @@ -167,6 +175,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { void GTestCallback(const std::vector<TestLaunchInfo>& tests, const FilePath& output_file, int exit_code, + const TimeDelta& elapsed_time, bool was_timeout, const std::string& output) { DCHECK(thread_checker_.CalledOnValidThread()); @@ -190,35 +199,6 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { DeleteFile(output_file.DirName(), true); } - static void MaybePrintTestOutputSnippet(const TestResult& result, - const std::string& full_output) { - if (result.status == TestResult::TEST_SUCCESS) - return; - - size_t run_pos = full_output.find(std::string("[ RUN ] ") + - result.GetFullName()); - if (run_pos == std::string::npos) - return; - - size_t end_pos = full_output.find(std::string("[ FAILED ] ") + - result.GetFullName(), - run_pos); - if (end_pos != std::string::npos) { - size_t newline_pos = full_output.find("\n", end_pos); - if (newline_pos != std::string::npos) - end_pos = newline_pos + 1; - } - - std::string snippet(full_output.substr(run_pos)); - if (end_pos != std::string::npos) - snippet = full_output.substr(run_pos, end_pos - run_pos); - - // TODO(phajdan.jr): Indent each line of the snippet so it's more - // noticeable. - fprintf(stdout, "%s", snippet.c_str()); - fflush(stdout); - } - static bool ProcessTestResults( const std::vector<TestLaunchInfo>& tests, const base::FilePath& output_file, @@ -254,8 +234,19 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { // a crash. test_result.status = TestResult::TEST_TIMEOUT; } + } else if (test_result.status == TestResult::TEST_SUCCESS || + test_result.status == TestResult::TEST_FAILURE) { + // We run multiple tests in a batch with a timeout applied + // to the entire batch. It is possible that with other tests + // running quickly some tests take longer than the per-test timeout. + // For consistent handling of tests independent of order and other + // factors, mark them as timing out. + if (test_result.elapsed_time > + TestTimeouts::test_launcher_timeout()) { + test_result.status = TestResult::TEST_TIMEOUT; + } } - MaybePrintTestOutputSnippet(test_result, output); + PrintTestOutputSnippetOnFailure(test_result, output); tests[i].callback.Run(test_result); called_any_callback = true; } else if (had_interrupted_test) { @@ -268,7 +259,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { test_result.test_case_name = tests[i].test_case_name; test_result.test_name = tests[i].test_name; test_result.status = TestResult::TEST_UNKNOWN; - MaybePrintTestOutputSnippet(test_result, output); + PrintTestOutputSnippetOnFailure(test_result, output); tests[i].callback.Run(test_result); called_any_callback = true; } @@ -305,14 +296,14 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { return called_any_callback; } + ThreadChecker thread_checker_; + ParallelTestLauncher parallel_launcher_; // Maximum number of tests to run in a single batch. size_t batch_limit_; std::vector<TestLaunchInfo> tests_; - - ThreadChecker thread_checker_; }; bool GetSwitchValueAsInt(const std::string& switch_name, int* result) { diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-arm.mk b/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-arm.mk index 51db15531a..0cfe108ff4 100644 --- a/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-arm.mk +++ b/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-arm.mk @@ -63,7 +63,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -146,7 +145,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-mips.mk b/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-mips.mk index 76a499201d..b9f7408284 100644 --- a/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-mips.mk +++ b/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-mips.mk @@ -63,7 +63,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -146,7 +145,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-x86.mk b/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-x86.mk index 8984ea3cb0..25fec07f45 100644 --- a/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-x86.mk +++ b/base/third_party/dynamic_annotations/dynamic_annotations.target.darwin-x86.mk @@ -65,7 +65,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -151,7 +150,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-arm.mk b/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-arm.mk index 51db15531a..0cfe108ff4 100644 --- a/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-arm.mk +++ b/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-arm.mk @@ -63,7 +63,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -146,7 +145,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-mips.mk b/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-mips.mk index 76a499201d..b9f7408284 100644 --- a/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-mips.mk +++ b/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-mips.mk @@ -63,7 +63,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -146,7 +145,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-x86.mk b/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-x86.mk index 8984ea3cb0..25fec07f45 100644 --- a/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-x86.mk +++ b/base/third_party/dynamic_annotations/dynamic_annotations.target.linux-x86.mk @@ -65,7 +65,6 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -151,7 +150,6 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ - '-DWTF_VECTOR_INITIAL_SIZE=4' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ diff --git a/base/threading/thread.cc b/base/threading/thread.cc index f033775035..aca4ddbaa0 100644 --- a/base/threading/thread.cc +++ b/base/threading/thread.cc @@ -5,7 +5,6 @@ #include "base/threading/thread.h" #include "base/bind.h" -#include "base/debug/alias.h" #include "base/lazy_instance.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "base/threading/thread_id_name_manager.h" @@ -173,19 +172,6 @@ bool Thread::GetThreadWasQuitProperly() { void Thread::ThreadMain() { { -#if defined(OS_MACOSX) - // Store the thread name on the stack to debug <http://crbug.com/274705>. - // End with a byte sequence of <EOT><BEL><NUL> to make it easier to grep in - // the minidump stack dump. - const size_t kThreadNameSize = 50; - char thread_name[kThreadNameSize]; - strncpy(thread_name, name_.c_str(), kThreadNameSize); - thread_name[kThreadNameSize - 1] = '\0'; - thread_name[kThreadNameSize - 2] = '\7'; - thread_name[kThreadNameSize - 3] = '\3'; - base::debug::Alias(thread_name); -#endif - // The message loop for this thread. // Allocated on the heap to centralize any leak reports at this line. scoped_ptr<MessageLoop> message_loop( @@ -231,10 +217,6 @@ void Thread::ThreadMain() { // We can't receive messages anymore. message_loop_ = NULL; - -#if defined(OS_MACOSX) - base::debug::Alias(thread_name); -#endif } } diff --git a/base/time/time.cc b/base/time/time.cc index ce25dea058..a9e4b1cf90 100644 --- a/base/time/time.cc +++ b/base/time/time.cc @@ -138,6 +138,19 @@ double Time::ToJsTime() const { kMicrosecondsPerMillisecond); } +int64 Time::ToJavaTime() const { + if (is_null()) { + // Preserve 0 so the invalid result doesn't depend on the platform. + return 0; + } + if (is_max()) { + // Preserve max without offset to prevent overflow. + return std::numeric_limits<int64>::max(); + } + return ((us_ - kTimeTToMicrosecondsOffset) / + kMicrosecondsPerMillisecond); +} + // static Time Time::UnixEpoch() { Time time; diff --git a/base/time/time.h b/base/time/time.h index 5d7033af18..a236a3f09a 100644 --- a/base/time/time.h +++ b/base/time/time.h @@ -300,6 +300,10 @@ class BASE_EXPORT Time { static Time FromJsTime(double ms_since_epoch); double ToJsTime() const; + // Converts to Java convention for times, a number of + // milliseconds since the epoch. + int64 ToJavaTime() const; + #if defined(OS_POSIX) static Time FromTimeVal(struct timeval t); struct timeval ToTimeVal() const; diff --git a/base/time/time_mac.cc b/base/time/time_mac.cc index da46aa7ee5..d5b6a002fb 100644 --- a/base/time/time_mac.cc +++ b/base/time/time_mac.cc @@ -85,8 +85,6 @@ namespace base { // irb(main):011:0> Time.at(-11644473600).getutc() // => Mon Jan 01 00:00:00 UTC 1601 static const int64 kWindowsEpochDeltaSeconds = GG_INT64_C(11644473600); -static const int64 kWindowsEpochDeltaMilliseconds = - kWindowsEpochDeltaSeconds * Time::kMillisecondsPerSecond; // static const int64 Time::kWindowsEpochDeltaMicroseconds = diff --git a/base/x11/edid_parser_x11.cc b/base/x11/edid_parser_x11.cc new file mode 100644 index 0000000000..74b14b65c4 --- /dev/null +++ b/base/x11/edid_parser_x11.cc @@ -0,0 +1,196 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/x11/edid_parser_x11.h" + +#include <X11/extensions/Xrandr.h> +#include <X11/Xatom.h> +#include <X11/Xlib.h> + +#include "base/hash.h" +#include "base/message_loop/message_loop.h" +#include "base/strings/string_util.h" +#include "base/sys_byteorder.h" + +namespace { + +// Returns 64-bit persistent ID for the specified manufacturer's ID and +// product_code_hash, and the index of the output it is connected to. +// |output_index| is used to distinguish the displays of the same type. For +// example, swapping two identical display between two outputs will not be +// treated as swap. The 'serial number' field in EDID isn't used here because +// it is not guaranteed to have unique number and it may have the same fixed +// value (like 0). +int64 GetID(uint16 manufacturer_id, + uint32 product_code_hash, + uint8 output_index) { + return ((static_cast<int64>(manufacturer_id) << 40) | + (static_cast<int64>(product_code_hash) << 8) | output_index); +} + +bool IsRandRAvailable() { + int randr_version_major = 0; + int randr_version_minor = 0; + static bool is_randr_available = XRRQueryVersion( + base::MessagePumpX11::GetDefaultXDisplay(), + &randr_version_major, &randr_version_minor); + return is_randr_available; +} + +} // namespace + +namespace base { + +bool GetEDIDProperty(XID output, unsigned long* nitems, unsigned char** prop) { + if (!IsRandRAvailable()) + return false; + + Display* display = base::MessagePumpX11::GetDefaultXDisplay(); + + static Atom edid_property = XInternAtom( + base::MessagePumpX11::GetDefaultXDisplay(), + RR_PROPERTY_RANDR_EDID, false); + + bool has_edid_property = false; + int num_properties = 0; + Atom* properties = XRRListOutputProperties(display, output, &num_properties); + for (int i = 0; i < num_properties; ++i) { + if (properties[i] == edid_property) { + has_edid_property = true; + break; + } + } + XFree(properties); + if (!has_edid_property) + return false; + + Atom actual_type; + int actual_format; + unsigned long bytes_after; + XRRGetOutputProperty(display, + output, + edid_property, + 0, // offset + 128, // length + false, // _delete + false, // pending + AnyPropertyType, // req_type + &actual_type, + &actual_format, + nitems, + &bytes_after, + prop); + DCHECK_EQ(XA_INTEGER, actual_type); + DCHECK_EQ(8, actual_format); + return true; +} + +bool GetDisplayId(XID output_id, size_t output_index, int64* display_id_out) { + unsigned long nitems = 0; + unsigned char* prop = NULL; + if (!GetEDIDProperty(output_id, &nitems, &prop)) + return false; + + bool result = + GetDisplayIdFromEDID(prop, nitems, output_index, display_id_out); + XFree(prop); + return result; +} + +bool GetDisplayIdFromEDID(const unsigned char* prop, + unsigned long nitems, + size_t output_index, + int64* display_id_out) { + uint16 manufacturer_id = 0; + std::string product_name; + + // ParseOutputDeviceData fails if it doesn't have product_name. + ParseOutputDeviceData(prop, nitems, &manufacturer_id, &product_name); + + // Generates product specific value from product_name instead of product code. + // See crbug.com/240341 + uint32 product_code_hash = product_name.empty() ? + 0 : base::Hash(product_name); + if (manufacturer_id != 0) { + // An ID based on display's index will be assigned later if this call + // fails. + *display_id_out = GetID( + manufacturer_id, product_code_hash, output_index); + return true; + } + return false; +} + +bool ParseOutputDeviceData(const unsigned char* prop, + unsigned long nitems, + uint16* manufacturer_id, + std::string* human_readable_name) { + // See http://en.wikipedia.org/wiki/Extended_display_identification_data + // for the details of EDID data format. We use the following data: + // bytes 8-9: manufacturer EISA ID, in big-endian + // bytes 54-125: four descriptors (18-bytes each) which may contain + // the display name. + const unsigned int kManufacturerOffset = 8; + const unsigned int kManufacturerLength = 2; + const unsigned int kDescriptorOffset = 54; + const unsigned int kNumDescriptors = 4; + const unsigned int kDescriptorLength = 18; + // The specifier types. + const unsigned char kMonitorNameDescriptor = 0xfc; + + if (manufacturer_id) { + if (nitems < kManufacturerOffset + kManufacturerLength) { + LOG(ERROR) << "too short EDID data: manifacturer id"; + return false; + } + + *manufacturer_id = + *reinterpret_cast<const uint16*>(prop + kManufacturerOffset); +#if defined(ARCH_CPU_LITTLE_ENDIAN) + *manufacturer_id = base::ByteSwap(*manufacturer_id); +#endif + } + + if (!human_readable_name) + return true; + + human_readable_name->clear(); + for (unsigned int i = 0; i < kNumDescriptors; ++i) { + if (nitems < kDescriptorOffset + (i + 1) * kDescriptorLength) + break; + + const unsigned char* desc_buf = + prop + kDescriptorOffset + i * kDescriptorLength; + // If the descriptor contains the display name, it has the following + // structure: + // bytes 0-2, 4: \0 + // byte 3: descriptor type, defined above. + // bytes 5-17: text data, ending with \r, padding with spaces + // we should check bytes 0-2 and 4, since it may have other values in + // case that the descriptor contains other type of data. + if (desc_buf[0] == 0 && desc_buf[1] == 0 && desc_buf[2] == 0 && + desc_buf[4] == 0) { + if (desc_buf[3] == kMonitorNameDescriptor) { + std::string found_name( + reinterpret_cast<const char*>(desc_buf + 5), kDescriptorLength - 5); + TrimWhitespaceASCII(found_name, TRIM_TRAILING, human_readable_name); + break; + } + } + } + + // Verify if the |human_readable_name| consists of printable characters only. + for (size_t i = 0; i < human_readable_name->size(); ++i) { + char c = (*human_readable_name)[i]; + if (!isascii(c) || !isprint(c)) { + human_readable_name->clear(); + LOG(ERROR) << "invalid EDID: human unreadable char in name"; + return false; + } + } + + return true; +} + +} // namespace base diff --git a/base/x11/edid_parser_x11.h b/base/x11/edid_parser_x11.h new file mode 100644 index 0000000000..0fba0b54d7 --- /dev/null +++ b/base/x11/edid_parser_x11.h @@ -0,0 +1,54 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_X11_EDID_PARSER_X11_H_ +#define BASE_X11_EDID_PARSER_X11_H_ + +#include <string> + +#include "base/base_export.h" +#include "base/basictypes.h" + +typedef unsigned long XID; + +// EDID (Extended Display Identification Data) is a format for monitor +// metadata. This provides a parser for the data and an interface to get it +// from XRandR. + +namespace base { + +// Get the EDID data from the |output| and stores to |prop|. |nitem| will store +// the number of characters |prop| will have. It doesn't take the ownership of +// |prop|, so caller must release it by XFree(). +// Returns true if EDID property is successfully obtained. Otherwise returns +// false and does not touch |prop| and |nitems|. +BASE_EXPORT bool GetEDIDProperty(XID output, + unsigned long* nitems, + unsigned char** prop); + +// Gets the EDID data from |output| and generates the display id through +// |GetDisplayIdFromEDID|. +BASE_EXPORT bool GetDisplayId(XID output, size_t index, + int64* display_id_out); + +// Generates the display id for the pair of |prop| with |nitems| length and +// |index|, and store in |display_id_out|. Returns true if the display id is +// successfully generated, or false otherwise. +BASE_EXPORT bool GetDisplayIdFromEDID(const unsigned char* prop, + unsigned long nitems, + size_t index, + int64* display_id_out); + +// Parses |prop| as EDID data and stores extracted data into |manufacturer_id| +// and |human_readable_name| and returns true. NULL can be passed for unwanted +// output parameters. Some devices (especially internal displays) may not have +// the field for |human_readable_name|, and it will return true in that case. +BASE_EXPORT bool ParseOutputDeviceData(const unsigned char* prop, + unsigned long nitems, + uint16* manufacturer_id, + std::string* human_readable_name); + +} // namespace base + +#endif // BASE_X11_EDID_PARSER_X11_H_ diff --git a/base/x11/edid_parser_x11_unittest.cc b/base/x11/edid_parser_x11_unittest.cc new file mode 100644 index 0000000000..97e3ce1034 --- /dev/null +++ b/base/x11/edid_parser_x11_unittest.cc @@ -0,0 +1,167 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/x11/edid_parser_x11.h" + +#include "base/memory/scoped_ptr.h" +#include "testing/gtest/include/gtest/gtest.h" + +#include <X11/extensions/Xrandr.h> + +namespace base { + +namespace { + +// Returns the number of characters in the string literal but doesn't count its +// terminator NULL byte. +#define charsize(str) (arraysize(str) - 1) + +// Sample EDID data extracted from real devices. +const unsigned char kNormalDisplay[] = + "\x00\xff\xff\xff\xff\xff\xff\x00\x22\xf0\x6c\x28\x01\x01\x01\x01" + "\x02\x16\x01\x04\xb5\x40\x28\x78\xe2\x8d\x85\xad\x4f\x35\xb1\x25" + "\x0e\x50\x54\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01" + "\x01\x01\x01\x01\x01\x01\xe2\x68\x00\xa0\xa0\x40\x2e\x60\x30\x20" + "\x36\x00\x81\x90\x21\x00\x00\x1a\xbc\x1b\x00\xa0\x50\x20\x17\x30" + "\x30\x20\x36\x00\x81\x90\x21\x00\x00\x1a\x00\x00\x00\xfc\x00\x48" + "\x50\x20\x5a\x52\x33\x30\x77\x0a\x20\x20\x20\x20\x00\x00\x00\xff" + "\x00\x43\x4e\x34\x32\x30\x32\x31\x33\x37\x51\x0a\x20\x20\x00\x71"; + +const unsigned char kInternalDisplay[] = + "\x00\xff\xff\xff\xff\xff\xff\x00\x4c\xa3\x42\x31\x00\x00\x00\x00" + "\x00\x15\x01\x03\x80\x1a\x10\x78\x0a\xd3\xe5\x95\x5c\x60\x90\x27" + "\x19\x50\x54\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01" + "\x01\x01\x01\x01\x01\x01\x9e\x1b\x00\xa0\x50\x20\x12\x30\x10\x30" + "\x13\x00\x05\xa3\x10\x00\x00\x19\x00\x00\x00\x0f\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x23\x87\x02\x64\x00\x00\x00\x00\xfe\x00\x53" + "\x41\x4d\x53\x55\x4e\x47\x0a\x20\x20\x20\x20\x20\x00\x00\x00\xfe" + "\x00\x31\x32\x31\x41\x54\x31\x31\x2d\x38\x30\x31\x0a\x20\x00\x45"; + +const unsigned char kOverscanDisplay[] = + "\x00\xff\xff\xff\xff\xff\xff\x00\x4c\x2d\xfe\x08\x00\x00\x00\x00" + "\x29\x15\x01\x03\x80\x10\x09\x78\x0a\xee\x91\xa3\x54\x4c\x99\x26" + "\x0f\x50\x54\xbd\xef\x80\x71\x4f\x81\xc0\x81\x00\x81\x80\x95\x00" + "\xa9\xc0\xb3\x00\x01\x01\x02\x3a\x80\x18\x71\x38\x2d\x40\x58\x2c" + "\x45\x00\xa0\x5a\x00\x00\x00\x1e\x66\x21\x56\xaa\x51\x00\x1e\x30" + "\x46\x8f\x33\x00\xa0\x5a\x00\x00\x00\x1e\x00\x00\x00\xfd\x00\x18" + "\x4b\x0f\x51\x17\x00\x0a\x20\x20\x20\x20\x20\x20\x00\x00\x00\xfc" + "\x00\x53\x41\x4d\x53\x55\x4e\x47\x0a\x20\x20\x20\x20\x20\x01\x1d" + "\x02\x03\x1f\xf1\x47\x90\x04\x05\x03\x20\x22\x07\x23\x09\x07\x07" + "\x83\x01\x00\x00\xe2\x00\x0f\x67\x03\x0c\x00\x20\x00\xb8\x2d\x01" + "\x1d\x80\x18\x71\x1c\x16\x20\x58\x2c\x25\x00\xa0\x5a\x00\x00\x00" + "\x9e\x01\x1d\x00\x72\x51\xd0\x1e\x20\x6e\x28\x55\x00\xa0\x5a\x00" + "\x00\x00\x1e\x8c\x0a\xd0\x8a\x20\xe0\x2d\x10\x10\x3e\x96\x00\xa0" + "\x5a\x00\x00\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6"; + +const unsigned char kLP2565A[] = + "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\x22\xF0\x76\x26\x01\x01\x01\x01" + "\x02\x12\x01\x03\x80\x34\x21\x78\xEE\xEF\x95\xA3\x54\x4C\x9B\x26" + "\x0F\x50\x54\xA5\x6B\x80\x81\x40\x81\x80\x81\x99\x71\x00\xA9\x00" + "\xA9\x40\xB3\x00\xD1\x00\x28\x3C\x80\xA0\x70\xB0\x23\x40\x30\x20" + "\x36\x00\x07\x44\x21\x00\x00\x1A\x00\x00\x00\xFD\x00\x30\x55\x1E" + "\x5E\x11\x00\x0A\x20\x20\x20\x20\x20\x20\x00\x00\x00\xFC\x00\x48" + "\x50\x20\x4C\x50\x32\x34\x36\x35\x0A\x20\x20\x20\x00\x00\x00\xFF" + "\x00\x43\x4E\x4B\x38\x30\x32\x30\x34\x48\x4D\x0A\x20\x20\x00\xA4"; + +const unsigned char kLP2565B[] = + "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\x22\xF0\x75\x26\x01\x01\x01\x01" + "\x02\x12\x01\x03\x6E\x34\x21\x78\xEE\xEF\x95\xA3\x54\x4C\x9B\x26" + "\x0F\x50\x54\xA5\x6B\x80\x81\x40\x71\x00\xA9\x00\xA9\x40\xA9\x4F" + "\xB3\x00\xD1\xC0\xD1\x00\x28\x3C\x80\xA0\x70\xB0\x23\x40\x30\x20" + "\x36\x00\x07\x44\x21\x00\x00\x1A\x00\x00\x00\xFD\x00\x30\x55\x1E" + "\x5E\x15\x00\x0A\x20\x20\x20\x20\x20\x20\x00\x00\x00\xFC\x00\x48" + "\x50\x20\x4C\x50\x32\x34\x36\x35\x0A\x20\x20\x20\x00\x00\x00\xFF" + "\x00\x43\x4E\x4B\x38\x30\x32\x30\x34\x48\x4D\x0A\x20\x20\x00\x45"; + +} // namespace + +TEST(EdidParserX11Test, ParseEDID) { + uint16 manufacturer_id = 0; + std::string human_readable_name; + EXPECT_TRUE(ParseOutputDeviceData( + kNormalDisplay, charsize(kNormalDisplay), + &manufacturer_id, &human_readable_name)); + EXPECT_EQ(0x22f0u, manufacturer_id); + EXPECT_EQ("HP ZR30w", human_readable_name); + + manufacturer_id = 0; + human_readable_name.clear(); + EXPECT_TRUE(ParseOutputDeviceData( + kInternalDisplay, charsize(kInternalDisplay), + &manufacturer_id, NULL)); + EXPECT_EQ(0x4ca3u, manufacturer_id); + EXPECT_EQ("", human_readable_name); + + // Internal display doesn't have name. + EXPECT_TRUE(ParseOutputDeviceData( + kInternalDisplay, charsize(kInternalDisplay), + NULL, &human_readable_name)); + EXPECT_TRUE(human_readable_name.empty()); + + manufacturer_id = 0; + human_readable_name.clear(); + EXPECT_TRUE(ParseOutputDeviceData( + kOverscanDisplay, charsize(kOverscanDisplay), + &manufacturer_id, &human_readable_name)); + EXPECT_EQ(0x4c2du, manufacturer_id); + EXPECT_EQ("SAMSUNG", human_readable_name); +} + +TEST(EdidParserX11Test, ParseBrokenEDID) { + uint16 manufacturer_id = 0; + std::string human_readable_name; + + // length == 0 + EXPECT_FALSE(ParseOutputDeviceData( + kNormalDisplay, 0, + &manufacturer_id, &human_readable_name)); + + // name is broken. Copying kNormalDisplay and substitute its name data by + // some control code. + std::string display_data( + reinterpret_cast<const char*>(kNormalDisplay), charsize(kNormalDisplay)); + + // display's name data is embedded in byte 95-107 in this specific example. + // Fix here too when the contents of kNormalDisplay is altered. + display_data[97] = '\x1b'; + EXPECT_FALSE(ParseOutputDeviceData( + reinterpret_cast<const unsigned char*>(display_data.data()), + display_data.size(), + &manufacturer_id, &human_readable_name)); + + // If |human_readable_name| isn't specified, it skips parsing the name. + manufacturer_id = 0; + EXPECT_TRUE(ParseOutputDeviceData( + reinterpret_cast<const unsigned char*>(display_data.data()), + display_data.size(), + &manufacturer_id, NULL)); + EXPECT_EQ(0x22f0u, manufacturer_id); +} + +TEST(EdidParserX11Test, GetDisplayId) { + // EDID of kLP2565A and B are slightly different but actually the same device. + int64 id1 = -1; + int64 id2 = -1; + EXPECT_TRUE(GetDisplayIdFromEDID(kLP2565A, charsize(kLP2565A), 0, &id1)); + EXPECT_TRUE(GetDisplayIdFromEDID(kLP2565B, charsize(kLP2565B), 0, &id2)); + EXPECT_EQ(id1, id2); + EXPECT_NE(-1, id1); +} + +TEST(EdidParserX11Test, GetDisplayIdFromInternal) { + int64 id = -1; + EXPECT_TRUE(GetDisplayIdFromEDID( + kInternalDisplay, charsize(kInternalDisplay), 0, &id)); + EXPECT_NE(-1, id); +} + +TEST(EdidParserX11Test, GetDisplayIdFailure) { + int64 id = -1; + EXPECT_FALSE(GetDisplayIdFromEDID(NULL, 0, 0, &id)); + EXPECT_EQ(-1, id); +} + +} // namespace base |