OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 wrapper->SetIndexedPropertiesToExternalArrayData(0, v8::kExternalByt
eArray, 0); | 2378 wrapper->SetIndexedPropertiesToExternalArrayData(0, v8::kExternalByt
eArray, 0); |
2379 } | 2379 } |
2380 } | 2380 } |
2381 | 2381 |
2382 PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
e::transferArrayBuffers(ArrayBufferArray& arrayBuffers, bool& didThrow, v8::Isol
ate* isolate) | 2382 PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
e::transferArrayBuffers(ArrayBufferArray& arrayBuffers, bool& didThrow, v8::Isol
ate* isolate) |
2383 { | 2383 { |
2384 ASSERT(arrayBuffers.size()); | 2384 ASSERT(arrayBuffers.size()); |
2385 | 2385 |
2386 for (size_t i = 0; i < arrayBuffers.size(); i++) { | 2386 for (size_t i = 0; i < arrayBuffers.size(); i++) { |
2387 if (arrayBuffers[i]->isNeutered()) { | 2387 if (arrayBuffers[i]->isNeutered()) { |
2388 setDOMException(INVALID_STATE_ERR, isolate); | 2388 setDOMException(InvalidStateError, isolate); |
2389 didThrow = true; | 2389 didThrow = true; |
2390 return nullptr; | 2390 return nullptr; |
2391 } | 2391 } |
2392 } | 2392 } |
2393 | 2393 |
2394 OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContents
Array(arrayBuffers.size())); | 2394 OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContents
Array(arrayBuffers.size())); |
2395 | 2395 |
2396 HashSet<ArrayBuffer*> visited; | 2396 HashSet<ArrayBuffer*> visited; |
2397 for (size_t i = 0; i < arrayBuffers.size(); i++) { | 2397 for (size_t i = 0; i < arrayBuffers.size(); i++) { |
2398 Vector<RefPtr<ArrayBufferView> > neuteredViews; | 2398 Vector<RefPtr<ArrayBufferView> > neuteredViews; |
2399 | 2399 |
2400 if (visited.contains(arrayBuffers[i].get())) | 2400 if (visited.contains(arrayBuffers[i].get())) |
2401 continue; | 2401 continue; |
2402 visited.add(arrayBuffers[i].get()); | 2402 visited.add(arrayBuffers[i].get()); |
2403 | 2403 |
2404 bool result = arrayBuffers[i]->transfer(contents->at(i), neuteredViews); | 2404 bool result = arrayBuffers[i]->transfer(contents->at(i), neuteredViews); |
2405 if (!result) { | 2405 if (!result) { |
2406 setDOMException(INVALID_STATE_ERR, isolate); | 2406 setDOMException(InvalidStateError, isolate); |
2407 didThrow = true; | 2407 didThrow = true; |
2408 return nullptr; | 2408 return nullptr; |
2409 } | 2409 } |
2410 | 2410 |
2411 neuterBinding(arrayBuffers[i].get()); | 2411 neuterBinding(arrayBuffers[i].get()); |
2412 for (size_t j = 0; j < neuteredViews.size(); j++) | 2412 for (size_t j = 0; j < neuteredViews.size(); j++) |
2413 neuterBinding(neuteredViews[j].get()); | 2413 neuterBinding(neuteredViews[j].get()); |
2414 } | 2414 } |
2415 return contents.release(); | 2415 return contents.release(); |
2416 } | 2416 } |
(...skipping 18 matching lines...) Expand all Loading... |
2435 switch (status) { | 2435 switch (status) { |
2436 case Serializer::InputError: | 2436 case Serializer::InputError: |
2437 case Serializer::DataCloneError: | 2437 case Serializer::DataCloneError: |
2438 // If there was an input error, throw a new exception outside | 2438 // If there was an input error, throw a new exception outside |
2439 // of the TryCatch scope. | 2439 // of the TryCatch scope. |
2440 didThrow = true; | 2440 didThrow = true; |
2441 setDOMException(DATA_CLONE_ERR, isolate); | 2441 setDOMException(DATA_CLONE_ERR, isolate); |
2442 return; | 2442 return; |
2443 case Serializer::InvalidStateError: | 2443 case Serializer::InvalidStateError: |
2444 didThrow = true; | 2444 didThrow = true; |
2445 setDOMException(INVALID_STATE_ERR, isolate); | 2445 setDOMException(InvalidStateError, isolate); |
2446 return; | 2446 return; |
2447 case Serializer::JSFailure: | 2447 case Serializer::JSFailure: |
2448 // If there was a JS failure (but no exception), there's not | 2448 // If there was a JS failure (but no exception), there's not |
2449 // much we can do except for unwinding the C++ stack by | 2449 // much we can do except for unwinding the C++ stack by |
2450 // pretending there was a JS exception. | 2450 // pretending there was a JS exception. |
2451 didThrow = true; | 2451 didThrow = true; |
2452 return; | 2452 return; |
2453 case Serializer::Success: | 2453 case Serializer::Success: |
2454 m_data = String(StringImpl::adopt(writer.data())).isolatedCopy(); | 2454 m_data = String(StringImpl::adopt(writer.data())).isolatedCopy(); |
2455 if (arrayBuffers && arrayBuffers->size()) | 2455 if (arrayBuffers && arrayBuffers->size()) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2509 v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externallyAllocatedMemo
ry); | 2509 v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externallyAllocatedMemo
ry); |
2510 } | 2510 } |
2511 } | 2511 } |
2512 | 2512 |
2513 uint32_t SerializedScriptValue::wireFormatVersion() | 2513 uint32_t SerializedScriptValue::wireFormatVersion() |
2514 { | 2514 { |
2515 return WebCore::wireFormatVersion; | 2515 return WebCore::wireFormatVersion; |
2516 } | 2516 } |
2517 | 2517 |
2518 } // namespace WebCore | 2518 } // namespace WebCore |
OLD | NEW |