OLD | NEW |
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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 | 771 |
772 void crashIfV8IsDead() | 772 void crashIfV8IsDead() |
773 { | 773 { |
774 if (v8::V8::IsDead()) { | 774 if (v8::V8::IsDead()) { |
775 // FIXME: We temporarily deal with V8 internal error situations | 775 // FIXME: We temporarily deal with V8 internal error situations |
776 // such as out-of-memory by crashing the renderer. | 776 // such as out-of-memory by crashing the renderer. |
777 CRASH(); | 777 CRASH(); |
778 } | 778 } |
779 } | 779 } |
780 | 780 |
| 781 bool isValidEnum(const String value, const char** validValues, size_t length) |
| 782 { |
| 783 for (size_t i = 0; i < length; ++i) { |
| 784 if (value == validValues[i]) |
| 785 return true; |
| 786 } |
| 787 return false; |
| 788 } |
| 789 |
| 790 bool isValidEnum(const Vector<String>& values, const char** validValues, size_t
length) |
| 791 { |
| 792 for (auto value : values) { |
| 793 if (!isValidEnum(value, validValues, length)) |
| 794 return false; |
| 795 } |
| 796 return true; |
| 797 } |
| 798 |
781 v8::Handle<v8::Function> getBoundFunction(v8::Handle<v8::Function> function) | 799 v8::Handle<v8::Function> getBoundFunction(v8::Handle<v8::Function> function) |
782 { | 800 { |
783 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); | 801 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); |
784 return boundFunction->IsFunction() ? v8::Handle<v8::Function>::Cast(boundFun
ction) : function; | 802 return boundFunction->IsFunction() ? v8::Handle<v8::Function>::Cast(boundFun
ction) : function; |
785 } | 803 } |
786 | 804 |
787 void addHiddenValueToArray(v8::Isolate* isolate, v8::Handle<v8::Object> object,
v8::Local<v8::Value> value, int arrayIndex) | 805 void addHiddenValueToArray(v8::Isolate* isolate, v8::Handle<v8::Object> object,
v8::Local<v8::Value> value, int arrayIndex) |
788 { | 806 { |
789 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); | 807 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); |
790 if (arrayValue->IsNull() || arrayValue->IsUndefined()) { | 808 if (arrayValue->IsNull() || arrayValue->IsUndefined()) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 v8::Local<v8::Value> data = info.Data(); | 966 v8::Local<v8::Value> data = info.Data(); |
949 ASSERT(data->IsExternal()); | 967 ASSERT(data->IsExternal()); |
950 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); | 968 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); |
951 if (!perContextData) | 969 if (!perContextData) |
952 return; | 970 return; |
953 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 971 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
954 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 972 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
955 } | 973 } |
956 | 974 |
957 } // namespace blink | 975 } // namespace blink |
OLD | NEW |