2016-10-07 12:31:06 -07:00
|
|
|
|
/**
|
|
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
2016-10-22 09:51:17 -07:00
|
|
|
|
using System.Runtime.InteropServices;
|
2016-10-07 12:31:06 -07:00
|
|
|
|
|
|
|
|
|
namespace Facebook.CSSLayout
|
|
|
|
|
{
|
|
|
|
|
internal static class CSSAssert
|
|
|
|
|
{
|
2016-10-22 09:51:17 -07:00
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
2016-10-07 12:31:06 -07:00
|
|
|
|
public delegate void FailFunc(string message);
|
|
|
|
|
|
|
|
|
|
private static bool _assertInitialized;
|
2016-10-19 11:01:24 -07:00
|
|
|
|
private static FailFunc _failFunc;
|
2016-10-07 12:31:06 -07:00
|
|
|
|
|
|
|
|
|
public static void Initialize()
|
|
|
|
|
{
|
|
|
|
|
if (!_assertInitialized)
|
|
|
|
|
{
|
2016-10-19 11:01:24 -07:00
|
|
|
|
_failFunc = (message) => {
|
2016-10-07 12:31:06 -07:00
|
|
|
|
throw new InvalidOperationException(message);
|
2016-10-19 11:01:24 -07:00
|
|
|
|
};
|
|
|
|
|
Native.CSSAssertSetFailFunc(_failFunc);
|
2016-10-07 12:31:06 -07:00
|
|
|
|
_assertInitialized = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|