Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8GCRoot.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCRoot.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCRoot.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d8eda13499703bbe0580c4caef3711d06362f707 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8GCRoot.cpp |
| @@ -0,0 +1,33 @@ |
| +// 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 "bindings/core/v8/V8GCRoot.h" |
| + |
| +#include "wtf/HashSet.h" |
| +#include "wtf/ThreadSpecific.h" |
| +#include "wtf/Threading.h" |
| + |
| +namespace blink { |
| + |
| +namespace { |
| + |
| +HashSet<V8GCRoot*>& gcRoots() |
| +{ |
| + DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<HashSet<V8GCRoot*>>, gcRootSet, new ThreadSpecific<HashSet<V8GCRoot*>>()); |
| + return *gcRootSet; |
| +} |
| + |
| +} // namespace |
| + |
| +V8GCRoot::V8GCRoot() |
| +{ |
| + gcRoots().add(this); |
|
jochen (gone - plz use gerrit)
2016/03/16 08:46:38
we might have to add a ScriptWrappable* parameter
Marcel Hlopko
2016/03/16 09:07:40
I will certainly need a way to get to the ScriptWr
|
| +} |
| + |
| +V8GCRoot::~V8GCRoot() |
| +{ |
| + gcRoots().remove(this); |
| +} |
| + |
| +} // namespace blink |