| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2614 return buffer; | 2614 return buffer; |
| 2615 } | 2615 } |
| 2616 | 2616 |
| 2617 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer( | 2617 PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer( |
| 2618 DOMArrayBuffer* buffer) const { | 2618 DOMArrayBuffer* buffer) const { |
| 2619 String value(static_cast<const UChar*>(buffer->data()), | 2619 String value(static_cast<const UChar*>(buffer->data()), |
| 2620 buffer->byteLength() / sizeof(UChar)); | 2620 buffer->byteLength() / sizeof(UChar)); |
| 2621 return SerializedScriptValue::create(value); | 2621 return SerializedScriptValue::create(value); |
| 2622 } | 2622 } |
| 2623 | 2623 |
| 2624 DOMArrayBuffer* Internals::serializeWithInlineWasm(ScriptValue value) const { |
| 2625 v8::Isolate* isolate = value.isolate(); |
| 2626 ExceptionState exceptionState(isolate, ExceptionState::ExecutionContext, |
| 2627 "Internals", "serializeWithInlineWasm"); |
| 2628 v8::Local<v8::Value> v8Value = value.v8Value(); |
| 2629 SerializedScriptValue::SerializeOptions options; |
| 2630 options.writeWasmToStream = true; |
| 2631 RefPtr<SerializedScriptValue> obj = SerializedScriptValue::serialize( |
| 2632 isolate, v8Value, options, exceptionState); |
| 2633 if (exceptionState.hadException()) |
| 2634 return nullptr; |
| 2635 return serializeObject(obj); |
| 2636 } |
| 2637 |
| 2638 ScriptValue Internals::deserializeBufferContainingWasm( |
| 2639 ScriptState* state, |
| 2640 DOMArrayBuffer* buffer) const { |
| 2641 String value(static_cast<const UChar*>(buffer->data()), |
| 2642 buffer->byteLength() / sizeof(UChar)); |
| 2643 DummyExceptionStateForTesting exceptionState; |
| 2644 SerializedScriptValue::DeserializeOptions options; |
| 2645 options.readWasmFromStream = true; |
| 2646 return ScriptValue::from( |
| 2647 state, SerializedScriptValue::create(value)->deserialize(state->isolate(), |
| 2648 options)); |
| 2649 } |
| 2650 |
| 2624 void Internals::forceReload(bool bypassCache) { | 2651 void Internals::forceReload(bool bypassCache) { |
| 2625 if (!frame()) | 2652 if (!frame()) |
| 2626 return; | 2653 return; |
| 2627 | 2654 |
| 2628 frame()->reload( | 2655 frame()->reload( |
| 2629 bypassCache ? FrameLoadTypeReloadBypassingCache : FrameLoadTypeReload, | 2656 bypassCache ? FrameLoadTypeReloadBypassingCache : FrameLoadTypeReload, |
| 2630 ClientRedirectPolicy::NotClientRedirect); | 2657 ClientRedirectPolicy::NotClientRedirect); |
| 2631 } | 2658 } |
| 2632 | 2659 |
| 2633 Node* Internals::visibleSelectionAnchorNode() { | 2660 Node* Internals::visibleSelectionAnchorNode() { |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3183 | 3210 |
| 3184 void Internals::crash() { | 3211 void Internals::crash() { |
| 3185 CHECK(false) << "Intentional crash"; | 3212 CHECK(false) << "Intentional crash"; |
| 3186 } | 3213 } |
| 3187 | 3214 |
| 3188 void Internals::setIsLowEndDevice(bool isLowEndDevice) { | 3215 void Internals::setIsLowEndDevice(bool isLowEndDevice) { |
| 3189 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); | 3216 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); |
| 3190 } | 3217 } |
| 3191 | 3218 |
| 3192 } // namespace blink | 3219 } // namespace blink |
| OLD | NEW |