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

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

Issue 926563002: Move Iterable.h and Maplike.h to bindings/core/v8/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « Source/bindings/core/v8/Iterable.h ('k') | Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ScriptValue.h" 9 #include "bindings/core/v8/ScriptValue.h"
9 #include "bindings/core/v8/ToV8.h" 10 #include "bindings/core/v8/ToV8.h"
10 #include "core/dom/Iterable.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, const KeyType& key, ExceptionSt ate& exceptionState) 17 bool hasForBinding(ScriptState* scriptState, const KeyType& key, ExceptionSt ate& exceptionState)
18 { 18 {
19 ValueType value; 19 ValueType value;
20 return getMapEntry(scriptState, key, value, exceptionState); 20 return getMapEntry(scriptState, key, value, exceptionState);
21 } 21 }
22 22
23 ScriptValue getForBinding(ScriptState* scriptState, const KeyType& key, Exce ptionState& exceptionState) 23 ScriptValue getForBinding(ScriptState* scriptState, const KeyType& key, Exce ptionState& exceptionState)
24 { 24 {
25 ValueType value; 25 ValueType value;
26 if (getMapEntry(scriptState, key, value, exceptionState)) 26 if (getMapEntry(scriptState, key, value, exceptionState))
27 return ScriptValue(scriptState, toV8(value, scriptState->context()-> Global(), scriptState->isolate())); 27 return ScriptValue(scriptState, toV8(value, scriptState->context()-> Global(), scriptState->isolate()));
28 return ScriptValue(scriptState, v8::Undefined(scriptState->isolate())); 28 return ScriptValue(scriptState, v8::Undefined(scriptState->isolate()));
29 } 29 }
30 30
31 private: 31 private:
32 virtual bool getMapEntry(ScriptState*, const KeyType&, ValueType&, Exception State&) = 0; 32 virtual bool getMapEntry(ScriptState*, const KeyType&, ValueType&, Exception State&) = 0;
33 }; 33 };
34 34
35 } // namespace blink 35 } // namespace blink
36 36
37 #endif // Maplike_h 37 #endif // Maplike_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/Iterable.h ('k') | Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698