| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 return m_syncHelper->connectRequestResult(); | 401 return m_syncHelper->connectRequestResult(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void Bridge::send(const CString& message) | 404 void Bridge::send(const CString& message) |
| 405 { | 405 { |
| 406 ASSERT(m_peer); | 406 ASSERT(m_peer); |
| 407 OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>(message.length())); | 407 OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>(message.length())); |
| 408 if (message.length()) | 408 if (message.length()) |
| 409 memcpy(data->data(), static_cast<const char*>(message.data()), message.l
ength()); | 409 memcpy(data->data(), static_cast<const char*>(message.data()), message.l
ength()); |
| 410 | 410 |
| 411 m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::sendTextAsCharV
ector, AllowCrossThreadAccess(m_peer.get()), passed(data.release()))); | 411 m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::sendTextAsCharV
ector, AllowCrossThreadAccess(m_peer.get()), passed(std::move(data)))); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void Bridge::send(const DOMArrayBuffer& binaryData, unsigned byteOffset, unsigne
d byteLength) | 414 void Bridge::send(const DOMArrayBuffer& binaryData, unsigned byteOffset, unsigne
d byteLength) |
| 415 { | 415 { |
| 416 ASSERT(m_peer); | 416 ASSERT(m_peer); |
| 417 // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied
into Vector<char>. | 417 // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied
into Vector<char>. |
| 418 OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>(byteLength)); | 418 OwnPtr<Vector<char>> data = adoptPtr(new Vector<char>(byteLength)); |
| 419 if (binaryData.byteLength()) | 419 if (binaryData.byteLength()) |
| 420 memcpy(data->data(), static_cast<const char*>(binaryData.data()) + byteO
ffset, byteLength); | 420 memcpy(data->data(), static_cast<const char*>(binaryData.data()) + byteO
ffset, byteLength); |
| 421 | 421 |
| 422 m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::sendBinaryAsCha
rVector, AllowCrossThreadAccess(m_peer.get()), passed(data.release()))); | 422 m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::sendBinaryAsCha
rVector, AllowCrossThreadAccess(m_peer.get()), passed(std::move(data)))); |
| 423 } | 423 } |
| 424 | 424 |
| 425 void Bridge::send(PassRefPtr<BlobDataHandle> data) | 425 void Bridge::send(PassRefPtr<BlobDataHandle> data) |
| 426 { | 426 { |
| 427 ASSERT(m_peer); | 427 ASSERT(m_peer); |
| 428 m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::sendBlob, Allow
CrossThreadAccess(m_peer.get()), data)); | 428 m_loaderProxy->postTaskToLoader(createCrossThreadTask(&Peer::sendBlob, Allow
CrossThreadAccess(m_peer.get()), data)); |
| 429 } | 429 } |
| 430 | 430 |
| 431 void Bridge::close(int code, const String& reason) | 431 void Bridge::close(int code, const String& reason) |
| 432 { | 432 { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 474 |
| 475 DEFINE_TRACE(Bridge) | 475 DEFINE_TRACE(Bridge) |
| 476 { | 476 { |
| 477 visitor->trace(m_client); | 477 visitor->trace(m_client); |
| 478 visitor->trace(m_workerGlobalScope); | 478 visitor->trace(m_workerGlobalScope); |
| 479 visitor->trace(m_syncHelper); | 479 visitor->trace(m_syncHelper); |
| 480 visitor->trace(m_peer); | 480 visitor->trace(m_peer); |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace blink | 483 } // namespace blink |
| OLD | NEW |