Chromium Code Reviews| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 // This is equivalent to swapping the byte order of the two bytes (x, 0), | 168 // This is equivalent to swapping the byte order of the two bytes (x, 0), |
| 169 // depending on endianness. | 169 // depending on endianness. |
| 170 if (m_dataBufferSize % 2) | 170 if (m_dataBufferSize % 2) |
| 171 dst[wireSizeBytes / 2 - 1] = m_dataBuffer[m_dataBufferSize - 1] << 8; | 171 dst[wireSizeBytes / 2 - 1] = m_dataBuffer[m_dataBufferSize - 1] << 8; |
| 172 } | 172 } |
| 173 | 173 |
| 174 static void accumulateArrayBuffersForAllWorlds( | 174 static void accumulateArrayBuffersForAllWorlds( |
| 175 v8::Isolate* isolate, | 175 v8::Isolate* isolate, |
| 176 DOMArrayBuffer* object, | 176 DOMArrayBuffer* object, |
| 177 Vector<v8::Local<v8::ArrayBuffer>, 4>& buffers) { | 177 Vector<v8::Local<v8::ArrayBuffer>, 4>& buffers) { |
| 178 if (isMainThread()) { | 178 Vector<RefPtr<DOMWrapperWorld>> worlds; |
| 179 Vector<RefPtr<DOMWrapperWorld>> worlds; | 179 DOMWrapperWorld::allWorldsInCurrentThread(worlds); |
| 180 DOMWrapperWorld::allWorldsInMainThread(worlds); | 180 for (size_t i = 0; i < worlds.size(); i++) { |
|
jbroman
2017/03/15 14:09:34
super-nit: you could use a range-based loop here:
nhiroki
2017/03/15 14:47:42
Done.
| |
| 181 for (size_t i = 0; i < worlds.size(); i++) { | |
| 182 v8::Local<v8::Object> wrapper = | |
| 183 worlds[i]->domDataStore().get(object, isolate); | |
| 184 if (!wrapper.IsEmpty()) | |
| 185 buffers.push_back(v8::Local<v8::ArrayBuffer>::Cast(wrapper)); | |
| 186 } | |
| 187 } else { | |
| 188 v8::Local<v8::Object> wrapper = | 181 v8::Local<v8::Object> wrapper = |
| 189 DOMWrapperWorld::current(isolate).domDataStore().get(object, isolate); | 182 worlds[i]->domDataStore().get(object, isolate); |
| 190 if (!wrapper.IsEmpty()) | 183 if (!wrapper.IsEmpty()) |
| 191 buffers.push_back(v8::Local<v8::ArrayBuffer>::Cast(wrapper)); | 184 buffers.push_back(v8::Local<v8::ArrayBuffer>::Cast(wrapper)); |
| 192 } | 185 } |
| 193 } | 186 } |
| 194 | 187 |
| 195 std::unique_ptr<SerializedScriptValue::ImageBitmapContentsArray> | 188 std::unique_ptr<SerializedScriptValue::ImageBitmapContentsArray> |
| 196 SerializedScriptValue::transferImageBitmapContents( | 189 SerializedScriptValue::transferImageBitmapContents( |
| 197 v8::Isolate* isolate, | 190 v8::Isolate* isolate, |
| 198 const ImageBitmapArray& imageBitmaps, | 191 const ImageBitmapArray& imageBitmaps, |
| 199 ExceptionState& exceptionState) { | 192 ExceptionState& exceptionState) { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 for (size_t i = 0; i < m_arrayBufferContentsArray->size(); ++i) { | 477 for (size_t i = 0; i < m_arrayBufferContentsArray->size(); ++i) { |
| 485 WTF::ArrayBufferContents& buffer = m_arrayBufferContentsArray->at(i); | 478 WTF::ArrayBufferContents& buffer = m_arrayBufferContentsArray->at(i); |
| 486 buffer.adjustExternalAllocatedMemoryUponContextTransfer( | 479 buffer.adjustExternalAllocatedMemoryUponContextTransfer( |
| 487 WTF::ArrayBufferContents::Enter); | 480 WTF::ArrayBufferContents::Enter); |
| 488 } | 481 } |
| 489 m_adjustTransferableExternalAllocationOnContextTransfer = false; | 482 m_adjustTransferableExternalAllocationOnContextTransfer = false; |
| 490 } | 483 } |
| 491 } | 484 } |
| 492 | 485 |
| 493 } // namespace blink | 486 } // namespace blink |
| OLD | NEW |