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

Side by Side Diff: Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp

Issue 311993006: [WebSocket] bufferedAmount should not decrease inside a task. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); 399 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
400 workerClientWrapper->didReceiveBinaryData(binaryData); 400 workerClientWrapper->didReceiveBinaryData(binaryData);
401 } 401 }
402 402
403 void WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData(PassOwnPtr<Vec tor<char> > binaryData) 403 void WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData(PassOwnPtr<Vec tor<char> > binaryData)
404 { 404 {
405 ASSERT(isMainThread()); 405 ASSERT(isMainThread());
406 m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalSc opeDidReceiveBinaryData, m_workerClientWrapper, binaryData)); 406 m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalSc opeDidReceiveBinaryData, m_workerClientWrapper, binaryData));
407 } 407 }
408 408
409 static void workerGlobalScopeDidUpdateBufferedAmount(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, unsigne d long bufferedAmount) 409 static void workerGlobalScopeDidIncreaseBufferedAmount(ExecutionContext* context , PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, unsig ned long amount)
410 { 410 {
411 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); 411 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
412 workerClientWrapper->didUpdateBufferedAmount(bufferedAmount); 412 workerClientWrapper->didIncreaseBufferedAmount(amount);
413 } 413 }
414 414
415 void WorkerThreadableWebSocketChannel::Peer::didUpdateBufferedAmount(unsigned lo ng bufferedAmount) 415 void WorkerThreadableWebSocketChannel::Peer::didIncreaseBufferedAmount(unsigned long amount)
416 { 416 {
417 ASSERT(isMainThread()); 417 ASSERT(isMainThread());
418 m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalSc opeDidUpdateBufferedAmount, m_workerClientWrapper, bufferedAmount)); 418 m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalSc opeDidIncreaseBufferedAmount, m_workerClientWrapper, amount));
419 }
420
421 static void workerGlobalScopeDidDecreaseBufferedAmount(ExecutionContext* context , PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper, unsig ned long amount)
422 {
423 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
424 workerClientWrapper->didDecreaseBufferedAmount(amount);
425 }
426
427 void WorkerThreadableWebSocketChannel::Peer::didDecreaseBufferedAmount(unsigned long amount)
428 {
429 ASSERT(isMainThread());
430 m_loaderProxy.postTaskToWorkerGlobalScope(createCallbackTask(&workerGlobalSc opeDidDecreaseBufferedAmount, m_workerClientWrapper, amount));
419 } 431 }
420 432
421 static void workerGlobalScopeDidStartClosingHandshake(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper) 433 static void workerGlobalScopeDidStartClosingHandshake(ExecutionContext* context, PassRefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper)
422 { 434 {
423 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); 435 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
424 workerClientWrapper->didStartClosingHandshake(); 436 workerClientWrapper->didStartClosingHandshake();
425 } 437 }
426 438
427 void WorkerThreadableWebSocketChannel::Peer::didStartClosingHandshake() 439 void WorkerThreadableWebSocketChannel::Peer::didStartClosingHandshake()
428 { 440 {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 m_loaderProxy.postTaskToLoader(CallClosureTask::create(bind(&Peer::destroy, m_peer))); 629 m_loaderProxy.postTaskToLoader(CallClosureTask::create(bind(&Peer::destroy, m_peer)));
618 // Peer::destroy() deletes m_peer and then m_syncHelper will be released. 630 // Peer::destroy() deletes m_peer and then m_syncHelper will be released.
619 // We must not touch m_syncHelper any more. 631 // We must not touch m_syncHelper any more.
620 m_syncHelper = 0; 632 m_syncHelper = 0;
621 633
622 // We won't use this any more. 634 // We won't use this any more.
623 m_workerGlobalScope = nullptr; 635 m_workerGlobalScope = nullptr;
624 } 636 }
625 637
626 } // namespace WebCore 638 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698