| OLD | NEW |
| 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 Loading... |
| 901 | 901 |
| 902 inline bool isUndefinedOrNull(v8::Local<v8::Value> value) | 902 inline bool isUndefinedOrNull(v8::Local<v8::Value> value) |
| 903 { | 903 { |
| 904 return value.IsEmpty() || value->IsNull() || value->IsUndefined(); | 904 return value.IsEmpty() || value->IsNull() || value->IsUndefined(); |
| 905 } | 905 } |
| 906 v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function>); | 906 v8::Local<v8::Function> getBoundFunction(v8::Local<v8::Function>); |
| 907 | 907 |
| 908 // Attaches |environment| to |function| and returns it. | 908 // Attaches |environment| to |function| and returns it. |
| 909 inline v8::Local<v8::Function> createClosure(v8::FunctionCallback function, v8::
Local<v8::Value> environment, v8::Isolate* isolate) | 909 inline v8::Local<v8::Function> createClosure(v8::FunctionCallback function, v8::
Local<v8::Value> environment, v8::Isolate* isolate) |
| 910 { | 910 { |
| 911 return v8::Function::New(isolate, function, environment); | 911 return v8::Function::New(isolate->GetCurrentContext(), function, environment
, 0, v8::ConstructorBehavior::kThrow).ToLocalChecked(); |
| 912 } | 912 } |
| 913 | 913 |
| 914 // FIXME: This will be soon embedded in the generated code. | 914 // FIXME: This will be soon embedded in the generated code. |
| 915 template<typename Collection> static void indexedPropertyEnumerator(const v8::Pr
opertyCallbackInfo<v8::Array>& info) | 915 template<typename Collection> static void indexedPropertyEnumerator(const v8::Pr
opertyCallbackInfo<v8::Array>& info) |
| 916 { | 916 { |
| 917 Collection* collection = toScriptWrappable(info.Holder())->toImpl<Collection
>(); | 917 Collection* collection = toScriptWrappable(info.Holder())->toImpl<Collection
>(); |
| 918 int length = collection->length(); | 918 int length = collection->length(); |
| 919 v8::Local<v8::Array> properties = v8::Array::New(info.GetIsolate(), length); | 919 v8::Local<v8::Array> properties = v8::Array::New(info.GetIsolate(), length); |
| 920 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); | 920 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); |
| 921 for (int i = 0; i < length; ++i) { | 921 for (int i = 0; i < length; ++i) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); | 970 typedef void (*InstallTemplateFunction)(v8::Isolate*, const DOMWrapperWorld&, v8
::Local<v8::FunctionTemplate> interfaceTemplate); |
| 971 | 971 |
| 972 // Freeze a V8 object. The type of the first parameter and the return value is | 972 // Freeze a V8 object. The type of the first parameter and the return value is |
| 973 // intentionally v8::Value so that this function can wrap toV8(). | 973 // intentionally v8::Value so that this function can wrap toV8(). |
| 974 // If the argument isn't an object, this will crash. | 974 // If the argument isn't an object, this will crash. |
| 975 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat
e*); | 975 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, v8::Isolat
e*); |
| 976 | 976 |
| 977 } // namespace blink | 977 } // namespace blink |
| 978 | 978 |
| 979 #endif // V8Binding_h | 979 #endif // V8Binding_h |
| OLD | NEW |