Revert of Revert of Make SharedMemoryHandle a class on Mac. (patchset #1 id:1 of https://codereview.chromium.org/1200473003/)
Reason for revert:
Oops, shot at the wrong CL.
Original issue's description:
> Revert of Make SharedMemoryHandle a class on Mac. (patchset #20 id:580001 of https://codereview.chromium.org/1163943004/)
>
> Reason for revert:
> Possibly breaking Mac build:
>
> FAILED: cd ../../third_party/libyuv; export BUILT_PRODUCTS_DIR=/b/build/slave/GPU_Mac_Builder/build/src/out/Release; export CONFIGURATION=Release; export PRODUCT_NAME=libyuv_nacl; export SDKROOT=/Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk; export SRCROOT=/b/build/slave/GPU_Mac_Builder/build/src/out/Release/../../third_party/libyuv; export SOURCE_ROOT="${SRCROOT}"; export TARGET_BUILD_DIR=/b/build/slave/GPU_Mac_Builder/build/src/out/Release; export TEMP_DIR="${TMPDIR}";python ../../native_client/build/build_nexe.py --root ../.. --product-dir ../../out/Release/xyz --config-name Release -t ../../native_client/toolchain/ --arch pnacl --build newlib_plib --name ../../out/Release/gen/tc_pnacl_newlib/lib/libyuv_nacl.a --objdir ../../out/Release/obj/third_party/libyuv/libyuv_nacl.gen/pnacl_newlib-pnacl/libyuv_nacl "--include-dirs=../../out/Release/gen/tc_pnacl_newlib/include ../.. \"../../out/Release/gen\" include" "--compile_flags=-O2 -g -Wall -fdiagnostics-show-option -Werror -Wno-unused-function -Wno-char-subscripts -Wno-c++11-extensions -Wno-unnamed-type-template-args -Wno-extra-semi -Wno-unused-private-field -Wno-char-subscripts -Wno-unused-function \"-std=gnu++11\" " --gomadir /b/build/goma "--defines=\"__STDC_LIMIT_MACROS=1\" \"__STDC_FORMAT_MACROS=1\" \"_GNU_SOURCE=1\" \"_DEFAULT_SOURCE=1\" \"_BSD_SOURCE=1\" \"_POSIX_C_SOURCE=199506\" \"_XOPEN_SOURCE=600\" \"DYNAMIC_ANNOTATIONS_ENABLED=1\" \"DYNAMIC_ANNOTATIONS_PREFIX=NACL_\" \"NACL_BUILD_ARCH=x86\" V8_DEPRECATION_WARNINGS \"__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0\" CHROMIUM_BUILD \"CR_CLANG_REVISION=239765-1\" \"USE_LIBJPEG_TURBO=1\" ENABLE_ONE_CLICK_SIGNIN ENABLE_PRE_SYNC_BACKUP \"ENABLE_REMOTING=1\" \"ENABLE_WEBRTC=1\" \"ENABLE_MEDIA_ROUTER=1\" USE_PROPRIETARY_CODECS ENABLE_PEPPER_CDMS ENABLE_CONFIGURATION_POLICY ENABLE_NOTIFICATIONS \"ENABLE_HIDPI=1\" SYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE DONT_EMBED_BUILD_METADATA \"DCHECK_ALWAYS_ON=1\" \"ENABLE_TASK_MANAGER=1\" \"ENABLE_EXTENSIONS=1\" \"ENABLE_PLUGIN_INSTALLATION=1\" \"ENABLE_PLUGINS=1\" \"ENABLE_SESSION_SERVICE=1\" \"ENABLE_THEMES=1\" \"ENABLE_AUTOFILL_DIALOG=1\" \"ENABLE_BACKGROUND=1\" \"ENABLE_GOOGLE_NOW=1\" \"CLD_VERSION=2\" \"ENABLE_PRINTING=1\" \"ENABLE_BASIC_PRINTING=1\" \"ENABLE_PRINT_PREVIEW=1\" \"ENABLE_SPELLCHECK=1\" \"ENABLE_CAPTIVE_PORTAL_DETECTION=1\" \"ENABLE_APP_LIST=1\" \"ENABLE_SETTINGS_APP=1\" \"ENABLE_SUPERVISED_USERS=1\" \"ENABLE_SERVICE_DISCOVERY=1\" \"ENABLE_WIFI_BOOTSTRAPPING=1\" V8_USE_EXTERNAL_STARTUP_DATA FULL_SAFE_BROWSING SAFE_BROWSING_CSD SAFE_BROWSING_DB_LOCAL SAFE_BROWSING_SERVICE \"USE_LIBPCI=1\" \"USE_OPENSSL=1\"" "--link_flags=-B../../out/Release/gen/tc_pnacl_newlib/lib " "--source-list=../../out/gypfiles/third_party/libyuv/pnacl_newlib.libyuv_nacl.source_list.gypcmd"
> source/row_any.cc:13:10: fatal error: 'memory.h' file not found
> #include <memory.h> // for memcpy()
> ^
> 1 error generated.
> FAILED with 1: /b/build/goma/gomacc ../../native_client/toolchain/mac_x86/pnacl_newlib/bin/pnacl-clang++ -c source/row_any.cc -o ../../out/Release/obj/third_party/libyuv/libyuv_nacl.gen/pnacl_newlib-pnacl/libyuv_nacl/row_any_67f422e1.o -MD -MF ../../out/Release/obj/third_party/libyuv/libyuv_nacl.gen/pnacl_newlib-pnacl/libyuv_nacl/row_any_67f422e1.o.d -O2 -g -Wall -fdiagnostics-show-option -Werror -Wno-unused-function -Wno-char-subscripts -Wno-c++11-extensions -Wno-unnamed-type-template-args -Wno-extra-semi -Wno-unused-private-field -Wno-char-subscripts -Wno-unused-function -std=gnu++11 -D__STDC_LIMIT_MACROS=1 -D__STDC_FORMAT_MACROS=1 -D_GNU_SOURCE=1 -D_DEFAULT_SOURCE=1 -D_BSD_SOURCE=1 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE=600 -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DDYNAMIC_ANNOTATIONS_PREFIX=NACL_ -DV8_DEPRECATION_WARNINGS -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=239765-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DDCHECK_ALWAYS_ON=1 -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DCLD_VERSION=2 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_SERVICE_DISCOVERY=1 -DENABLE_WIFI_BOOTSTRAPPING=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DSAFE_BROWSING_SERVICE -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DNACL_WINDOWS=0 -DNACL_OSX=0 -DNACL_LINUX=0 -DNACL_ANDROID=0 -DNACL_BUILD_ARCH=pnacl -I../../out/Release/gen/tc_pnacl_newlib/include -I../.. -I../../out/Release/gen -Iinclude -DNDEBUG -std=gnu++0x -Wno-deprecated-register
> Compile options: ['-O2', '-g', '-Wall', '-fdiagnostics-show-option', '-Werror', '-Wno-unused-function', '-Wno-char-subscripts', '-Wno-c++11-extensions', '-Wno-unnamed-type-template-args', '-Wno-extra-semi', '-Wno-unused-private-field', '-Wno-char-subscripts', '-Wno-unused-function', '-std=gnu++11', '-D__STDC_LIMIT_MACROS=1', '-D__STDC_FORMAT_MACROS=1', '-D_GNU_SOURCE=1', '-D_DEFAULT_SOURCE=1', '-D_BSD_SOURCE=1', '-D_POSIX_C_SOURCE=199506', '-D_XOPEN_SOURCE=600', '-DDYNAMIC_ANNOTATIONS_ENABLED=1', '-DDYNAMIC_ANNOTATIONS_PREFIX=NACL_', '-DV8_DEPRECATION_WARNINGS', '-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0', '-DCHROMIUM_BUILD', '-DCR_CLANG_REVISION=239765-1', '-DUSE_LIBJPEG_TURBO=1', '-DENABLE_ONE_CLICK_SIGNIN', '-DENABLE_PRE_SYNC_BACKUP', '-DENABLE_REMOTING=1', '-DENABLE_WEBRTC=1', '-DENABLE_MEDIA_ROUTER=1', '-DUSE_PROPRIETARY_CODECS', '-DENABLE_PEPPER_CDMS', '-DENABLE_CONFIGURATION_POLICY', '-DENABLE_NOTIFICATIONS', '-DENABLE_HIDPI=1', '-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE', '-DDONT_EMBED_BUILD_METADATA', '-DDCHECK_ALWAYS_ON=1', '-DENABLE_TASK_MANAGER=1', '-DENABLE_EXTENSIONS=1', '-DENABLE_PLUGIN_INSTALLATION=1', '-DENABLE_PLUGINS=1', '-DENABLE_SESSION_SERVICE=1', '-DENABLE_THEMES=1', '-DENABLE_AUTOFILL_DIALOG=1', '-DENABLE_BACKGROUND=1', '-DENABLE_GOOGLE_NOW=1', '-DCLD_VERSION=2', '-DENABLE_PRINTING=1', '-DENABLE_BASIC_PRINTING=1', '-DENABLE_PRINT_PREVIEW=1', '-DENABLE_SPELLCHECK=1', '-DENABLE_CAPTIVE_PORTAL_DETECTION=1', '-DENABLE_APP_LIST=1', '-DENABLE_SETTINGS_APP=1', '-DENABLE_SUPERVISED_USERS=1', '-DENABLE_SERVICE_DISCOVERY=1', '-DENABLE_WIFI_BOOTSTRAPPING=1', '-DV8_USE_EXTERNAL_STARTUP_DATA', '-DFULL_SAFE_BROWSING', '-DSAFE_BROWSING_CSD', '-DSAFE_BROWSING_DB_LOCAL', '-DSAFE_BROWSING_SERVICE', '-DUSE_LIBPCI=1', '-DUSE_OPENSSL=1', '-DNACL_WINDOWS=0', '-DNACL_OSX=0', '-DNACL_LINUX=0', '-DNACL_ANDROID=0', '-DNACL_BUILD_ARCH=pnacl', '-I../../out/Release/gen/tc_pnacl_newlib/include', '-I../..', '-I../../out/Release/gen', '-Iinclude', '-DNDEBUG']
> Linker options: ['-B../../out/Release/gen/tc_pnacl_newlib/lib']
> Traceback (most recent call last):
> File "../../native_client/build/build_nexe.py", line 849, in CompileProcess
> output_queue.put((filename, build.Compile(filename)))
> File "../../native_client/build/build_nexe.py", line 579, in Compile
> raise Error('FAILED with %d: %s' % (err, ' '.join(cmd_line)))
> Error: FAILED with 1: /b/build/goma/gomacc ../../native_client/toolchain/mac_x86/pnacl_newlib/bin/pnacl-clang++ -c source/row_any.cc -o ../../out/Release/obj/third_party/libyuv/libyuv_nacl.gen/pnacl_newlib-pnacl/libyuv_nacl/row_any_67f422e1.o -MD -MF ../../out/Release/obj/third_party/libyuv/libyuv_nacl.gen/pnacl_newlib-pnacl/libyuv_nacl/row_any_67f422e1.o.d -O2 -g -Wall -fdiagnostics-show-option -Werror -Wno-unused-function -Wno-char-subscripts -Wno-c++11-extensions -Wno-unnamed-type-template-args -Wno-extra-semi -Wno-unused-private-field -Wno-char-subscripts -Wno-unused-function -std=gnu++11 -D__STDC_LIMIT_MACROS=1 -D__STDC_FORMAT_MACROS=1 -D_GNU_SOURCE=1 -D_DEFAULT_SOURCE=1 -D_BSD_SOURCE=1 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE=600 -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DDYNAMIC_ANNOTATIONS_PREFIX=NACL_ -DV8_DEPRECATION_WARNINGS -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=239765-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DUSE_PROPRIETARY_CODECS -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DDCHECK_ALWAYS_ON=1 -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DCLD_VERSION=2 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_SERVICE_DISCOVERY=1 -DENABLE_WIFI_BOOTSTRAPPING=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DSAFE_BROWSING_SERVICE -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DNACL_WINDOWS=0 -DNACL_OSX=0 -DNACL_LINUX=0 -DNACL_ANDROID=0 -DNACL_BUILD_ARCH=pnacl -I../../out/Release/gen/tc_pnacl_newlib/include -I../.. -I../../out/Release/gen -Iinclude -DNDEBUG -std=gnu++0x -Wno-deprecated-register
>
> ninja: build stopped: subcommand failed.
>
> Original issue's description:
> > Mac: Make SharedMemoryHandle its own class.
> >
> > This is in prepration for allowing SharedMemoryHandle to be backed by both Mach
> > primitives and POSIX fds. Other than a slight change in the wire format for
> > SharedMemoryHandle on Mac, there are no other intended behavior changes.
> >
> > This CL makes a new file shared_memory_handle.h to hold the now expanded logic
> > for SharedMemoryHandle. This CL forks the file shared_memory_posix.cc to
> > shared_memory_mac.cc, since the implementations are about to heavily diverge.
> >
> > BUG=466437
> > NOPRESUBMIT=true
> >
> > Committed: https://crrev.com/cc9f9127f979acd6eb22103656057a655a0e76a6
> > Cr-Commit-Position: refs/heads/master@{#335360}
>
> TBR=dalecurtis@chromium.org,piman@chromium.org,rsesek@chromium.org,thakis@chromium.org,tsepez@chromium.org,mcasas@chromium.org,reveman@chromium.org,erikchen@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=466437
>
> Committed: https://crrev.com/6035df80f37efa71e92990e6461b85f2c1e92289
> Cr-Commit-Position: refs/heads/master@{#335374}
TBR=dalecurtis@chromium.org,piman@chromium.org,rsesek@chromium.org,thakis@chromium.org,tsepez@chromium.org,mcasas@chromium.org,reveman@chromium.org,erikchen@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=466437
Review URL: https://codereview.chromium.org/1197853004
Cr-Commit-Position: refs/heads/master@{#335375}
CrOS-Libchrome-Original-Commit: d19b4f7125bb0c32d0e7620b127ae7f3d1109686
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 9465141..96bb689 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -57,6 +57,10 @@
class TimeTicks;
class TraceTicks;
struct FileDescriptor;
+
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+class SharedMemoryHandle;
+#endif // defined(OS_MACOSX) && !defined(OS_IOS)
}
namespace IPC {
@@ -467,6 +471,16 @@
};
#endif // defined(OS_POSIX)
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+template <>
+struct IPC_EXPORT ParamTraits<base::SharedMemoryHandle> {
+ typedef base::SharedMemoryHandle param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+#endif
+
template <>
struct IPC_EXPORT ParamTraits<base::FilePath> {
typedef base::FilePath param_type;