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

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: Exposing the Web Animations API to Web Workers Created 6 years, 3 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/dom/ExecutionContext.h » ('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 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 2970
2971 v8::Handle<v8::Value> SerializedScriptValue::deserialize(MessagePortArray* messa gePorts) 2971 v8::Handle<v8::Value> SerializedScriptValue::deserialize(MessagePortArray* messa gePorts)
2972 { 2972 {
2973 return deserialize(v8::Isolate::GetCurrent(), messagePorts, 0); 2973 return deserialize(v8::Isolate::GetCurrent(), messagePorts, 0);
2974 } 2974 }
2975 2975
2976 v8::Handle<v8::Value> SerializedScriptValue::deserialize(v8::Isolate* isolate, M essagePortArray* messagePorts, const WebBlobInfoArray* blobInfo) 2976 v8::Handle<v8::Value> SerializedScriptValue::deserialize(v8::Isolate* isolate, M essagePortArray* messagePorts, const WebBlobInfoArray* blobInfo)
2977 { 2977 {
2978 if (!m_data.impl()) 2978 if (!m_data.impl())
2979 return v8::Null(isolate); 2979 return v8::Null(isolate);
2980
2980 COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes); 2981 COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes);
2981 m_data.ensure16Bit(); 2982 m_data.ensure16Bit();
2982 // FIXME: SerializedScriptValue shouldn't use String for its underlying 2983 // FIXME: SerializedScriptValue shouldn't use String for its underlying
2983 // storage. Instead, it should use SharedBuffer or Vector<uint8_t>. The 2984 // 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, 2985 // 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. 2986 // 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)); 2987 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()); 2988 Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.g et());
2988 2989
2989 // deserialize() can run arbitrary script (e.g., setters), which could resul t in |this| being destroyed. 2990 // 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 3057 // 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 3058 // 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. 3059 // current v8 context is not guaranteed. Avoid calling v8 then.
3059 if (m_externallyAllocatedMemory) { 3060 if (m_externallyAllocatedMemory) {
3060 ASSERT(v8::Isolate::GetCurrent()); 3061 ASSERT(v8::Isolate::GetCurrent());
3061 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory); 3062 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte rnallyAllocatedMemory);
3062 } 3063 }
3063 } 3064 }
3064 3065
3065 } // namespace blink 3066 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | Source/core/dom/ExecutionContext.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698