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

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

Issue 2709983004: WIP bindings: Add support for the record<K,V> WebIDL type. (Closed)
Patch Set: Rebased patch using NativeValueTraits for IDL types Created 3 years, 9 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 exceptionState.rethrowV8Exception(block.Exception()); 890 exceptionState.rethrowV8Exception(block.Exception());
891 return v8::Local<v8::Object>(); 891 return v8::Local<v8::Object>();
892 } 892 }
893 if (!iterator->IsObject()) { 893 if (!iterator->IsObject()) {
894 exceptionState.throwTypeError("Iterator is not an object."); 894 exceptionState.throwTypeError("Iterator is not an object.");
895 return v8::Local<v8::Object>(); 895 return v8::Local<v8::Object>();
896 } 896 }
897 return iterator.As<v8::Object>(); 897 return iterator.As<v8::Object>();
898 } 898 }
899 899
900 v8::MaybeLocal<v8::String> getStringValueInArray(v8::Local<v8::Context> context,
901 v8::Local<v8::Array> array,
902 uint32_t index) {
903 v8::Local<v8::Value> value;
904 if (!array->Get(context, index).ToLocal(&value))
905 return v8::MaybeLocal<v8::String>();
906 return value->ToString(context);
907 }
908
909 bool isPropertyEnumerable(v8::Isolate* isolate,
910 v8::Local<v8::Value> descriptor,
911 ExceptionState& exceptionState) {
912 if (descriptor->IsUndefined())
913 return false;
914 if (!descriptor->IsObject())
915 return false;
916 v8::Local<v8::Value> enumerable;
917 if (!v8::Local<v8::Object>::Cast(descriptor)
918 ->Get(isolate->GetCurrentContext(), v8String(isolate, "enumerable"))
919 .ToLocal(&enumerable))
920 return false;
921 return toBoolean(isolate, enumerable, exceptionState);
922 }
923
900 bool addHiddenValueToArray(v8::Isolate* isolate, 924 bool addHiddenValueToArray(v8::Isolate* isolate,
901 v8::Local<v8::Object> object, 925 v8::Local<v8::Object> object,
902 v8::Local<v8::Value> value, 926 v8::Local<v8::Value> value,
903 int arrayIndex) { 927 int arrayIndex) {
904 ASSERT(!value.IsEmpty()); 928 ASSERT(!value.IsEmpty());
905 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); 929 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex);
906 if (arrayValue->IsNull() || arrayValue->IsUndefined()) { 930 if (arrayValue->IsNull() || arrayValue->IsUndefined()) {
907 arrayValue = v8::Array::New(isolate); 931 arrayValue = v8::Array::New(isolate);
908 object->SetInternalField(arrayIndex, arrayValue); 932 object->SetInternalField(arrayIndex, arrayValue);
909 } 933 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), 1005 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)),
982 parsed, tryCatch)) { 1006 parsed, tryCatch)) {
983 if (tryCatch.HasCaught()) 1007 if (tryCatch.HasCaught())
984 exceptionState.rethrowV8Exception(tryCatch.Exception()); 1008 exceptionState.rethrowV8Exception(tryCatch.Exception());
985 } 1009 }
986 1010
987 return parsed; 1011 return parsed;
988 } 1012 }
989 1013
990 } // namespace blink 1014 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698