OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class MediaKeyError; | 52 class MediaKeyError; |
53 class Notification; | 53 class Notification; |
54 class SpeechRecognitionError; | 54 class SpeechRecognitionError; |
55 class SpeechRecognitionResult; | 55 class SpeechRecognitionResult; |
56 class SpeechRecognitionResultList; | 56 class SpeechRecognitionResultList; |
57 class Storage; | 57 class Storage; |
58 class TrackBase; | 58 class TrackBase; |
59 class VoidCallback; | 59 class VoidCallback; |
60 | 60 |
61 class Dictionary { | 61 class Dictionary { |
| 62 ALLOW_ONLY_INLINE_ALLOCATION(); |
62 public: | 63 public: |
63 Dictionary(); | 64 Dictionary(); |
64 Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate*); | 65 Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate*); |
65 ~Dictionary(); | 66 ~Dictionary(); |
66 | 67 |
67 Dictionary& operator=(const Dictionary&); | 68 Dictionary& operator=(const Dictionary&); |
68 | 69 |
69 bool isObject() const; | 70 bool isObject() const; |
70 bool isUndefinedOrNull() const; | 71 bool isUndefinedOrNull() const; |
71 | 72 |
(...skipping 11 matching lines...) Expand all Loading... |
83 bool get(const String&, unsigned long long&) const; | 84 bool get(const String&, unsigned long long&) const; |
84 bool get(const String&, RefPtr<DOMWindow>&) const; | 85 bool get(const String&, RefPtr<DOMWindow>&) const; |
85 bool get(const String&, RefPtrWillBeMember<Storage>&) const; | 86 bool get(const String&, RefPtrWillBeMember<Storage>&) const; |
86 bool get(const String&, MessagePortArray&) const; | 87 bool get(const String&, MessagePortArray&) const; |
87 bool get(const String&, RefPtr<Uint8Array>&) const; | 88 bool get(const String&, RefPtr<Uint8Array>&) const; |
88 bool get(const String&, RefPtr<ArrayBufferView>&) const; | 89 bool get(const String&, RefPtr<ArrayBufferView>&) const; |
89 bool get(const String&, RefPtr<MIDIPort>&) const; | 90 bool get(const String&, RefPtr<MIDIPort>&) const; |
90 bool get(const String&, RefPtr<MediaKeyError>&) const; | 91 bool get(const String&, RefPtr<MediaKeyError>&) const; |
91 bool get(const String&, RefPtr<TrackBase>&) const; | 92 bool get(const String&, RefPtr<TrackBase>&) const; |
92 bool get(const String&, RefPtr<SpeechRecognitionError>&) const; | 93 bool get(const String&, RefPtr<SpeechRecognitionError>&) const; |
93 bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResult>&) const; | 94 bool get(const String&, RefPtrWillBeMember<SpeechRecognitionResult>&) const; |
94 bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResultList>&) co
nst; | 95 bool get(const String&, RefPtrWillBeMember<SpeechRecognitionResultList>&) co
nst; |
95 bool get(const String&, RefPtrWillBeMember<Gamepad>&) const; | 96 bool get(const String&, RefPtrWillBeMember<Gamepad>&) const; |
96 bool get(const String&, RefPtr<MediaStream>&) const; | 97 bool get(const String&, RefPtr<MediaStream>&) const; |
97 bool get(const String&, RefPtr<EventTarget>&) const; | 98 bool get(const String&, RefPtr<EventTarget>&) const; |
98 bool get(const String&, HashSet<AtomicString>&) const; | 99 bool get(const String&, HashSet<AtomicString>&) const; |
99 bool get(const String&, Dictionary&) const; | 100 bool get(const String&, Dictionary&) const; |
100 bool get(const String&, Vector<String>&) const; | 101 bool get(const String&, Vector<String>&) const; |
101 bool get(const String&, ArrayValue&) const; | 102 bool get(const String&, ArrayValue&) const; |
102 bool get(const String&, RefPtrWillBeRawPtr<DOMError>&) const; | 103 bool get(const String&, RefPtrWillBeMember<DOMError>&) const; |
103 bool get(const String&, OwnPtr<VoidCallback>&) const; | 104 bool get(const String&, OwnPtr<VoidCallback>&) const; |
104 bool get(const String&, v8::Local<v8::Value>&) const; | 105 bool get(const String&, v8::Local<v8::Value>&) const; |
105 | 106 |
106 class ConversionContext { | 107 class ConversionContext { |
107 public: | 108 public: |
108 ConversionContext(const String& interfaceName, const String& methodName,
ExceptionState& exceptionState) | 109 ConversionContext(const String& interfaceName, const String& methodName,
ExceptionState& exceptionState) |
109 : m_interfaceName(interfaceName) | 110 : m_interfaceName(interfaceName) |
110 , m_methodName(methodName) | 111 , m_methodName(methodName) |
111 , m_exceptionState(exceptionState) | 112 , m_exceptionState(exceptionState) |
112 , m_dirty(true) | 113 , m_dirty(true) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 template<typename StringType> | 172 template<typename StringType> |
172 bool getStringType(const String&, StringType&) const; | 173 bool getStringType(const String&, StringType&) const; |
173 | 174 |
174 bool getOwnPropertiesAsStringHashMap(HashMap<String, String>&) const; | 175 bool getOwnPropertiesAsStringHashMap(HashMap<String, String>&) const; |
175 bool getOwnPropertyNames(Vector<String>&) const; | 176 bool getOwnPropertyNames(Vector<String>&) const; |
176 | 177 |
177 bool getWithUndefinedOrNullCheck(const String&, String&) const; | 178 bool getWithUndefinedOrNullCheck(const String&, String&) const; |
178 | 179 |
179 bool hasProperty(const String&) const; | 180 bool hasProperty(const String&) const; |
180 | 181 |
181 // Only allow inline allocation. | |
182 void* operator new(size_t, NotNullTag, void* location) { return location; } | |
183 | |
184 private: | 182 private: |
185 // Disallow new allocation. | |
186 void* operator new(size_t); | |
187 | |
188 bool getKey(const String& key, v8::Local<v8::Value>&) const; | 183 bool getKey(const String& key, v8::Local<v8::Value>&) const; |
189 | 184 |
190 v8::Handle<v8::Value> m_options; | 185 v8::Handle<v8::Value> m_options; |
191 v8::Isolate* m_isolate; | 186 v8::Isolate* m_isolate; |
192 }; | 187 }; |
193 | 188 |
194 template<> | 189 template<> |
195 struct NativeValueTraits<Dictionary> { | 190 struct NativeValueTraits<Dictionary> { |
196 static inline Dictionary nativeValue(const v8::Handle<v8::Value>& value, v8:
:Isolate* isolate) | 191 static inline Dictionary nativeValue(const v8::Handle<v8::Value>& value, v8:
:Isolate* isolate) |
197 { | 192 { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) | 340 if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) |
346 return true; | 341 return true; |
347 | 342 |
348 context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does n
ot have a " + context.typeName() + " type.")); | 343 context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does n
ot have a " + context.typeName() + " type.")); |
349 return false; | 344 return false; |
350 } | 345 } |
351 | 346 |
352 } | 347 } |
353 | 348 |
354 #endif // Dictionary_h | 349 #endif // Dictionary_h |
OLD | NEW |