OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "bindings/core/v8/V8DOMActivityLogger.h" | 5 #include "bindings/core/v8/V8DOMActivityLogger.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
9 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" |
10 #include "platform/wtf/HashMap.h" | 10 #include "platform/wtf/HashMap.h" |
11 #include "platform/wtf/text/StringHash.h" | 11 #include "platform/wtf/text/StringHash.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 typedef HashMap<String, std::unique_ptr<V8DOMActivityLogger>> | 15 typedef HashMap<String, std::unique_ptr<V8DOMActivityLogger>> |
16 DOMActivityLoggerMapForMainWorld; | 16 DOMActivityLoggerMapForMainWorld; |
17 typedef HashMap<int, | 17 typedef HashMap<int, |
18 std::unique_ptr<V8DOMActivityLogger>, | 18 std::unique_ptr<V8DOMActivityLogger>, |
19 WTF::IntHash<int>, | 19 WTF::IntHash<int>, |
20 WTF::UnsignedWithZeroKeyHashTraits<int>> | 20 WTF::UnsignedWithZeroKeyHashTraits<int>> |
21 DOMActivityLoggerMapForIsolatedWorld; | 21 DOMActivityLoggerMapForIsolatedWorld; |
22 | 22 |
23 static DOMActivityLoggerMapForMainWorld& DomActivityLoggersForMainWorld() { | 23 static DOMActivityLoggerMapForMainWorld& DomActivityLoggersForMainWorld() { |
24 ASSERT(IsMainThread()); | 24 DCHECK(IsMainThread()); |
25 DEFINE_STATIC_LOCAL(DOMActivityLoggerMapForMainWorld, map, ()); | 25 DEFINE_STATIC_LOCAL(DOMActivityLoggerMapForMainWorld, map, ()); |
26 return map; | 26 return map; |
27 } | 27 } |
28 | 28 |
29 static DOMActivityLoggerMapForIsolatedWorld& | 29 static DOMActivityLoggerMapForIsolatedWorld& |
30 DomActivityLoggersForIsolatedWorld() { | 30 DomActivityLoggersForIsolatedWorld() { |
31 ASSERT(IsMainThread()); | 31 DCHECK(IsMainThread()); |
32 DEFINE_STATIC_LOCAL(DOMActivityLoggerMapForIsolatedWorld, map, ()); | 32 DEFINE_STATIC_LOCAL(DOMActivityLoggerMapForIsolatedWorld, map, ()); |
33 return map; | 33 return map; |
34 } | 34 } |
35 | 35 |
36 void V8DOMActivityLogger::SetActivityLogger( | 36 void V8DOMActivityLogger::SetActivityLogger( |
37 int world_id, | 37 int world_id, |
38 const String& extension_id, | 38 const String& extension_id, |
39 std::unique_ptr<V8DOMActivityLogger> logger) { | 39 std::unique_ptr<V8DOMActivityLogger> logger) { |
40 if (world_id) | 40 if (world_id) |
41 DomActivityLoggersForIsolatedWorld().Set(world_id, std::move(logger)); | 41 DomActivityLoggersForIsolatedWorld().Set(world_id, std::move(logger)); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return 0; | 109 return 0; |
110 | 110 |
111 V8PerContextData* context_data = script_state->PerContextData(); | 111 V8PerContextData* context_data = script_state->PerContextData(); |
112 if (!context_data) | 112 if (!context_data) |
113 return 0; | 113 return 0; |
114 | 114 |
115 return context_data->ActivityLogger(); | 115 return context_data->ActivityLogger(); |
116 } | 116 } |
117 | 117 |
118 } // namespace blink | 118 } // namespace blink |
OLD | NEW |