| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 OwnPtr<ImageBitmapContentsArray> contents = adoptPtr(new ImageBitmapContents
Array); | 133 OwnPtr<ImageBitmapContentsArray> contents = adoptPtr(new ImageBitmapContents
Array); |
| 134 HeapHashSet<Member<ImageBitmap>> visited; | 134 HeapHashSet<Member<ImageBitmap>> visited; |
| 135 for (size_t i = 0; i < imageBitmaps.size(); ++i) { | 135 for (size_t i = 0; i < imageBitmaps.size(); ++i) { |
| 136 if (visited.contains(imageBitmaps[i])) | 136 if (visited.contains(imageBitmaps[i])) |
| 137 continue; | 137 continue; |
| 138 visited.add(imageBitmaps[i]); | 138 visited.add(imageBitmaps[i]); |
| 139 contents->append(imageBitmaps[i]->transfer()); | 139 contents->append(imageBitmaps[i]->transfer()); |
| 140 } | 140 } |
| 141 m_imageBitmapContentsArray = contents.release(); | 141 m_imageBitmapContentsArray = std::move(contents); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void SerializedScriptValue::transferOffscreenCanvas(v8::Isolate* isolate, const
OffscreenCanvasArray& offscreenCanvases, ExceptionState& exceptionState) | 144 void SerializedScriptValue::transferOffscreenCanvas(v8::Isolate* isolate, const
OffscreenCanvasArray& offscreenCanvases, ExceptionState& exceptionState) |
| 145 { | 145 { |
| 146 if (!offscreenCanvases.size()) | 146 if (!offscreenCanvases.size()) |
| 147 return; | 147 return; |
| 148 | 148 |
| 149 HeapHashSet<Member<OffscreenCanvas>> visited; | 149 HeapHashSet<Member<OffscreenCanvas>> visited; |
| 150 for (size_t i = 0; i < offscreenCanvases.size(); i++) { | 150 for (size_t i = 0; i < offscreenCanvases.size(); i++) { |
| 151 if (visited.contains(offscreenCanvases[i].get())) | 151 if (visited.contains(offscreenCanvases[i].get())) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " could not be transferred."); | 205 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " could not be transferred."); |
| 206 return; | 206 return; |
| 207 } | 207 } |
| 208 | 208 |
| 209 if (isNeuterable) | 209 if (isNeuterable) |
| 210 for (size_t j = 0; j < bufferHandles.size(); ++j) | 210 for (size_t j = 0; j < bufferHandles.size(); ++j) |
| 211 bufferHandles[j]->Neuter(); | 211 bufferHandles[j]->Neuter(); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } | 214 } |
| 215 m_arrayBufferContentsArray = contents.release(); | 215 m_arrayBufferContentsArray = std::move(contents); |
| 216 } | 216 } |
| 217 | 217 |
| 218 SerializedScriptValue::SerializedScriptValue(const String& wireData) | 218 SerializedScriptValue::SerializedScriptValue(const String& wireData) |
| 219 : m_externallyAllocatedMemory(0) | 219 : m_externallyAllocatedMemory(0) |
| 220 { | 220 { |
| 221 m_data = wireData.isolatedCopy(); | 221 m_data = wireData.isolatedCopy(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 v8::Local<v8::Value> SerializedScriptValue::deserialize(MessagePortArray* messag
ePorts) | 224 v8::Local<v8::Value> SerializedScriptValue::deserialize(MessagePortArray* messag
ePorts) |
| 225 { | 225 { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); | 310 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); |
| 311 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externall
yAllocatedMemory); | 311 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(m_externall
yAllocatedMemory); |
| 312 } | 312 } |
| 313 | 313 |
| 314 bool SerializedScriptValue::containsTransferableArrayBuffer() const | 314 bool SerializedScriptValue::containsTransferableArrayBuffer() const |
| 315 { | 315 { |
| 316 return m_arrayBufferContentsArray && !m_arrayBufferContentsArray->isEmpty(); | 316 return m_arrayBufferContentsArray && !m_arrayBufferContentsArray->isEmpty(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 } // namespace blink | 319 } // namespace blink |
| OLD | NEW |