| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 m_loaderProxy->postTaskToLoader( | 428 m_loaderProxy->postTaskToLoader( |
| 429 BLINK_FROM_HERE, createCrossThreadTask(&Peer::sendTextAsCharVector, | 429 BLINK_FROM_HERE, createCrossThreadTask(&Peer::sendTextAsCharVector, |
| 430 m_peer, passed(std::move(data)))); | 430 m_peer, passed(std::move(data)))); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void Bridge::send(const DOMArrayBuffer& binaryData, | 433 void Bridge::send(const DOMArrayBuffer& binaryData, |
| 434 unsigned byteOffset, | 434 unsigned byteOffset, |
| 435 unsigned byteLength) { | 435 unsigned byteLength) { |
| 436 DCHECK(m_peer); | 436 DCHECK(m_peer); |
| 437 // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied i
nto Vector<char>. | 437 // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied |
| 438 // into Vector<char>. |
| 438 std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(byteLength)); | 439 std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(byteLength)); |
| 439 if (binaryData.byteLength()) | 440 if (binaryData.byteLength()) |
| 440 memcpy(data->data(), | 441 memcpy(data->data(), |
| 441 static_cast<const char*>(binaryData.data()) + byteOffset, | 442 static_cast<const char*>(binaryData.data()) + byteOffset, |
| 442 byteLength); | 443 byteLength); |
| 443 | 444 |
| 444 m_loaderProxy->postTaskToLoader( | 445 m_loaderProxy->postTaskToLoader( |
| 445 BLINK_FROM_HERE, createCrossThreadTask(&Peer::sendBinaryAsCharVector, | 446 BLINK_FROM_HERE, createCrossThreadTask(&Peer::sendBinaryAsCharVector, |
| 446 m_peer, passed(std::move(data)))); | 447 m_peer, passed(std::move(data)))); |
| 447 } | 448 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 m_peer = nullptr; | 481 m_peer = nullptr; |
| 481 m_workerGlobalScope.clear(); | 482 m_workerGlobalScope.clear(); |
| 482 } | 483 } |
| 483 | 484 |
| 484 DEFINE_TRACE(Bridge) { | 485 DEFINE_TRACE(Bridge) { |
| 485 visitor->trace(m_client); | 486 visitor->trace(m_client); |
| 486 visitor->trace(m_workerGlobalScope); | 487 visitor->trace(m_workerGlobalScope); |
| 487 } | 488 } |
| 488 | 489 |
| 489 } // namespace blink | 490 } // namespace blink |
| OLD | NEW |