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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 246 } |
247 | 247 |
248 ScriptValue deserializeIDBValue(DOMRequestState* state, PassRefPtr<SerializedScr
iptValue> prpValue) | 248 ScriptValue deserializeIDBValue(DOMRequestState* state, PassRefPtr<SerializedScr
iptValue> prpValue) |
249 { | 249 { |
250 ASSERT(v8::Context::InContext()); | 250 ASSERT(v8::Context::InContext()); |
251 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); | 251 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); |
252 v8::HandleScope handleScope(isolate); | 252 v8::HandleScope handleScope(isolate); |
253 RefPtr<SerializedScriptValue> serializedValue = prpValue; | 253 RefPtr<SerializedScriptValue> serializedValue = prpValue; |
254 if (serializedValue) | 254 if (serializedValue) |
255 return ScriptValue(serializedValue->deserialize()); | 255 return ScriptValue(serializedValue->deserialize()); |
256 return ScriptValue(v8::Null()); | 256 return ScriptValue(v8::Null(isolate)); |
257 } | 257 } |
258 | 258 |
259 ScriptValue deserializeIDBValueBuffer(DOMRequestState* state, PassRefPtr<SharedB
uffer> prpBuffer) | 259 ScriptValue deserializeIDBValueBuffer(DOMRequestState* state, PassRefPtr<SharedB
uffer> prpBuffer) |
260 { | 260 { |
261 ASSERT(v8::Context::InContext()); | 261 ASSERT(v8::Context::InContext()); |
262 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); | 262 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); |
263 v8::HandleScope handleScope(isolate); | 263 v8::HandleScope handleScope(isolate); |
264 RefPtr<SharedBuffer> buffer = prpBuffer; | 264 RefPtr<SharedBuffer> buffer = prpBuffer; |
265 if (buffer) { | 265 if (buffer) { |
266 // FIXME: The extra copy here can be eliminated by allowing SerializedSc
riptValue to take a raw const char* or const uint8_t*. | 266 // FIXME: The extra copy here can be eliminated by allowing SerializedSc
riptValue to take a raw const char* or const uint8_t*. |
267 Vector<uint8_t> value; | 267 Vector<uint8_t> value; |
268 value.append(buffer->data(), buffer->size()); | 268 value.append(buffer->data(), buffer->size()); |
269 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::c
reateFromWireBytes(value); | 269 RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::c
reateFromWireBytes(value); |
270 return ScriptValue(serializedValue->deserialize()); | 270 return ScriptValue(serializedValue->deserialize()); |
271 } | 271 } |
272 return ScriptValue(v8::Null()); | 272 return ScriptValue(v8::Null(isolate)); |
273 } | 273 } |
274 | 274 |
275 bool injectIDBKeyIntoScriptValue(DOMRequestState* state, PassRefPtr<IDBKey> key,
ScriptValue& value, const IDBKeyPath& keyPath) | 275 bool injectIDBKeyIntoScriptValue(DOMRequestState* state, PassRefPtr<IDBKey> key,
ScriptValue& value, const IDBKeyPath& keyPath) |
276 { | 276 { |
277 IDB_TRACE("injectIDBKeyIntoScriptValue"); | 277 IDB_TRACE("injectIDBKeyIntoScriptValue"); |
278 ASSERT(v8::Context::InContext()); | 278 ASSERT(v8::Context::InContext()); |
279 | 279 |
280 ASSERT(keyPath.type() == IDBKeyPath::StringType); | 280 ASSERT(keyPath.type() == IDBKeyPath::StringType); |
281 Vector<String> keyPathElements; | 281 Vector<String> keyPathElements; |
282 IDBKeyPathParseError error; | 282 IDBKeyPathParseError error; |
(...skipping 54 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 |