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

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

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 DCHECK(context->isWorkerGlobalScope()); 274 DCHECK(context->isWorkerGlobalScope());
275 if (bridge && bridge->client()) 275 if (bridge && bridge->client())
276 bridge->client()->didReceiveBinaryMessage(std::move(payload)); 276 bridge->client()->didReceiveBinaryMessage(std::move(payload));
277 } 277 }
278 278
279 void Peer::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) { 279 void Peer::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload) {
280 DCHECK(isMainThread()); 280 DCHECK(isMainThread());
281 m_loaderProxy->postTaskToWorkerGlobalScope( 281 m_loaderProxy->postTaskToWorkerGlobalScope(
282 BLINK_FROM_HERE, 282 BLINK_FROM_HERE,
283 createCrossThreadTask(&workerGlobalScopeDidReceiveBinaryMessage, m_bridge, 283 createCrossThreadTask(&workerGlobalScopeDidReceiveBinaryMessage, m_bridge,
284 passed(std::move(payload)))); 284 WTF::passed(std::move(payload))));
285 } 285 }
286 286
287 static void workerGlobalScopeDidConsumeBufferedAmount( 287 static void workerGlobalScopeDidConsumeBufferedAmount(
288 Bridge* bridge, 288 Bridge* bridge,
289 uint64_t consumed, 289 uint64_t consumed,
290 ExecutionContext* context) { 290 ExecutionContext* context) {
291 DCHECK(context->isWorkerGlobalScope()); 291 DCHECK(context->isWorkerGlobalScope());
292 if (bridge && bridge->client()) 292 if (bridge && bridge->client())
293 bridge->client()->didConsumeBufferedAmount(consumed); 293 bridge->client()->didConsumeBufferedAmount(consumed);
294 } 294 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 bool Bridge::connect(std::unique_ptr<SourceLocation> location, 402 bool Bridge::connect(std::unique_ptr<SourceLocation> location,
403 const KURL& url, 403 const KURL& url,
404 const String& protocol) { 404 const String& protocol) {
405 // Wait for completion of the task on the main thread because the mixed 405 // Wait for completion of the task on the main thread because the mixed
406 // content check must synchronously be conducted. 406 // content check must synchronously be conducted.
407 WebSocketChannelSyncHelper syncHelper; 407 WebSocketChannelSyncHelper syncHelper;
408 m_loaderProxy->postTaskToLoader( 408 m_loaderProxy->postTaskToLoader(
409 BLINK_FROM_HERE, 409 BLINK_FROM_HERE,
410 createCrossThreadTask( 410 createCrossThreadTask(
411 &Bridge::connectOnMainThread, wrapCrossThreadPersistent(this), 411 &Bridge::connectOnMainThread, wrapCrossThreadPersistent(this),
412 passed(location->clone()), 412 WTF::passed(location->clone()),
413 wrapCrossThreadPersistent( 413 wrapCrossThreadPersistent(
414 m_workerGlobalScope->thread()->getWorkerThreadLifecycleContext()), 414 m_workerGlobalScope->thread()->getWorkerThreadLifecycleContext()),
415 url, protocol, crossThreadUnretained(&syncHelper))); 415 url, protocol, crossThreadUnretained(&syncHelper)));
416 syncHelper.wait(); 416 syncHelper.wait();
417 return syncHelper.connectRequestResult(); 417 return syncHelper.connectRequestResult();
418 } 418 }
419 419
420 void Bridge::send(const CString& message) { 420 void Bridge::send(const CString& message) {
421 DCHECK(m_peer); 421 DCHECK(m_peer);
422 std::unique_ptr<Vector<char>> data = 422 std::unique_ptr<Vector<char>> data =
423 wrapUnique(new Vector<char>(message.length())); 423 WTF::wrapUnique(new Vector<char>(message.length()));
424 if (message.length()) 424 if (message.length())
425 memcpy(data->data(), static_cast<const char*>(message.data()), 425 memcpy(data->data(), static_cast<const char*>(message.data()),
426 message.length()); 426 message.length());
427 427
428 m_loaderProxy->postTaskToLoader( 428 m_loaderProxy->postTaskToLoader(
429 BLINK_FROM_HERE, createCrossThreadTask(&Peer::sendTextAsCharVector, 429 BLINK_FROM_HERE,
430 m_peer, passed(std::move(data)))); 430 createCrossThreadTask(&Peer::sendTextAsCharVector, m_peer,
431 WTF::passed(std::move(data))));
431 } 432 }
432 433
433 void Bridge::send(const DOMArrayBuffer& binaryData, 434 void Bridge::send(const DOMArrayBuffer& binaryData,
434 unsigned byteOffset, 435 unsigned byteOffset,
435 unsigned byteLength) { 436 unsigned byteLength) {
436 DCHECK(m_peer); 437 DCHECK(m_peer);
437 // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied 438 // ArrayBuffer isn't thread-safe, hence the content of ArrayBuffer is copied
438 // into Vector<char>. 439 // into Vector<char>.
439 std::unique_ptr<Vector<char>> data = makeUnique<Vector<char>>(byteLength); 440 std::unique_ptr<Vector<char>> data =
441 WTF::makeUnique<Vector<char>>(byteLength);
440 if (binaryData.byteLength()) 442 if (binaryData.byteLength())
441 memcpy(data->data(), 443 memcpy(data->data(),
442 static_cast<const char*>(binaryData.data()) + byteOffset, 444 static_cast<const char*>(binaryData.data()) + byteOffset,
443 byteLength); 445 byteLength);
444 446
445 m_loaderProxy->postTaskToLoader( 447 m_loaderProxy->postTaskToLoader(
446 BLINK_FROM_HERE, createCrossThreadTask(&Peer::sendBinaryAsCharVector, 448 BLINK_FROM_HERE,
447 m_peer, passed(std::move(data)))); 449 createCrossThreadTask(&Peer::sendBinaryAsCharVector, m_peer,
450 WTF::passed(std::move(data))));
448 } 451 }
449 452
450 void Bridge::send(PassRefPtr<BlobDataHandle> data) { 453 void Bridge::send(PassRefPtr<BlobDataHandle> data) {
451 DCHECK(m_peer); 454 DCHECK(m_peer);
452 m_loaderProxy->postTaskToLoader( 455 m_loaderProxy->postTaskToLoader(
453 BLINK_FROM_HERE, 456 BLINK_FROM_HERE,
454 createCrossThreadTask(&Peer::sendBlob, m_peer, std::move(data))); 457 createCrossThreadTask(&Peer::sendBlob, m_peer, std::move(data)));
455 } 458 }
456 459
457 void Bridge::close(int code, const String& reason) { 460 void Bridge::close(int code, const String& reason) {
458 DCHECK(m_peer); 461 DCHECK(m_peer);
459 m_loaderProxy->postTaskToLoader( 462 m_loaderProxy->postTaskToLoader(
460 BLINK_FROM_HERE, 463 BLINK_FROM_HERE,
461 createCrossThreadTask(&Peer::close, m_peer, code, reason)); 464 createCrossThreadTask(&Peer::close, m_peer, code, reason));
462 } 465 }
463 466
464 void Bridge::fail(const String& reason, 467 void Bridge::fail(const String& reason,
465 MessageLevel level, 468 MessageLevel level,
466 std::unique_ptr<SourceLocation> location) { 469 std::unique_ptr<SourceLocation> location) {
467 DCHECK(m_peer); 470 DCHECK(m_peer);
468 m_loaderProxy->postTaskToLoader( 471 m_loaderProxy->postTaskToLoader(
469 BLINK_FROM_HERE, createCrossThreadTask(&Peer::fail, m_peer, reason, level, 472 BLINK_FROM_HERE, createCrossThreadTask(&Peer::fail, m_peer, reason, level,
470 passed(location->clone()))); 473 WTF::passed(location->clone())));
471 } 474 }
472 475
473 void Bridge::disconnect() { 476 void Bridge::disconnect() {
474 if (!m_peer) 477 if (!m_peer)
475 return; 478 return;
476 479
477 m_loaderProxy->postTaskToLoader( 480 m_loaderProxy->postTaskToLoader(
478 BLINK_FROM_HERE, createCrossThreadTask(&Peer::disconnect, m_peer)); 481 BLINK_FROM_HERE, createCrossThreadTask(&Peer::disconnect, m_peer));
479 482
480 m_client = nullptr; 483 m_client = nullptr;
481 m_peer = nullptr; 484 m_peer = nullptr;
482 m_workerGlobalScope.clear(); 485 m_workerGlobalScope.clear();
483 } 486 }
484 487
485 DEFINE_TRACE(Bridge) { 488 DEFINE_TRACE(Bridge) {
486 visitor->trace(m_client); 489 visitor->trace(m_client);
487 visitor->trace(m_workerGlobalScope); 490 visitor->trace(m_workerGlobalScope);
488 } 491 }
489 492
490 } // namespace blink 493 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698