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

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

Issue 2713793004: Add dictionary for OfflineAudioContext constructor (Closed)
Patch Set: Rebase Created 3 years, 8 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 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 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 16 matching lines...) Expand all
27 #include "bindings/core/v8/ExceptionMessages.h" 27 #include "bindings/core/v8/ExceptionMessages.h"
28 #include "bindings/core/v8/ExceptionState.h" 28 #include "bindings/core/v8/ExceptionState.h"
29 #include "bindings/core/v8/ScriptState.h" 29 #include "bindings/core/v8/ScriptState.h"
30 #include "core/dom/DOMException.h" 30 #include "core/dom/DOMException.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/ExceptionCode.h" 32 #include "core/dom/ExceptionCode.h"
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "modules/webaudio/AudioListener.h" 34 #include "modules/webaudio/AudioListener.h"
35 #include "modules/webaudio/DeferredTaskHandler.h" 35 #include "modules/webaudio/DeferredTaskHandler.h"
36 #include "modules/webaudio/OfflineAudioCompletionEvent.h" 36 #include "modules/webaudio/OfflineAudioCompletionEvent.h"
37 #include "modules/webaudio/OfflineAudioContextOptions.h"
37 #include "modules/webaudio/OfflineAudioDestinationNode.h" 38 #include "modules/webaudio/OfflineAudioDestinationNode.h"
38 39
39 #include "platform/CrossThreadFunctional.h" 40 #include "platform/CrossThreadFunctional.h"
40 #include "platform/Histogram.h" 41 #include "platform/Histogram.h"
41 #include "platform/audio/AudioUtilities.h" 42 #include "platform/audio/AudioUtilities.h"
42 #include "public/platform/Platform.h" 43 #include "public/platform/Platform.h"
43 44
44 namespace blink { 45 namespace blink {
45 46
46 OfflineAudioContext* OfflineAudioContext::Create( 47 OfflineAudioContext* OfflineAudioContext::Create(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 CustomCountHistogram, offline_context_sample_rate_histogram, 122 CustomCountHistogram, offline_context_sample_rate_histogram,
122 ("WebAudio.OfflineAudioContext.SampleRate384kHz", 3000, 384000, 50)); 123 ("WebAudio.OfflineAudioContext.SampleRate384kHz", 3000, 384000, 50));
123 124
124 offline_context_channel_count_histogram.Sample(number_of_channels); 125 offline_context_channel_count_histogram.Sample(number_of_channels);
125 offline_context_length_histogram.Count(number_of_frames); 126 offline_context_length_histogram.Count(number_of_frames);
126 offline_context_sample_rate_histogram.Count(sample_rate); 127 offline_context_sample_rate_histogram.Count(sample_rate);
127 128
128 return audio_context; 129 return audio_context;
129 } 130 }
130 131
132 OfflineAudioContext* OfflineAudioContext::Create(
133 ExecutionContext* context,
134 const OfflineAudioContextOptions& options,
135 ExceptionState& exception_state) {
136 OfflineAudioContext* offline_context =
137 Create(context, options.hasChannelCount() ? options.channelCount() : 1,
138 options.length(), options.sampleRate(), exception_state);
139 if (offline_context) {
140 offline_context->DestinationHandler().SetChannelCountMode(
141 options.hasChannelCountMode() ? options.channelCountMode() : "explicit",
142 exception_state);
143 offline_context->DestinationHandler().SetChannelInterpretation(
144 options.hasChannelInterpretation() ? options.channelInterpretation()
145 : "speakers",
146 exception_state);
147 }
148
149 return offline_context;
150 }
151
131 OfflineAudioContext::OfflineAudioContext(Document* document, 152 OfflineAudioContext::OfflineAudioContext(Document* document,
132 unsigned number_of_channels, 153 unsigned number_of_channels,
133 size_t number_of_frames, 154 size_t number_of_frames,
134 float sample_rate, 155 float sample_rate,
135 ExceptionState& exception_state) 156 ExceptionState& exception_state)
136 : BaseAudioContext(document, 157 : BaseAudioContext(document,
137 number_of_channels, 158 number_of_channels,
138 number_of_frames, 159 number_of_frames,
139 sample_rate), 160 sample_rate),
140 is_rendering_started_(false), 161 is_rendering_started_(false),
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 473
453 // Note that the GraphLock is required before this check. Since this needs 474 // Note that the GraphLock is required before this check. Since this needs
454 // to run on the audio thread, OfflineGraphAutoLocker must be used. 475 // to run on the audio thread, OfflineGraphAutoLocker must be used.
455 if (scheduled_suspends_.Contains(CurrentSampleFrame())) 476 if (scheduled_suspends_.Contains(CurrentSampleFrame()))
456 return true; 477 return true;
457 478
458 return false; 479 return false;
459 } 480 }
460 481
461 } // namespace blink 482 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698