SuppressMemoryAllocationErrorAttribute.cs
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//-----------------------------------------------------------------------
// <copyright file="SuppressMemoryAllocationErrorAttribute.cs" company="Google">
// Copyright 2018 Google Inc. All Rights Reserved.
// </copyright>
//-----------------------------------------------------------------------
// This module is used internally by Google for assessing memory allocations in public methods.
// Feel free to disregard all [SuppressMemoryAllocationErrorAttribute] declarations on methods.
namespace Gvr.Internal
{
using System;
using UnityEngine;
/// <summary>
/// A custom Attribute class to annotate functions that are allowed to allocate memory.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public class SuppressMemoryAllocationErrorAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="T:GoogleVR.Internal.SuppressMemoryAllocationErrorAttribute"/> class.
/// </summary>
public SuppressMemoryAllocationErrorAttribute()
{
this.IsWarning = false;
this.Reason = "Unknown";
}
/// <summary>
/// Gets or sets a value indicating whether to show a warning instead of an error.
/// </summary>
public bool IsWarning { get; set; }
/// <summary>
/// Gets or sets the reason for suppressing the memory allocation error.
/// </summary>
public string Reason { get; set; }
}
}