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

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

Issue 2831943002: bindings: Port bindings/core/v8 away from ToImplArray APIs. (Closed)
Patch Set: Check for exception in SerializedScriptValue Created 3 years, 8 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 /* 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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "bindings/core/v8/ArrayValue.h" 26 #include "bindings/core/v8/ArrayValue.h"
27 #include "bindings/core/v8/DictionaryHelperForBindings.h" 27 #include "bindings/core/v8/DictionaryHelperForBindings.h"
28 #include "bindings/core/v8/ExceptionMessages.h" 28 #include "bindings/core/v8/ExceptionMessages.h"
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "bindings/core/v8/IDLTypes.h"
31 #include "bindings/core/v8/NativeValueTraitsImpl.h"
30 #include "bindings/core/v8/V8ArrayBufferView.h" 32 #include "bindings/core/v8/V8ArrayBufferView.h"
31 #include "bindings/core/v8/V8Binding.h" 33 #include "bindings/core/v8/V8Binding.h"
32 #include "bindings/core/v8/V8Element.h" 34 #include "bindings/core/v8/V8Element.h"
33 #include "bindings/core/v8/V8MessagePort.h" 35 #include "bindings/core/v8/V8MessagePort.h"
34 #include "bindings/core/v8/V8TextTrack.h" 36 #include "bindings/core/v8/V8TextTrack.h"
35 #include "bindings/core/v8/V8Uint8Array.h" 37 #include "bindings/core/v8/V8Uint8Array.h"
36 #include "bindings/core/v8/V8VoidCallback.h" 38 #include "bindings/core/v8/V8VoidCallback.h"
37 #include "bindings/core/v8/V8Window.h" 39 #include "bindings/core/v8/V8Window.h"
38 #include "core/html/track/TrackBase.h" 40 #include "core/html/track/TrackBase.h"
39 #include "platform/wtf/MathExtras.h" 41 #include "platform/wtf/MathExtras.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return false; 268 return false;
267 269
268 v8::Local<v8::Array> v8_array = v8::Local<v8::Array>::Cast(v8_value); 270 v8::Local<v8::Array> v8_array = v8::Local<v8::Array>::Cast(v8_value);
269 for (size_t i = 0; i < v8_array->Length(); ++i) { 271 for (size_t i = 0; i < v8_array->Length(); ++i) {
270 v8::Local<v8::Value> v8_indexed_value; 272 v8::Local<v8::Value> v8_indexed_value;
271 if (!v8_array 273 if (!v8_array
272 ->Get(dictionary.V8Context(), 274 ->Get(dictionary.V8Context(),
273 v8::Uint32::New(dictionary.GetIsolate(), i)) 275 v8::Uint32::New(dictionary.GetIsolate(), i))
274 .ToLocal(&v8_indexed_value)) 276 .ToLocal(&v8_indexed_value))
275 return false; 277 return false;
276 Vector<String> indexed_value = ToImplArray<Vector<String>>( 278 Vector<String> indexed_value =
277 v8_indexed_value, i, dictionary.GetIsolate(), exception_state); 279 NativeValueTraits<IDLSequence<IDLString>>::NativeValue(
280 dictionary.GetIsolate(), v8_indexed_value, exception_state);
278 if (exception_state.HadException()) 281 if (exception_state.HadException())
279 return false; 282 return false;
280 value.push_back(indexed_value); 283 value.push_back(indexed_value);
281 } 284 }
282 285
283 return true; 286 return true;
284 } 287 }
285 288
286 template <> 289 template <>
287 CORE_EXPORT bool DictionaryHelper::Get(const Dictionary& dictionary, 290 CORE_EXPORT bool DictionaryHelper::Get(const Dictionary& dictionary,
(...skipping 19 matching lines...) Expand all
307 DOMUint8Array*& value) { 310 DOMUint8Array*& value) {
308 v8::Local<v8::Value> v8_value; 311 v8::Local<v8::Value> v8_value;
309 if (!dictionary.Get(key, v8_value)) 312 if (!dictionary.Get(key, v8_value))
310 return false; 313 return false;
311 314
312 value = V8Uint8Array::toImplWithTypeCheck(dictionary.GetIsolate(), v8_value); 315 value = V8Uint8Array::toImplWithTypeCheck(dictionary.GetIsolate(), v8_value);
313 return true; 316 return true;
314 } 317 }
315 318
316 } // namespace blink 319 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698