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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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 "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "platform/weborigin/KURL.h" 8 #include "platform/weborigin/KURL.h"
9 #include "wtf/HashMap.h" 9 #include "wtf/HashMap.h"
10 #include "wtf/text/StringHash.h" 10 #include "wtf/text/StringHash.h"
11 #include <memory>
12 11
13 namespace blink { 12 namespace blink {
14 13
15 typedef HashMap<String, std::unique_ptr<V8DOMActivityLogger>> DOMActivityLoggerM apForMainWorld; 14 typedef HashMap<String, OwnPtr<V8DOMActivityLogger>> DOMActivityLoggerMapForMain World;
16 typedef HashMap<int, std::unique_ptr<V8DOMActivityLogger>, WTF::IntHash<int>, WT F::UnsignedWithZeroKeyHashTraits<int>> DOMActivityLoggerMapForIsolatedWorld; 15 typedef HashMap<int, OwnPtr<V8DOMActivityLogger>, WTF::IntHash<int>, WTF::Unsign edWithZeroKeyHashTraits<int>> DOMActivityLoggerMapForIsolatedWorld;
17 16
18 static DOMActivityLoggerMapForMainWorld& domActivityLoggersForMainWorld() 17 static DOMActivityLoggerMapForMainWorld& domActivityLoggersForMainWorld()
19 { 18 {
20 ASSERT(isMainThread()); 19 ASSERT(isMainThread());
21 DEFINE_STATIC_LOCAL(DOMActivityLoggerMapForMainWorld, map, ()); 20 DEFINE_STATIC_LOCAL(DOMActivityLoggerMapForMainWorld, map, ());
22 return map; 21 return map;
23 } 22 }
24 23
25 static DOMActivityLoggerMapForIsolatedWorld& domActivityLoggersForIsolatedWorld( ) 24 static DOMActivityLoggerMapForIsolatedWorld& domActivityLoggersForIsolatedWorld( )
26 { 25 {
27 ASSERT(isMainThread()); 26 ASSERT(isMainThread());
28 DEFINE_STATIC_LOCAL(DOMActivityLoggerMapForIsolatedWorld, map, ()); 27 DEFINE_STATIC_LOCAL(DOMActivityLoggerMapForIsolatedWorld, map, ());
29 return map; 28 return map;
30 } 29 }
31 30
32 void V8DOMActivityLogger::setActivityLogger(int worldId, const String& extension Id, std::unique_ptr<V8DOMActivityLogger> logger) 31 void V8DOMActivityLogger::setActivityLogger(int worldId, const String& extension Id, PassOwnPtr<V8DOMActivityLogger> logger)
33 { 32 {
34 if (worldId) 33 if (worldId)
35 domActivityLoggersForIsolatedWorld().set(worldId, std::move(logger)); 34 domActivityLoggersForIsolatedWorld().set(worldId, std::move(logger));
36 else 35 else
37 domActivityLoggersForMainWorld().set(extensionId, std::move(logger)); 36 domActivityLoggersForMainWorld().set(extensionId, std::move(logger));
38 } 37 }
39 38
40 V8DOMActivityLogger* V8DOMActivityLogger::activityLogger(int worldId, const Stri ng& extensionId) 39 V8DOMActivityLogger* V8DOMActivityLogger::activityLogger(int worldId, const Stri ng& extensionId)
41 { 40 {
42 if (worldId) { 41 if (worldId) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return 0; 101 return 0;
103 102
104 V8PerContextData* contextData = scriptState->perContextData(); 103 V8PerContextData* contextData = scriptState->perContextData();
105 if (!contextData) 104 if (!contextData)
106 return 0; 105 return 0;
107 106
108 return contextData->activityLogger(); 107 return contextData->activityLogger();
109 } 108 }
110 109
111 } // namespace blink 110 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698