| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Spec: http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-
def-IDBKeyRange | 47 // Spec: http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-
def-IDBKeyRange |
| 48 return v8Undefined(); | 48 return v8Undefined(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 switch (key->type()) { | 51 switch (key->type()) { |
| 52 case IDBKey::InvalidType: | 52 case IDBKey::InvalidType: |
| 53 case IDBKey::MinType: | 53 case IDBKey::MinType: |
| 54 ASSERT_NOT_REACHED(); | 54 ASSERT_NOT_REACHED(); |
| 55 return v8Undefined(); | 55 return v8Undefined(); |
| 56 case IDBKey::NumberType: | 56 case IDBKey::NumberType: |
| 57 return v8::Number::New(key->number()); | 57 return v8::Number::New(isolate, key->number()); |
| 58 case IDBKey::StringType: | 58 case IDBKey::StringType: |
| 59 return v8String(key->string(), isolate); | 59 return v8String(key->string(), isolate); |
| 60 case IDBKey::DateType: | 60 case IDBKey::DateType: |
| 61 return v8::Date::New(key->date()); | 61 return v8::Date::New(key->date()); |
| 62 case IDBKey::ArrayType: | 62 case IDBKey::ArrayType: |
| 63 { | 63 { |
| 64 v8::Local<v8::Array> array = v8::Array::New(key->array().size()); | 64 v8::Local<v8::Array> array = v8::Array::New(key->array().size()); |
| 65 for (size_t i = 0; i < key->array().size(); ++i) | 65 for (size_t i = 0; i < key->array().size(); ++i) |
| 66 array->Set(i, idbKeyToV8Value(key->array()[i].get(), isolate)); | 66 array->Set(i, idbKeyToV8Value(key->array()[i].get(), isolate)); |
| 67 return array; | 67 return array; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 static bool setValue(v8::Handle<v8::Value>& v8Object, T indexOrName, const v8::H
andle<v8::Value>& v8Value) | 131 static bool setValue(v8::Handle<v8::Value>& v8Object, T indexOrName, const v8::H
andle<v8::Value>& v8Value) |
| 132 { | 132 { |
| 133 v8::Local<v8::Object> object = v8Object->ToObject(); | 133 v8::Local<v8::Object> object = v8Object->ToObject(); |
| 134 return object->Set(indexOrName, v8Value); | 134 return object->Set(indexOrName, v8Value); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static bool get(v8::Handle<v8::Value>& object, const String& keyPathElement, v8:
:Handle<v8::Value>& result, v8::Isolate* isolate) | 137 static bool get(v8::Handle<v8::Value>& object, const String& keyPathElement, v8:
:Handle<v8::Value>& result, v8::Isolate* isolate) |
| 138 { | 138 { |
| 139 if (object->IsString() && keyPathElement == "length") { | 139 if (object->IsString() && keyPathElement == "length") { |
| 140 int32_t length = v8::Handle<v8::String>::Cast(object)->Length(); | 140 int32_t length = v8::Handle<v8::String>::Cast(object)->Length(); |
| 141 result = v8::Number::New(length); | 141 result = v8::Number::New(isolate, length); |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 return object->IsObject() && getValueFrom(v8String(keyPathElement, isolate),
result); | 144 return object->IsObject() && getValueFrom(v8String(keyPathElement, isolate),
result); |
| 145 } | 145 } |
| 146 | 146 |
| 147 static bool canSet(v8::Handle<v8::Value>& object, const String& keyPathElement) | 147 static bool canSet(v8::Handle<v8::Value>& object, const String& keyPathElement) |
| 148 { | 148 { |
| 149 return object->IsObject(); | 149 return object->IsObject(); |
| 150 } | 150 } |
| 151 | 151 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 { | 337 { |
| 338 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); | 338 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); |
| 339 v8::HandleScope handleScope(isolate); | 339 v8::HandleScope handleScope(isolate); |
| 340 v8::Handle<v8::Value> value(scriptValue.v8Value()); | 340 v8::Handle<v8::Value> value(scriptValue.v8Value()); |
| 341 if (V8IDBKeyRange::HasInstance(value, isolate, worldType(isolate))) | 341 if (V8IDBKeyRange::HasInstance(value, isolate, worldType(isolate))) |
| 342 return V8IDBKeyRange::toNative(value.As<v8::Object>()); | 342 return V8IDBKeyRange::toNative(value.As<v8::Object>()); |
| 343 return 0; | 343 return 0; |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace WebCore | 346 } // namespace WebCore |
| OLD | NEW |