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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/Maplike.h

Issue 2595543003: Rename toV8(...) function in Blink to ToV8(...). (Closed)
Patch Set: Rebasing... Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef Maplike_h 5 #ifndef Maplike_h
6 #define Maplike_h 6 #define Maplike_h
7 7
8 #include "bindings/core/v8/Iterable.h" 8 #include "bindings/core/v8/Iterable.h"
9 #include "bindings/core/v8/ScriptValue.h" 9 #include "bindings/core/v8/ScriptValue.h"
10 #include "bindings/core/v8/ToV8.h" 10 #include "bindings/core/v8/ToV8.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 template <typename KeyType, typename ValueType> 14 template <typename KeyType, typename ValueType>
15 class Maplike : public PairIterable<KeyType, ValueType> { 15 class Maplike : public PairIterable<KeyType, ValueType> {
16 public: 16 public:
17 bool hasForBinding(ScriptState* scriptState, 17 bool hasForBinding(ScriptState* scriptState,
18 const KeyType& key, 18 const KeyType& key,
19 ExceptionState& exceptionState) { 19 ExceptionState& exceptionState) {
20 ValueType value; 20 ValueType value;
21 return getMapEntry(scriptState, key, value, exceptionState); 21 return getMapEntry(scriptState, key, value, exceptionState);
22 } 22 }
23 23
24 ScriptValue getForBinding(ScriptState* scriptState, 24 ScriptValue getForBinding(ScriptState* scriptState,
25 const KeyType& key, 25 const KeyType& key,
26 ExceptionState& exceptionState) { 26 ExceptionState& exceptionState) {
27 ValueType value; 27 ValueType value;
28 if (getMapEntry(scriptState, key, value, exceptionState)) 28 if (getMapEntry(scriptState, key, value, exceptionState))
29 return ScriptValue(scriptState, 29 return ScriptValue(scriptState,
30 toV8(value, scriptState->context()->Global(), 30 ToV8(value, scriptState->context()->Global(),
31 scriptState->isolate())); 31 scriptState->isolate()));
32 return ScriptValue(scriptState, v8::Undefined(scriptState->isolate())); 32 return ScriptValue(scriptState, v8::Undefined(scriptState->isolate()));
33 } 33 }
34 34
35 private: 35 private:
36 virtual bool getMapEntry(ScriptState*, 36 virtual bool getMapEntry(ScriptState*,
37 const KeyType&, 37 const KeyType&,
38 ValueType&, 38 ValueType&,
39 ExceptionState&) = 0; 39 ExceptionState&) = 0;
40 }; 40 };
41 41
42 } // namespace blink 42 } // namespace blink
43 43
44 #endif // Maplike_h 44 #endif // Maplike_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698