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

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

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

Powered by Google App Engine
This is Rietveld 408576698