Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 437 // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied
438 // into Vector<char>. 438 // into Vector<char>.
439 std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(byteLength)); 439 std::unique_ptr<Vector<char>> data = makeUnique<Vector<char>>(byteLength);
440 if (binaryData.byteLength()) 440 if (binaryData.byteLength())
441 memcpy(data->data(), 441 memcpy(data->data(),
442 static_cast<const char*>(binaryData.data()) + byteOffset, 442 static_cast<const char*>(binaryData.data()) + byteOffset,
443 byteLength); 443 byteLength);
444 444
445 m_loaderProxy->postTaskToLoader( 445 m_loaderProxy->postTaskToLoader(
446 BLINK_FROM_HERE, createCrossThreadTask(&Peer::sendBinaryAsCharVector, 446 BLINK_FROM_HERE, createCrossThreadTask(&Peer::sendBinaryAsCharVector,
447 m_peer, passed(std::move(data)))); 447 m_peer, passed(std::move(data))));
448 } 448 }
449 449
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 m_peer = nullptr; 481 m_peer = nullptr;
482 m_workerGlobalScope.clear(); 482 m_workerGlobalScope.clear();
483 } 483 }
484 484
485 DEFINE_TRACE(Bridge) { 485 DEFINE_TRACE(Bridge) {
486 visitor->trace(m_client); 486 visitor->trace(m_client);
487 visitor->trace(m_workerGlobalScope); 487 visitor->trace(m_workerGlobalScope);
488 } 488 }
489 489
490 } // namespace blink 490 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698