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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 ASSERT(imageBitmaps.size()); | 106 ASSERT(imageBitmaps.size()); |
107 | 107 |
108 for (size_t i = 0; i < imageBitmaps.size(); i++) { | 108 for (size_t i = 0; i < imageBitmaps.size(); i++) { |
109 if (imageBitmaps[i]->isNeutered()) { | 109 if (imageBitmaps[i]->isNeutered()) { |
110 exceptionState.throwDOMException(DataCloneError, "ImageBitmap at ind
ex " + String::number(i) + " is already neutered."); | 110 exceptionState.throwDOMException(DataCloneError, "ImageBitmap at ind
ex " + String::number(i) + " is already neutered."); |
111 return nullptr; | 111 return nullptr; |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 OwnPtr<ImageBitmapContentsArray> contents = adoptPtr(new ImageBitmapContents
Array); | 115 OwnPtr<ImageBitmapContentsArray> contents = adoptPtr(new ImageBitmapContents
Array); |
116 WillBeHeapHashSet<RawPtrWillBeMember<ImageBitmap>> visited; | 116 HeapHashSet<Member<ImageBitmap>> visited; |
117 for (size_t i = 0; i < imageBitmaps.size(); i++) { | 117 for (size_t i = 0; i < imageBitmaps.size(); i++) { |
118 if (visited.contains(imageBitmaps[i].get())) | 118 if (visited.contains(imageBitmaps[i].get())) |
119 continue; | 119 continue; |
120 visited.add(imageBitmaps[i].get()); | 120 visited.add(imageBitmaps[i].get()); |
121 contents->append(imageBitmaps[i]->transfer()); | 121 contents->append(imageBitmaps[i]->transfer()); |
122 } | 122 } |
123 return contents.release(); | 123 return contents.release(); |
124 } | 124 } |
125 | 125 |
126 | 126 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } | 240 } |
241 arrayBuffers.append(arrayBuffer.release()); | 241 arrayBuffers.append(arrayBuffer.release()); |
242 } else if (V8SharedArrayBuffer::hasInstance(transferrable, isolate)) { | 242 } else if (V8SharedArrayBuffer::hasInstance(transferrable, isolate)) { |
243 RefPtr<DOMSharedArrayBuffer> sharedArrayBuffer = V8SharedArrayBuffer
::toImpl(v8::Local<v8::Object>::Cast(transferrable)); | 243 RefPtr<DOMSharedArrayBuffer> sharedArrayBuffer = V8SharedArrayBuffer
::toImpl(v8::Local<v8::Object>::Cast(transferrable)); |
244 if (arrayBuffers.contains(sharedArrayBuffer)) { | 244 if (arrayBuffers.contains(sharedArrayBuffer)) { |
245 exceptionState.throwDOMException(DataCloneError, "SharedArrayBuf
fer at index " + String::number(i) + " is a duplicate of an earlier SharedArrayB
uffer."); | 245 exceptionState.throwDOMException(DataCloneError, "SharedArrayBuf
fer at index " + String::number(i) + " is a duplicate of an earlier SharedArrayB
uffer."); |
246 return false; | 246 return false; |
247 } | 247 } |
248 arrayBuffers.append(sharedArrayBuffer.release()); | 248 arrayBuffers.append(sharedArrayBuffer.release()); |
249 } else if (V8ImageBitmap::hasInstance(transferrable, isolate)) { | 249 } else if (V8ImageBitmap::hasInstance(transferrable, isolate)) { |
250 RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = V8ImageBitmap::toImpl(
v8::Local<v8::Object>::Cast(transferrable)); | 250 RawPtr<ImageBitmap> imageBitmap = V8ImageBitmap::toImpl(v8::Local<v8
::Object>::Cast(transferrable)); |
251 if (imageBitmaps.contains(imageBitmap)) { | 251 if (imageBitmaps.contains(imageBitmap)) { |
252 exceptionState.throwDOMException(DataCloneError, "ImageBitmap at
index " + String::number(i) + " is a duplicate of an earlier ImageBitmap."); | 252 exceptionState.throwDOMException(DataCloneError, "ImageBitmap at
index " + String::number(i) + " is a duplicate of an earlier ImageBitmap."); |
253 return false; | 253 return false; |
254 } | 254 } |
255 imageBitmaps.append(imageBitmap.release()); | 255 imageBitmaps.append(imageBitmap.release()); |
256 } else { | 256 } else { |
257 exceptionState.throwTypeError("Value at index " + String::number(i)
+ " does not have a transferable type."); | 257 exceptionState.throwTypeError("Value at index " + String::number(i)
+ " does not have a transferable type."); |
258 return false; | 258 return false; |
259 } | 259 } |
260 } | 260 } |
(...skipping 28 matching lines...) Expand all Loading... |
289 { | 289 { |
290 m_arrayBufferContentsArray = createArrayBuffers(isolate, arrayBuffers, excep
tionState); | 290 m_arrayBufferContentsArray = createArrayBuffers(isolate, arrayBuffers, excep
tionState); |
291 } | 291 } |
292 | 292 |
293 void SerializedScriptValue::transferImageBitmaps(v8::Isolate* isolate, ImageBitm
apArray& imageBitmaps, ExceptionState& exceptionState) | 293 void SerializedScriptValue::transferImageBitmaps(v8::Isolate* isolate, ImageBitm
apArray& imageBitmaps, ExceptionState& exceptionState) |
294 { | 294 { |
295 m_imageBitmapContentsArray = createImageBitmaps(isolate, imageBitmaps, excep
tionState); | 295 m_imageBitmapContentsArray = createImageBitmaps(isolate, imageBitmaps, excep
tionState); |
296 } | 296 } |
297 | 297 |
298 } // namespace blink | 298 } // namespace blink |
OLD | NEW |