| Index: tools/clang/blink_gc_plugin/tests/legacy_naming/static_singleton.cpp
|
| diff --git a/tools/clang/blink_gc_plugin/tests/legacy_naming/static_singleton.cpp b/tools/clang/blink_gc_plugin/tests/legacy_naming/static_singleton.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..80eb034c1417faa01abf4d01cf93cccbe62c468f
|
| --- /dev/null
|
| +++ b/tools/clang/blink_gc_plugin/tests/legacy_naming/static_singleton.cpp
|
| @@ -0,0 +1,37 @@
|
| +// Copyright 2017 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 "static_singleton.h"
|
| +
|
| +#define DEFINE_STATIC_LOCAL(Type, Name) \
|
| + BLINK_STATIC_SINGLETON() \
|
| + static Persistent<Type> Name(new Type)
|
| +
|
| +namespace blink {
|
| +
|
| +HeapObject& HeapObject::instance() {
|
| + DEFINE_STATIC_LOCAL(HeapObject, object);
|
| + return *object;
|
| +}
|
| +
|
| +namespace {
|
| +
|
| +HeapObject& instance(int i) {
|
| + if (i > 2) {
|
| + DEFINE_STATIC_LOCAL(HeapObject, object);
|
| + return *object;
|
| + }
|
| + DEFINE_STATIC_LOCAL(HeapObject, object);
|
| + return *object;
|
| +}
|
| +
|
| +HeapObject& instance_ignored() {
|
| + GC_PLUGIN_IGNORE("")
|
| + DEFINE_STATIC_LOCAL(HeapObject, object);
|
| + return *object;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +} // namespace blink
|
|
|