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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioNode.cpp

Issue 1738613002: Rename enums/functions that collide in chromium style in core/dom/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-3
Patch Set: get-names-4: Created 4 years, 10 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) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 410
411 // As far as JavaScript is concerned, our outputs must still appear to b e connected. 411 // As far as JavaScript is concerned, our outputs must still appear to b e connected.
412 // But internally our outputs should be disabled from the inputs they're connected to. 412 // But internally our outputs should be disabled from the inputs they're connected to.
413 // disable() can recursively deref connections (and call disable()) down a whole chain of connected nodes. 413 // disable() can recursively deref connections (and call disable()) down a whole chain of connected nodes.
414 414
415 // TODO(rtoy,hongchan): we need special cases the convolver, delay, biqu ad, and IIR since 415 // TODO(rtoy,hongchan): we need special cases the convolver, delay, biqu ad, and IIR since
416 // they have a significant tail-time and shouldn't be disconnected simpl y because they no 416 // they have a significant tail-time and shouldn't be disconnected simpl y because they no
417 // longer have any input connections. This needs to be handled more gene rally where 417 // longer have any input connections. This needs to be handled more gene rally where
418 // AudioNodes have a tailTime attribute. Then the AudioNode only needs t o remain "active" 418 // AudioNodes have a tailTime attribute. Then the AudioNode only needs t o remain "active"
419 // for tailTime seconds after there are no longer any active connections . 419 // for tailTime seconds after there are no longer any active connections .
420 if (nodeType() != NodeTypeConvolver 420 if (getNodeType() != NodeTypeConvolver
421 && nodeType() != NodeTypeDelay 421 && getNodeType() != NodeTypeDelay
422 && nodeType() != NodeTypeBiquadFilter 422 && getNodeType() != NodeTypeBiquadFilter
423 && nodeType() != NodeTypeIIRFilter) { 423 && getNodeType() != NodeTypeIIRFilter) {
424 m_isDisabled = true; 424 m_isDisabled = true;
425 clearInternalStateWhenDisabled(); 425 clearInternalStateWhenDisabled();
426 for (auto& output : m_outputs) 426 for (auto& output : m_outputs)
427 output->disable(); 427 output->disable();
428 } 428 }
429 } 429 }
430 } 430 }
431 431
432 void AudioHandler::makeConnection() 432 void AudioHandler::makeConnection()
433 { 433 {
434 atomicIncrement(&m_connectionRefCount); 434 atomicIncrement(&m_connectionRefCount);
435 435
436 #if DEBUG_AUDIONODE_REFERENCES 436 #if DEBUG_AUDIONODE_REFERENCES
437 fprintf(stderr, "%p: %2d: AudioNode::ref %3d [%3d]\n", 437 fprintf(stderr, "%p: %2d: AudioNode::ref %3d [%3d]\n",
438 this, nodeType(), m_connectionRefCount, s_nodeCount[nodeType()]); 438 this, getNodeType(), m_connectionRefCount, s_nodeCount[getNodeType()]);
439 #endif 439 #endif
440 // See the disabling code in disableOutputsIfNecessary(). This handles 440 // See the disabling code in disableOutputsIfNecessary(). This handles
441 // the case where a node is being re-connected after being used at least 441 // the case where a node is being re-connected after being used at least
442 // once and disconnected. In this case, we need to re-enable. 442 // once and disconnected. In this case, we need to re-enable.
443 enableOutputsIfNecessary(); 443 enableOutputsIfNecessary();
444 } 444 }
445 445
446 void AudioHandler::breakConnection() 446 void AudioHandler::breakConnection()
447 { 447 {
448 // The actual work for deref happens completely within the audio context's 448 // The actual work for deref happens completely within the audio context's
(...skipping 18 matching lines...) Expand all
467 context()->deferredTaskHandler().addDeferredBreakConnection(*this); 467 context()->deferredTaskHandler().addDeferredBreakConnection(*this);
468 } 468 }
469 } 469 }
470 470
471 void AudioHandler::breakConnectionWithLock() 471 void AudioHandler::breakConnectionWithLock()
472 { 472 {
473 atomicDecrement(&m_connectionRefCount); 473 atomicDecrement(&m_connectionRefCount);
474 474
475 #if DEBUG_AUDIONODE_REFERENCES 475 #if DEBUG_AUDIONODE_REFERENCES
476 fprintf(stderr, "%p: %2d: AudioNode::deref %3d [%3d]\n", 476 fprintf(stderr, "%p: %2d: AudioNode::deref %3d [%3d]\n",
477 this, nodeType(), m_connectionRefCount, s_nodeCount[nodeType()]); 477 this, getNodeType(), m_connectionRefCount, s_nodeCount[getNodeType()]);
478 #endif 478 #endif
479 479
480 if (!m_connectionRefCount) 480 if (!m_connectionRefCount)
481 disableOutputsIfNecessary(); 481 disableOutputsIfNecessary();
482 } 482 }
483 483
484 #if DEBUG_AUDIONODE_REFERENCES 484 #if DEBUG_AUDIONODE_REFERENCES
485 485
486 bool AudioHandler::s_isNodeCountInitialized = false; 486 bool AudioHandler::s_isNodeCountInitialized = false;
487 int AudioHandler::s_nodeCount[NodeTypeEnd]; 487 int AudioHandler::s_nodeCount[NodeTypeEnd];
(...skipping 17 matching lines...) Expand all
505 { 505 {
506 m_channelCountMode = m_newChannelCountMode; 506 m_channelCountMode = m_newChannelCountMode;
507 updateChannelsForInputs(); 507 updateChannelsForInputs();
508 } 508 }
509 509
510 unsigned AudioHandler::numberOfOutputChannels() const 510 unsigned AudioHandler::numberOfOutputChannels() const
511 { 511 {
512 // This should only be called for ScriptProcessorNodes which are the only no des where you can 512 // This should only be called for ScriptProcessorNodes which are the only no des where you can
513 // have an output with 0 channels. All other nodes have have at least one o utput channel, so 513 // have an output with 0 channels. All other nodes have have at least one o utput channel, so
514 // there's no reason other nodes should ever call this function. 514 // there's no reason other nodes should ever call this function.
515 ASSERT_WITH_MESSAGE(1, "numberOfOutputChannels() not valid for node type %d" , nodeType()); 515 ASSERT_WITH_MESSAGE(1, "numberOfOutputChannels() not valid for node type %d" , getNodeType());
516 return 1; 516 return 1;
517 } 517 }
518 // ---------------------------------------------------------------- 518 // ----------------------------------------------------------------
519 519
520 AudioNode::AudioNode(AbstractAudioContext& context) 520 AudioNode::AudioNode(AbstractAudioContext& context)
521 : m_context(context) 521 : m_context(context)
522 , m_handler(nullptr) 522 , m_handler(nullptr)
523 { 523 {
524 ThreadState::current()->registerPreFinalizer(this); 524 ThreadState::current()->registerPreFinalizer(this);
525 } 525 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 593
594 if (context() != destination->context()) { 594 if (context() != destination->context()) {
595 exceptionState.throwDOMException( 595 exceptionState.throwDOMException(
596 SyntaxError, 596 SyntaxError,
597 "cannot connect to a destination belonging to a different audio cont ext."); 597 "cannot connect to a destination belonging to a different audio cont ext.");
598 return nullptr; 598 return nullptr;
599 } 599 }
600 600
601 // ScriptProcessorNodes with 0 output channels can't be connected to any des tination. If there 601 // ScriptProcessorNodes with 0 output channels can't be connected to any des tination. If there
602 // are no output channels, what would the destination receive? Just disallo w this. 602 // are no output channels, what would the destination receive? Just disallo w this.
603 if (handler().nodeType() == AudioHandler::NodeTypeJavaScript 603 if (handler().getNodeType() == AudioHandler::NodeTypeJavaScript
604 && handler().numberOfOutputChannels() == 0) { 604 && handler().numberOfOutputChannels() == 0) {
605 exceptionState.throwDOMException( 605 exceptionState.throwDOMException(
606 InvalidAccessError, 606 InvalidAccessError,
607 "cannot connect a ScriptProcessorNode with 0 output channels to any destination node."); 607 "cannot connect a ScriptProcessorNode with 0 output channels to any destination node.");
608 return nullptr; 608 return nullptr;
609 } 609 }
610 610
611 destination->handler().input(inputIndex).connect(handler().output(outputInde x)); 611 destination->handler().input(inputIndex).connect(handler().output(outputInde x));
612 if (!m_connectedNodes[outputIndex]) 612 if (!m_connectedNodes[outputIndex])
613 m_connectedNodes[outputIndex] = new HeapHashSet<Member<AudioNode>>(); 613 m_connectedNodes[outputIndex] = new HeapHashSet<Member<AudioNode>>();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 void AudioNode::didAddOutput(unsigned numberOfOutputs) 934 void AudioNode::didAddOutput(unsigned numberOfOutputs)
935 { 935 {
936 m_connectedNodes.append(nullptr); 936 m_connectedNodes.append(nullptr);
937 ASSERT_UNUSED(numberOfOutputs, numberOfOutputs == m_connectedNodes.size()); 937 ASSERT_UNUSED(numberOfOutputs, numberOfOutputs == m_connectedNodes.size());
938 m_connectedParams.append(nullptr); 938 m_connectedParams.append(nullptr);
939 ASSERT_UNUSED(numberOfOutputs, numberOfOutputs == m_connectedParams.size()); 939 ASSERT_UNUSED(numberOfOutputs, numberOfOutputs == m_connectedParams.size());
940 } 940 }
941 941
942 } // namespace blink 942 } // namespace blink
943 943
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698