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

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

Issue 938553003: [DO NOT COMMIT] [DO NOT REVIEW] XHR timeout layout test (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 820 }
821 821
822 v8::Handle<v8::Function> getBoundFunction(v8::Handle<v8::Function> function) 822 v8::Handle<v8::Function> getBoundFunction(v8::Handle<v8::Function> function)
823 { 823 {
824 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); 824 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction();
825 return boundFunction->IsFunction() ? v8::Handle<v8::Function>::Cast(boundFun ction) : function; 825 return boundFunction->IsFunction() ? v8::Handle<v8::Function>::Cast(boundFun ction) : function;
826 } 826 }
827 827
828 void addHiddenValueToArray(v8::Isolate* isolate, v8::Handle<v8::Object> object, v8::Local<v8::Value> value, int arrayIndex) 828 void addHiddenValueToArray(v8::Isolate* isolate, v8::Handle<v8::Object> object, v8::Local<v8::Value> value, int arrayIndex)
829 { 829 {
830 fprintf(stderr, "%s\n", __PRETTY_FUNCTION__);
830 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); 831 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex);
831 if (arrayValue->IsNull() || arrayValue->IsUndefined()) { 832 if (arrayValue->IsNull() || arrayValue->IsUndefined()) {
833 fprintf(stderr, "create new array\n");
832 arrayValue = v8::Array::New(isolate); 834 arrayValue = v8::Array::New(isolate);
833 object->SetInternalField(arrayIndex, arrayValue); 835 object->SetInternalField(arrayIndex, arrayValue);
834 } 836 }
835 837
836 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(arrayValue); 838 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(arrayValue);
837 array->Set(v8::Integer::New(isolate, array->Length()), value); 839 array->Set(v8::Integer::New(isolate, array->Length()), value);
838 } 840 }
839 841
840 void removeHiddenValueFromArray(v8::Isolate* isolate, v8::Handle<v8::Object> obj ect, v8::Local<v8::Value> value, int arrayIndex) 842 void removeHiddenValueFromArray(v8::Isolate* isolate, v8::Handle<v8::Object> obj ect, v8::Local<v8::Value> value, int arrayIndex)
841 { 843 {
842 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); 844 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex);
843 if (!arrayValue->IsArray()) 845 if (!arrayValue->IsArray())
844 return; 846 return;
845 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(arrayValue); 847 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(arrayValue);
846 for (int i = array->Length() - 1; i >= 0; --i) { 848 for (int i = array->Length() - 1; i >= 0; --i) {
847 v8::Local<v8::Value> item = array->Get(v8::Integer::New(isolate, i)); 849 v8::Local<v8::Value> item = array->Get(v8::Integer::New(isolate, i));
848 if (item->StrictEquals(value)) { 850 if (item->StrictEquals(value)) {
849 array->Delete(i); 851 array->Delete(i);
850 return; 852 return;
851 } 853 }
852 } 854 }
853 } 855 }
854 856
855 void moveEventListenerToNewWrapper(v8::Isolate* isolate, v8::Handle<v8::Object> object, EventListener* oldValue, v8::Local<v8::Value> newValue, int arrayIndex) 857 void moveEventListenerToNewWrapper(v8::Isolate* isolate, v8::Handle<v8::Object> object, EventListener* oldValue, v8::Local<v8::Value> newValue, int arrayIndex)
856 { 858 {
859 fprintf(stderr, "%s old = %p\n", __PRETTY_FUNCTION__, oldValue ? V8AbstractE ventListener::cast(oldValue) : oldValue);
857 if (oldValue) { 860 if (oldValue) {
858 V8AbstractEventListener* oldListener = V8AbstractEventListener::cast(old Value); 861 V8AbstractEventListener* oldListener = V8AbstractEventListener::cast(old Value);
859 if (oldListener) { 862 if (oldListener) {
860 v8::Local<v8::Object> oldListenerObject = oldListener->getExistingLi stenerObject(); 863 v8::Local<v8::Object> oldListenerObject = oldListener->getExistingLi stenerObject();
861 if (!oldListenerObject.IsEmpty()) 864 if (!oldListenerObject.IsEmpty())
862 removeHiddenValueFromArray(isolate, object, oldListenerObject, a rrayIndex); 865 removeHiddenValueFromArray(isolate, object, oldListenerObject, a rrayIndex);
863 } 866 }
864 } 867 }
865 // Non-callable input is treated as null and ignored 868 // Non-callable input is treated as null and ignored
866 if (newValue->IsFunction()) 869 if (newValue->IsFunction())
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 996
994 v8::Local<v8::Value> v8IteratorResult(v8::Isolate* isolate, v8::Handle<v8::Value > value) 997 v8::Local<v8::Value> v8IteratorResult(v8::Isolate* isolate, v8::Handle<v8::Value > value)
995 { 998 {
996 v8::Local<v8::Object> result = v8::Object::New(isolate); 999 v8::Local<v8::Object> result = v8::Object::New(isolate);
997 result->Set(v8String(isolate, "value"), value); 1000 result->Set(v8String(isolate, "value"), value);
998 result->Set(v8String(isolate, "done"), v8Boolean(false, isolate)); 1001 result->Set(v8String(isolate, "done"), v8Boolean(false, isolate));
999 return result; 1002 return result;
1000 } 1003 }
1001 1004
1002 } // namespace blink 1005 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8AbstractEventListener.cpp ('k') | Source/bindings/core/v8/V8EventListener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698