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

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

Issue 2288983004: Merge TaskSynchronizer into WaitableEvent. (Closed)
Patch Set: fix Created 4 years, 3 months 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 syncHelper->signalWorkerThread(); 382 syncHelper->signalWorkerThread();
383 } 383 }
384 384
385 bool Bridge::connect(std::unique_ptr<SourceLocation> location, const KURL& url, const String& protocol) 385 bool Bridge::connect(std::unique_ptr<SourceLocation> location, const KURL& url, const String& protocol)
386 { 386 {
387 // Wait for completion of the task on the main thread because the mixed 387 // Wait for completion of the task on the main thread because the mixed
388 // content check must synchronously be conducted. 388 // content check must synchronously be conducted.
389 WebSocketChannelSyncHelper syncHelper; 389 WebSocketChannelSyncHelper syncHelper;
390 m_loaderProxy->postTaskToLoader(BLINK_FROM_HERE, createCrossThreadTask(&Brid ge::connectOnMainThread, wrapCrossThreadPersistent(this), passed(location->clone ()), wrapCrossThreadPersistent(m_workerGlobalScope->thread()->getWorkerThreadLif ecycleContext()), url, protocol, crossThreadUnretained(&syncHelper))); 390 m_loaderProxy->postTaskToLoader(BLINK_FROM_HERE, createCrossThreadTask(&Brid ge::connectOnMainThread, wrapCrossThreadPersistent(this), passed(location->clone ()), wrapCrossThreadPersistent(m_workerGlobalScope->thread()->getWorkerThreadLif ecycleContext()), url, protocol, crossThreadUnretained(&syncHelper)));
391 { 391 syncHelper.wait();
392 SafePointScope scope(BlinkGC::HeapPointersOnStack);
393 syncHelper.wait();
394 }
395 return syncHelper.connectRequestResult(); 392 return syncHelper.connectRequestResult();
396 } 393 }
397 394
398 void Bridge::send(const CString& message) 395 void Bridge::send(const CString& message)
399 { 396 {
400 ASSERT(m_peer); 397 ASSERT(m_peer);
401 std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(message.len gth())); 398 std::unique_ptr<Vector<char>> data = wrapUnique(new Vector<char>(message.len gth()));
402 if (message.length()) 399 if (message.length())
403 memcpy(data->data(), static_cast<const char*>(message.data()), message.l ength()); 400 memcpy(data->data(), static_cast<const char*>(message.data()), message.l ength());
404 401
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 m_workerGlobalScope.clear(); 443 m_workerGlobalScope.clear();
447 } 444 }
448 445
449 DEFINE_TRACE(Bridge) 446 DEFINE_TRACE(Bridge)
450 { 447 {
451 visitor->trace(m_client); 448 visitor->trace(m_client);
452 visitor->trace(m_workerGlobalScope); 449 visitor->trace(m_workerGlobalScope);
453 } 450 }
454 451
455 } // namespace blink 452 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698