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

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

Issue 1125683002: Avoid nearly identical toImplArray() and toImplHeapArray() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return false; 327 return false;
328 328
329 if (!v8Value->IsArray()) 329 if (!v8Value->IsArray())
330 return false; 330 return false;
331 331
332 v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value); 332 v8::Local<v8::Array> v8Array = v8::Local<v8::Array>::Cast(v8Value);
333 for (size_t i = 0; i < v8Array->Length(); ++i) { 333 for (size_t i = 0; i < v8Array->Length(); ++i) {
334 v8::Local<v8::Value> v8IndexedValue; 334 v8::Local<v8::Value> v8IndexedValue;
335 if (!v8Array->Get(dictionary.v8Context(), v8::Uint32::New(dictionary.iso late(), i)).ToLocal(&v8IndexedValue)) 335 if (!v8Array->Get(dictionary.v8Context(), v8::Uint32::New(dictionary.iso late(), i)).ToLocal(&v8IndexedValue))
336 return false; 336 return false;
337 Vector<String> indexedValue = toImplArray<String>(v8IndexedValue, i, dic tionary.isolate(), exceptionState); 337 Vector<String> indexedValue = toImplArray<Vector<String>>(v8IndexedValue , i, dictionary.isolate(), exceptionState);
338 if (exceptionState.hadException()) 338 if (exceptionState.hadException())
339 return false; 339 return false;
340 value.append(indexedValue); 340 value.append(indexedValue);
341 } 341 }
342 342
343 return true; 343 return true;
344 } 344 }
345 345
346 template <> 346 template <>
347 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, Vector<String>& value) 347 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, Vector<String>& value)
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), context.exceptionState()); 542 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), context.exceptionState());
543 543
544 if (context.exceptionState().throwIfNeeded()) 544 if (context.exceptionState().throwIfNeeded())
545 return false; 545 return false;
546 546
547 return true; 547 return true;
548 } 548 }
549 549
550 } // namespace blink 550 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698