| Index: Source/core/inspector/InspectorIdentifiers.h
|
| diff --git a/Source/core/inspector/InspectorIdentifiers.h b/Source/core/inspector/InspectorIdentifiers.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9df2e5ac45eba34c50a3cd7e3fe7d4f70afdfaf0
|
| --- /dev/null
|
| +++ b/Source/core/inspector/InspectorIdentifiers.h
|
| @@ -0,0 +1,39 @@
|
| +// Copyright 2015 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.
|
| +
|
| +#ifndef InspectorIdentifiers_h
|
| +#define InspectorIdentifiers_h
|
| +
|
| +#include "core/dom/WeakIdentifierMap.h"
|
| +#include "core/inspector/IdentifiersFactory.h"
|
| +
|
| +namespace blink {
|
| +
|
| +struct InspectorIdentifierGenerator {
|
| + using IdentifierType = String;
|
| + static IdentifierType next()
|
| + {
|
| + return IdentifiersFactory::createIdentifier();
|
| + }
|
| +};
|
| +
|
| +template<typename T> class InspectorIdentifiers {
|
| +public:
|
| + static String identifier(T* object) { return map().identifier(object); }
|
| + static T* lookup(const String& identifier) { return map().lookup(identifier); }
|
| +
|
| +private:
|
| + using IdentifierMap = WeakIdentifierMap<T, InspectorIdentifierGenerator>;
|
| + InspectorIdentifiers() { }
|
| +
|
| + static IdentifierMap& map()
|
| + {
|
| + DEFINE_STATIC_LOCAL(typename IdentifierMap::ReferenceType, identifierMap, (new IdentifierMap));
|
| + return *identifierMap;
|
| + }
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // #ifndef InspectorIdentifiers_h
|
|
|