Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 if (!impl) | 109 if (!impl) |
| 110 return v8::Null(isolate); | 110 return v8::Null(isolate); |
| 111 | 111 |
| 112 switch (impl->type()) { | 112 switch (impl->type()) { |
| 113 case IDBAny::UndefinedType: | 113 case IDBAny::UndefinedType: |
| 114 return v8::Undefined(isolate); | 114 return v8::Undefined(isolate); |
| 115 case IDBAny::NullType: | 115 case IDBAny::NullType: |
| 116 return v8::Null(isolate); | 116 return v8::Null(isolate); |
| 117 case IDBAny::DOMStringListType: | 117 case IDBAny::DOMStringListType: |
| 118 return toV8(impl->domStringList(), creationContext, isolate); | 118 return toV8(impl->domStringList(), creationContext, isolate); |
| 119 case IDBAny::IDBCursorType: { | 119 case IDBAny::IDBCursorType: |
| 120 // Ensure request wrapper is kept alive at least as long as the cursor w rapper, | 120 return toV8(impl->idbCursor(), creationContext, isolate); |
| 121 // so that event listeners are retained. | 121 case IDBAny::IDBCursorWithValueType: |
| 122 v8::Local<v8::Value> cursor = toV8(impl->idbCursor(), creationContext, i solate); | 122 return toV8(impl->idbCursorWithValue(), creationContext, isolate); |
| 123 v8::Local<v8::Value> request = toV8(impl->idbCursor()->request(), creati onContext, isolate); | |
| 124 | |
| 125 // FIXME: Due to race at worker shutdown, V8 may return empty handles. | |
|
jsbell
2015/02/13 19:28:00
Hopefully we're already handling this in the gener
| |
| 126 if (!cursor.IsEmpty()) | |
| 127 V8HiddenValue::setHiddenValue(isolate, cursor->ToObject(isolate), V8 HiddenValue::idbCursorRequest(isolate), request); | |
| 128 return cursor; | |
| 129 } | |
| 130 case IDBAny::IDBCursorWithValueType: { | |
| 131 // Ensure request wrapper is kept alive at least as long as the cursor w rapper, | |
| 132 // so that event listeners are retained. | |
| 133 v8::Local<v8::Value> cursor = toV8(impl->idbCursorWithValue(), creationC ontext, isolate); | |
| 134 v8::Local<v8::Value> request = toV8(impl->idbCursorWithValue()->request( ), creationContext, isolate); | |
| 135 | |
| 136 // FIXME: Due to race at worker shutdown, V8 may return empty handles. | |
| 137 if (!cursor.IsEmpty()) | |
| 138 V8HiddenValue::setHiddenValue(isolate, cursor->ToObject(isolate), V8 HiddenValue::idbCursorRequest(isolate), request); | |
| 139 return cursor; | |
| 140 } | |
| 141 case IDBAny::IDBDatabaseType: | 123 case IDBAny::IDBDatabaseType: |
| 142 return toV8(impl->idbDatabase(), creationContext, isolate); | 124 return toV8(impl->idbDatabase(), creationContext, isolate); |
| 143 case IDBAny::IDBIndexType: | 125 case IDBAny::IDBIndexType: |
| 144 return toV8(impl->idbIndex(), creationContext, isolate); | 126 return toV8(impl->idbIndex(), creationContext, isolate); |
| 145 case IDBAny::IDBObjectStoreType: | 127 case IDBAny::IDBObjectStoreType: |
| 146 return toV8(impl->idbObjectStore(), creationContext, isolate); | 128 return toV8(impl->idbObjectStore(), creationContext, isolate); |
| 147 case IDBAny::BufferType: | 129 case IDBAny::BufferType: |
| 148 return deserializeIDBValueBuffer(isolate, impl->buffer(), impl->blobInfo ()); | 130 return deserializeIDBValueBuffer(isolate, impl->buffer(), impl->blobInfo ()); |
| 149 case IDBAny::IntegerType: | 131 case IDBAny::IntegerType: |
| 150 return v8::Number::New(isolate, impl->integer()); | 132 return v8::Number::New(isolate, impl->integer()); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 const bool allowExperimentalTypes = true; | 440 const bool allowExperimentalTypes = true; |
| 459 IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate, scriptValue, keyPath, allowExperimentalTypes); | 441 IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate, scriptValue, keyPath, allowExperimentalTypes); |
| 460 ASSERT(!expectedKey || expectedKey->isEqual(key)); | 442 ASSERT(!expectedKey || expectedKey->isEqual(key)); |
| 461 | 443 |
| 462 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptVa lue.v8Value(), keyPath); | 444 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptVa lue.v8Value(), keyPath); |
| 463 ASSERT_UNUSED(injected, injected); | 445 ASSERT_UNUSED(injected, injected); |
| 464 } | 446 } |
| 465 #endif | 447 #endif |
| 466 | 448 |
| 467 } // namespace blink | 449 } // namespace blink |
| OLD | NEW |