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

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

Issue 661453004: Add getPropertyNames to v8 Dictionaries and make use of in Keyframes processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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/Dictionary.h ('k') | Source/core/animation/EffectInput.cpp » ('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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 v8::Local<v8::String> key = properties->Get(i)->ToString(); 257 v8::Local<v8::String> key = properties->Get(i)->ToString();
258 if (!options->Has(key)) 258 if (!options->Has(key))
259 continue; 259 continue;
260 TOSTRING_DEFAULT(V8StringResource<>, stringKey, key, false); 260 TOSTRING_DEFAULT(V8StringResource<>, stringKey, key, false);
261 names.append(stringKey); 261 names.append(stringKey);
262 } 262 }
263 263
264 return true; 264 return true;
265 } 265 }
266 266
267 bool Dictionary::getPropertyNames(Vector<String>& names) const
268 {
269 if (!isObject())
270 return false;
271
272 v8::Handle<v8::Object> options = m_options->ToObject();
273 if (options.IsEmpty())
274 return false;
275
276 v8::Local<v8::Array> properties = options->GetPropertyNames();
277 if (properties.IsEmpty())
278 return true;
279 for (uint32_t i = 0; i < properties->Length(); ++i) {
280 v8::Local<v8::String> key = properties->Get(i)->ToString();
281 if (!options->Has(key))
282 continue;
283 TOSTRING_DEFAULT(V8StringResource<>, stringKey, key, false);
284 names.append(stringKey);
285 }
286
287 return true;
288 }
289
267 void Dictionary::ConversionContext::resetPerPropertyContext() 290 void Dictionary::ConversionContext::resetPerPropertyContext()
268 { 291 {
269 if (m_dirty) { 292 if (m_dirty) {
270 m_dirty = false; 293 m_dirty = false;
271 m_isNullable = false; 294 m_isNullable = false;
272 m_propertyTypeName = ""; 295 m_propertyTypeName = "";
273 } 296 }
274 } 297 }
275 298
276 Dictionary::ConversionContext& Dictionary::ConversionContext::setConversionType( const String& typeName, bool isNullable) 299 Dictionary::ConversionContext& Dictionary::ConversionContext::setConversionType( const String& typeName, bool isNullable)
277 { 300 {
278 ASSERT(!m_dirty); 301 ASSERT(!m_dirty);
279 m_dirty = true; 302 m_dirty = true;
280 m_isNullable = isNullable; 303 m_isNullable = isNullable;
281 m_propertyTypeName = typeName; 304 m_propertyTypeName = typeName;
282 305
283 return *this; 306 return *this;
284 } 307 }
285 308
286 void Dictionary::ConversionContext::throwTypeError(const String& detail) 309 void Dictionary::ConversionContext::throwTypeError(const String& detail)
287 { 310 {
288 exceptionState().throwTypeError(detail); 311 exceptionState().throwTypeError(detail);
289 } 312 }
290 313
291 } // namespace blink 314 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/Dictionary.h ('k') | Source/core/animation/EffectInput.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698