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

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

Issue 1938943002: Use v8::Object::CreateDataProperty() for object construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 { 877 {
878 return v8::Function::New(isolate, function, environment); 878 return v8::Function::New(isolate, function, environment);
879 } 879 }
880 880
881 // FIXME: This will be soon embedded in the generated code. 881 // FIXME: This will be soon embedded in the generated code.
882 template<typename Collection> static void indexedPropertyEnumerator(const v8::Pr opertyCallbackInfo<v8::Array>& info) 882 template<typename Collection> static void indexedPropertyEnumerator(const v8::Pr opertyCallbackInfo<v8::Array>& info)
883 { 883 {
884 Collection* collection = toScriptWrappable(info.Holder())->toImpl<Collection >(); 884 Collection* collection = toScriptWrappable(info.Holder())->toImpl<Collection >();
885 int length = collection->length(); 885 int length = collection->length();
886 v8::Local<v8::Array> properties = v8::Array::New(info.GetIsolate(), length); 886 v8::Local<v8::Array> properties = v8::Array::New(info.GetIsolate(), length);
887 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
887 for (int i = 0; i < length; ++i) { 888 for (int i = 0; i < length; ++i) {
888 v8::Local<v8::Integer> integer = v8::Integer::New(info.GetIsolate(), i); 889 v8::Local<v8::Integer> integer = v8::Integer::New(info.GetIsolate(), i);
889 if (!v8CallBoolean(properties->Set(info.GetIsolate()->GetCurrentContext( ), integer, integer))) 890 if (!v8CallBoolean(properties->CreateDataProperty(context, i, integer)))
890 return; 891 return;
891 } 892 }
892 v8SetReturnValue(info, properties); 893 v8SetReturnValue(info, properties);
893 } 894 }
894 895
895 CORE_EXPORT bool isValidEnum(const String& value, const char** validValues, size _t length, const String& enumName, ExceptionState&); 896 CORE_EXPORT bool isValidEnum(const String& value, const char** validValues, size _t length, const String& enumName, ExceptionState&);
896 CORE_EXPORT bool isValidEnum(const Vector<String>& values, const char** validVal ues, size_t length, const String& enumName, ExceptionState&); 897 CORE_EXPORT bool isValidEnum(const Vector<String>& values, const char** validVal ues, size_t length, const String& enumName, ExceptionState&);
897 898
898 // These methods store hidden values into an array that is stored in the interna l field of a DOM wrapper. 899 // These methods store hidden values into an array that is stored in the interna l field of a DOM wrapper.
899 bool addHiddenValueToArray(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Va lue>, int cacheIndex); 900 bool addHiddenValueToArray(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Va lue>, int cacheIndex);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8 ::Local<v8::FunctionTemplate> interfaceTemplate); 937 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8 ::Local<v8::FunctionTemplate> interfaceTemplate);
937 938
938 // Freeze a V8 object. The type of the first parameter and the return value is 939 // Freeze a V8 object. The type of the first parameter and the return value is
939 // intentionally v8::Value so that this function can wrap toV8(). 940 // intentionally v8::Value so that this function can wrap toV8().
940 // If the argument isn't an object, this will crash. 941 // If the argument isn't an object, this will crash.
941 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolate*); 942 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolate*);
942 943
943 } // namespace blink 944 } // namespace blink
944 945
945 #endif // V8Binding_h 946 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptPromise.cpp ('k') | third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698