View BUCK
csharp_library(
name = 'csslibnet46',
dll_name = 'Facebook.CSSLayout/output/net46/Facebook.CSSLayout.dll',
framework_ver = 'net46',
srcs = [
'Facebook.CSSLayout/Properties/AssemblyInfo.cs',
'Facebook.CSSLayout/CSSAlign.cs',
'Facebook.CSSLayout/CSSConstants.cs',
'Facebook.CSSLayout/CSSDimension.cs',
'Facebook.CSSLayout/CSSDirection.cs',
View csslayout.h
/**
* 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.
*/
#pragma once
View csslayout.def
LIBRARY CSSLayout
EXPORTS
CSSNodeCalculateLayout @0
CSSNodeChildCount @1
CSSNodeFree @2
View CSSNode.cs
using System;
namespace CSSLayoutApp
{
public class CSSNode : IDisposable
{
private bool _isDisposed;
private readonly IntPtr _cssNode;
public CSSNode()
View cssnode.cs
using System;
using System.Runtime.InteropServices;
namespace CSSLayoutApp
{
[StructLayout(LayoutKind.Sequential)]
public struct CSSNode
{
public CSSStyle style;
public CSSLayout layout;
View Native.cs
using System;
using System.Runtime.InteropServices;
namespace CSSLayoutApp
{
public static class Native
{
private const string DllName = "CSSLayout.dll";
[DllImport(DllName)]
View struct.h
__declspec(dllexport) typedef struct CSSNode *CSSNodeRef;
__declspec(dllexport) CSSNodeRef CSSNodeNew();
__declspec(dllexport) void CSSNodeInit(const CSSNodeRef node);
__declspec(dllexport) void CSSNodeFree(const CSSNodeRef node);
typedef struct CSSNode {
CSSStyle style;
CSSLayout layout;
uint32_t lineIndex;
View native.cs
using System;
using System.Runtime.InteropServices;
namespace CSSLayoutApp
{
public static class Native
{
[DllImport("CSSLayout.dll")]
public static extern IntPtr CSSNodeNew();
View Logger.cs
private static void PrintMemoryUsage()
{
var appReport = Windows.System.MemoryManager.GetAppMemoryReport();
System.Diagnostics.Debug.WriteLine($"App Report: private: {appReport.PrivateCommitUsage} peak private: {appReport.PeakPrivateCommitUsage} total usage: {appReport.TotalCommitUsage}");
var procReport = Windows.System.MemoryManager.GetProcessMemoryReport();
System.Diagnostics.Debug.WriteLine($"Proc Report: private: {procReport.PrivateWorkingSetUsage} total: {procReport.TotalWorkingSetUsage}");
}
private static System.Diagnostics.Stopwatch GetStopwatch()
View ChakraHost.cpp
#include "pch.h"
#include "ChakraHost.h"
#include "JsStringify.h"
#include "SerializedSourceContext.h"
void ThrowException(const wchar_t* szException)
{
// We ignore error since we're already in an error state.
JsValueRef errorValue;
JsValueRef errorObject;