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

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

Issue 2173843002: binding: Removes createClosure(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « third_party/WebKit/Source/bindings/core/v8/ScriptFunction.cpp ('k') | no next file » | 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) 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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 // is disabled and it returns true. 901 // is disabled and it returns true.
902 bool handleOutOfMemory(); 902 bool handleOutOfMemory();
903 void crashIfIsolateIsDead(v8::Isolate*); 903 void crashIfIsolateIsDead(v8::Isolate*);
904 904
905 inline bool isUndefinedOrNull(v8::Local<v8::Value> value) 905 inline bool isUndefinedOrNull(v8::Local<v8::Value> value)
906 { 906 {
907 return value.IsEmpty() || value->IsNull() || value->IsUndefined(); 907 return value.IsEmpty() || value->IsNull() || value->IsUndefined();
908 } 908 }
909 v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function>); 909 v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function>);
910 910
911 // Attaches |environment| to |function| and returns it.
912 inline v8::Local<v8::Function> createClosure(v8::FunctionCallback function, v8:: Local<v8::Value> environment, v8::Isolate* isolate)
913 {
914 return v8::Function::New(isolate->GetCurrentContext(), function, environment , 0, v8::ConstructorBehavior::kThrow).ToLocalChecked();
915 }
916
917 // FIXME: This will be soon embedded in the generated code. 911 // FIXME: This will be soon embedded in the generated code.
918 template<typename Collection> static void indexedPropertyEnumerator(const v8::Pr opertyCallbackInfo<v8::Array>& info) 912 template<typename Collection> static void indexedPropertyEnumerator(const v8::Pr opertyCallbackInfo<v8::Array>& info)
919 { 913 {
920 Collection* collection = toScriptWrappable(info.Holder())->toImpl<Collection >(); 914 Collection* collection = toScriptWrappable(info.Holder())->toImpl<Collection >();
921 int length = collection->length(); 915 int length = collection->length();
922 v8::Local<v8::Array> properties = v8::Array::New(info.GetIsolate(), length); 916 v8::Local<v8::Array> properties = v8::Array::New(info.GetIsolate(), length);
923 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); 917 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
924 for (int i = 0; i < length; ++i) { 918 for (int i = 0; i < length; ++i) {
925 v8::Local<v8::Integer> integer = v8::Integer::New(info.GetIsolate(), i); 919 v8::Local<v8::Integer> integer = v8::Integer::New(info.GetIsolate(), i);
926 if (!v8CallBoolean(properties->CreateDataProperty(context, i, integer))) 920 if (!v8CallBoolean(properties->CreateDataProperty(context, i, integer)))
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8 ::Local<v8::FunctionTemplate> interfaceTemplate); 967 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8 ::Local<v8::FunctionTemplate> interfaceTemplate);
974 968
975 // Freeze a V8 object. The type of the first parameter and the return value is 969 // Freeze a V8 object. The type of the first parameter and the return value is
976 // intentionally v8::Value so that this function can wrap toV8(). 970 // intentionally v8::Value so that this function can wrap toV8().
977 // If the argument isn't an object, this will crash. 971 // If the argument isn't an object, this will crash.
978 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat e*); 972 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat e*);
979 973
980 } // namespace blink 974 } // namespace blink
981 975
982 #endif // V8Binding_h 976 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptFunction.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698