diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-07-14 17:41:05 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-08-04 12:37:36 +0000 |
commit | 399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch) | |
tree | 6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/sandbox/mac | |
parent | 7366110654eec46f21b6824f302356426f48cd74 (diff) | |
download | qtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz |
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/sandbox/mac')
-rw-r--r-- | chromium/sandbox/mac/BUILD.gn | 10 | ||||
-rw-r--r-- | chromium/sandbox/mac/os_compatibility.cc | 2 | ||||
-rw-r--r-- | chromium/sandbox/mac/sandbox_mac.gypi | 20 | ||||
-rw-r--r-- | chromium/sandbox/mac/seatbelt.cc | 46 | ||||
-rw-r--r-- | chromium/sandbox/mac/seatbelt.h | 36 | ||||
-rw-r--r-- | chromium/sandbox/mac/seatbelt_export.h | 22 |
6 files changed, 135 insertions, 1 deletions
diff --git a/chromium/sandbox/mac/BUILD.gn b/chromium/sandbox/mac/BUILD.gn index c317cefddbf..fd53131dbbd 100644 --- a/chromium/sandbox/mac/BUILD.gn +++ b/chromium/sandbox/mac/BUILD.gn @@ -33,6 +33,16 @@ component("sandbox") { ] } +component("seatbelt") { + sources = [ + "seatbelt.cc", + "seatbelt.h", + "seatbelt_export.h", + ] + libs = [ "sandbox" ] + defines = [ "SEATBELT_IMPLEMENTATION" ] +} + test("sandbox_mac_unittests") { sources = [ "bootstrap_sandbox_unittest.mm", diff --git a/chromium/sandbox/mac/os_compatibility.cc b/chromium/sandbox/mac/os_compatibility.cc index 538efef9b90..42abe293d04 100644 --- a/chromium/sandbox/mac/os_compatibility.cc +++ b/chromium/sandbox/mac/os_compatibility.cc @@ -181,7 +181,7 @@ class OSCompatibility_10_10 : public OSCompatibility { // static std::unique_ptr<OSCompatibility> OSCompatibility::CreateForPlatform() { - if (base::mac::IsOSLionOrLater() && base::mac::IsOSMavericksOrEarlier()) + if (base::mac::IsOSMavericksOrEarlier()) return base::WrapUnique(new OSCompatibility_10_7()); else return base::WrapUnique(new OSCompatibility_10_10()); diff --git a/chromium/sandbox/mac/sandbox_mac.gypi b/chromium/sandbox/mac/sandbox_mac.gypi index 13aa4039c9f..79740e5a846 100644 --- a/chromium/sandbox/mac/sandbox_mac.gypi +++ b/chromium/sandbox/mac/sandbox_mac.gypi @@ -5,6 +5,26 @@ { 'targets': [ { + 'target_name': 'seatbelt', + 'type' : '<(component)', + 'sources': [ + 'seatbelt.cc', + 'seatbelt.h', + 'seatbelt_export.h', + ], + 'defines': [ + 'SEATBELT_IMPLEMENTATION', + ], + 'include_dirs': [ + '../..', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/usr/lib/libsandbox.dylib', + ], + } + }, + { 'target_name': 'sandbox', 'type': '<(component)', 'sources': [ diff --git a/chromium/sandbox/mac/seatbelt.cc b/chromium/sandbox/mac/seatbelt.cc new file mode 100644 index 00000000000..c2028d5bb33 --- /dev/null +++ b/chromium/sandbox/mac/seatbelt.cc @@ -0,0 +1,46 @@ +// Copyright 2016 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 "sandbox/mac/seatbelt.h" + +extern "C" { +#include <sandbox.h> + +int sandbox_init_with_parameters(const char* profile, + uint64_t flags, + const char* const parameters[], + char** errorbuf); +}; + +namespace sandbox { + +// static +int Seatbelt::Init(const char* profile, uint64_t flags, char** errorbuf) { +// OS X deprecated these functions, but did not provide a suitable replacement, +// so ignore the deprecation warning. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + return ::sandbox_init(profile, flags, errorbuf); +#pragma clang diagnostic pop +} + +// static +int Seatbelt::InitWithParams(const char* profile, + uint64_t flags, + const char* const parameters[], + char** errorbuf) { + return ::sandbox_init_with_parameters(profile, flags, parameters, errorbuf); +} + +// static +void Seatbelt::FreeError(char* errorbuf) { +// OS X deprecated these functions, but did not provide a suitable replacement, +// so ignore the deprecation warning. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + return ::sandbox_free_error(errorbuf); +#pragma clang diagnostic pop +} + +} // namespace sandbox diff --git a/chromium/sandbox/mac/seatbelt.h b/chromium/sandbox/mac/seatbelt.h new file mode 100644 index 00000000000..c5dd386bfe2 --- /dev/null +++ b/chromium/sandbox/mac/seatbelt.h @@ -0,0 +1,36 @@ +// Copyright 2016 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 SANDBOX_MAC_SEATBELT_H_ +#define SANDBOX_MAC_SEATBELT_H_ + +#include <cstdint> + +#include "base/macros.h" +#include "sandbox/mac/seatbelt_export.h" + +namespace sandbox { + +// This class exists because OS X deprecated the sandbox functions, +// and did not supply replacements that are suitable for Chrome. +// This class wraps the functions in deprecation warning supressions. +class SEATBELT_EXPORT Seatbelt { + public: + static int Init(const char* profile, uint64_t flags, char** errorbuf); + + static int InitWithParams(const char* profile, + uint64_t flags, + const char* const parameters[], + char** errorbuf); + + static void FreeError(char* errorbuf); + + private: + Seatbelt(); + DISALLOW_COPY_AND_ASSIGN(Seatbelt); +}; + +} // sandbox + +#endif // SANDBOX_MAC_SEATBELT_H_ diff --git a/chromium/sandbox/mac/seatbelt_export.h b/chromium/sandbox/mac/seatbelt_export.h new file mode 100644 index 00000000000..5f974762892 --- /dev/null +++ b/chromium/sandbox/mac/seatbelt_export.h @@ -0,0 +1,22 @@ +// Copyright 2016 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 SANDBOX_MAC_SEATBELT_EXPORT_H_ +#define SANDBOX_MAC_SEATBELT_EXPORT_H_ + +#if defined(COMPONENT_BUILD) + +#if defined(SEATBELT_IMPLEMENTATION) +#define SEATBELT_EXPORT __attribute__((visibility("default"))) +#else +#define SEATBELT_EXPORT +#endif // defined(SEATBELT_IMPLEMENTATION) + +#else // defined(COMPONENT_BUILD) + +#define SEATBELT_EXPORT + +#endif // defined(COMPONENT_BUILD) + +#endif // SANDBOX_MAC_SEATBELT_EXPORT_H_ |