Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Side by Side Diff: Source/core/inspector/InspectorIdentifiers.h

Issue 1085033003: Introduce InspectorIdentifiers<> and use it to assign/lookup LocalFrame and DocumentLoader (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: win build error fixed Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef InspectorIdentifiers_h
6 #define InspectorIdentifiers_h
7
8 #include "core/dom/WeakIdentifierMap.h"
9 #include "core/inspector/IdentifiersFactory.h"
10
11 namespace blink {
12
13 struct InspectorIdentifierGenerator {
14 using IdentifierType = String;
15 static IdentifierType next()
16 {
17 return IdentifiersFactory::createIdentifier();
18 }
19 };
20
21 template<typename T> class InspectorIdentifiers {
22 public:
23 static String identifier(T* object) { return map().identifier(object); }
24 static T* lookup(const String& identifier) { return map().lookup(identifier) ; }
25
26 private:
27 using IdentifierMap = WeakIdentifierMap<T, InspectorIdentifierGenerator>;
28 InspectorIdentifiers() { }
29
30 static IdentifierMap& map()
31 {
32 DEFINE_STATIC_LOCAL(typename IdentifierMap::ReferenceType, identifierMap , (new IdentifierMap));
33 return *identifierMap;
34 }
35 };
36
37 } // namespace blink
38
39 #endif // #ifndef InspectorIdentifiers_h
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDOMAgent.cpp ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698