Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: Source/bindings/core/v8/SerializedScriptValue.cpp

Issue 491053004: Expose Web Animations API to Web Workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | Source/core/core.gypi » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "bindings/core/v8/custom/V8Float64ArrayCustom.h" 46 #include "bindings/core/v8/custom/V8Float64ArrayCustom.h"
47 #include "bindings/core/v8/custom/V8Int16ArrayCustom.h" 47 #include "bindings/core/v8/custom/V8Int16ArrayCustom.h"
48 #include "bindings/core/v8/custom/V8Int32ArrayCustom.h" 48 #include "bindings/core/v8/custom/V8Int32ArrayCustom.h"
49 #include "bindings/core/v8/custom/V8Int8ArrayCustom.h" 49 #include "bindings/core/v8/custom/V8Int8ArrayCustom.h"
50 #include "bindings/core/v8/custom/V8Uint16ArrayCustom.h" 50 #include "bindings/core/v8/custom/V8Uint16ArrayCustom.h"
51 #include "bindings/core/v8/custom/V8Uint32ArrayCustom.h" 51 #include "bindings/core/v8/custom/V8Uint32ArrayCustom.h"
52 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" 52 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h"
53 #include "bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h" 53 #include "bindings/core/v8/custom/V8Uint8ClampedArrayCustom.h"
54 #include "bindings/modules/v8/V8CryptoKey.h" 54 #include "bindings/modules/v8/V8CryptoKey.h"
55 #include "bindings/modules/v8/V8DOMFileSystem.h" 55 #include "bindings/modules/v8/V8DOMFileSystem.h"
56 #include "core/dom/ExceptionCode.h"
shans 2014/08/25 11:53:58 Revert the changes in this file (git checkout mast
57 #include "core/dom/MessagePort.h" 56 #include "core/dom/MessagePort.h"
58 #include "core/fileapi/Blob.h" 57 #include "core/fileapi/Blob.h"
59 #include "core/fileapi/File.h" 58 #include "core/fileapi/File.h"
60 #include "core/fileapi/FileList.h" 59 #include "core/fileapi/FileList.h"
61 #include "core/html/ImageData.h" 60 #include "core/html/ImageData.h"
62 #include "core/html/canvas/DataView.h" 61 #include "core/html/canvas/DataView.h"
63 #include "platform/SharedBuffer.h" 62 #include "platform/SharedBuffer.h"
64 #include "platform/heap/Handle.h" 63 #include "platform/heap/Handle.h"
65 #include "public/platform/Platform.h" 64 #include "public/platform/Platform.h"
66 #include "public/platform/WebBlobInfo.h" 65 #include "public/platform/WebBlobInfo.h"
(...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 2969
2971 v8::Handle<v8::Value> SerializedScriptValue::deserialize(MessagePortArray* messa gePorts) 2970 v8::Handle<v8::Value> SerializedScriptValue::deserialize(MessagePortArray* messa gePorts)
2972 { 2971 {
2973 return deserialize(v8::Isolate::GetCurrent(), messagePorts, 0); 2972 return deserialize(v8::Isolate::GetCurrent(), messagePorts, 0);
2974 } 2973 }
2975 2974
2976 v8::Handle<v8::Value> SerializedScriptValue::deserialize(v8::Isolate* isolate, M essagePortArray* messagePorts, const WebBlobInfoArray* blobInfo) 2975 v8::Handle<v8::Value> SerializedScriptValue::deserialize(v8::Isolate* isolate, M essagePortArray* messagePorts, const WebBlobInfoArray* blobInfo)
2977 { 2976 {
2978 if (!m_data.impl()) 2977 if (!m_data.impl())
2979 return v8::Null(isolate); 2978 return v8::Null(isolate);
2979
2980 COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes); 2980 COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes);
2981 m_data.ensure16Bit(); 2981 m_data.ensure16Bit();
2982 // FIXME: SerializedScriptValue shouldn't use String for its underlying 2982 // FIXME: SerializedScriptValue shouldn't use String for its underlying
2983 // storage. Instead, it should use SharedBuffer or Vector<uint8_t>. The 2983 // storage. Instead, it should use SharedBuffer or Vector<uint8_t>. The
2984 // information stored in m_data isn't even encoded in UTF-16. Instead, 2984 // information stored in m_data isn't even encoded in UTF-16. Instead,
2985 // unicode characters are encoded as UTF-8 with two code units per UChar. 2985 // unicode characters are encoded as UTF-8 with two code units per UChar.
2986 Reader reader(reinterpret_cast<const uint8_t*>(m_data.impl()->characters16() ), 2 * m_data.length(), blobInfo, m_blobDataHandles, ScriptState::current(isolat e)); 2986 Reader reader(reinterpret_cast<const uint8_t*>(m_data.impl()->characters16() ), 2 * m_data.length(), blobInfo, m_blobDataHandles, ScriptState::current(isolat e));
2987 Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.g et()); 2987 Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.g et());
2988 2988
2989 // deserialize() can run arbitrary script (e.g., setters), which could resul t in |this| being destroyed. 2989 // deserialize() can run arbitrary script (e.g., setters), which could resul t in |this| being destroyed.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 // If the allocated memory was not registered before, then this class is lik ely 3056 // If the allocated memory was not registered before, then this class is lik ely
3057 // used in a context other then Worker's onmessage environment and the prese nce of 3057 // used in a context other then Worker's onmessage environment and the prese nce of
3058 // current v8 context is not guaranteed. Avoid calling v8 then. 3058 // current v8 context is not guaranteed. Avoid calling v8 then.
3059 if (m_externallyAllocatedMemory) { 3059 if (m_externallyAllocatedMemory) {
3060 ASSERT(v8::Isolate::GetCurrent()); 3060 ASSERT(v8::Isolate::GetCurrent());
3061 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory); 3061 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory);
3062 } 3062 }
3063 } 3063 }
3064 3064
3065 } // namespace blink 3065 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | Source/core/core.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698