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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AbstractAudioContext.h

Issue 2031393003: WebAudio: record whether user gesture was available and provided. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // - closeContext() has been called. 254 // - closeContext() has been called.
255 // - it has been stopped by its execution context. 255 // - it has been stopped by its execution context.
256 virtual bool isContextClosed() const { return m_isCleared; } 256 virtual bool isContextClosed() const { return m_isCleared; }
257 257
258 // Get the security origin for this audio context. 258 // Get the security origin for this audio context.
259 SecurityOrigin* getSecurityOrigin() const; 259 SecurityOrigin* getSecurityOrigin() const;
260 260
261 // Get the PeriodicWave for the specified oscillator type. The table is ini tialized internally 261 // Get the PeriodicWave for the specified oscillator type. The table is ini tialized internally
262 // if necessary. 262 // if necessary.
263 PeriodicWave* periodicWave(int type); 263 PeriodicWave* periodicWave(int type);
264
265 // Check whether the AudioContext requires a user gesture and whether the
266 // current stack is processing user gesture and record these information in
267 // a histogram.
268 void recordUserGesture();
269
264 protected: 270 protected:
265 explicit AbstractAudioContext(Document*); 271 explicit AbstractAudioContext(Document*);
266 AbstractAudioContext(Document*, unsigned numberOfChannels, size_t numberOfFr ames, float sampleRate); 272 AbstractAudioContext(Document*, unsigned numberOfChannels, size_t numberOfFr ames, float sampleRate);
267 273
268 void initialize(); 274 void initialize();
269 void uninitialize(); 275 void uninitialize();
270 276
271 void setContextState(AudioContextState); 277 void setContextState(AudioContextState);
272 278
273 virtual void didClose() {} 279 virtual void didClose() {}
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 void resolvePromisesForResumeOnMainThread(); 335 void resolvePromisesForResumeOnMainThread();
330 336
331 // When the context is going away, reject any pending script promise resolve rs. 337 // When the context is going away, reject any pending script promise resolve rs.
332 virtual void rejectPendingResolvers(); 338 virtual void rejectPendingResolvers();
333 339
334 // True if we're in the process of resolving promises for resume(). Resolvi ng can take some 340 // True if we're in the process of resolving promises for resume(). Resolvi ng can take some
335 // time and the audio context process loop is very fast, so we don't want to call resolve an 341 // time and the audio context process loop is very fast, so we don't want to call resolve an
336 // excessive number of times. 342 // excessive number of times.
337 bool m_isResolvingResumePromises; 343 bool m_isResolvingResumePromises;
338 344
345 // Whether a user gesture is required to start this AudioContext.
346 bool m_userGestureRequired;
347
339 unsigned m_connectionCount; 348 unsigned m_connectionCount;
340 349
341 // Graph locking. 350 // Graph locking.
342 RefPtr<DeferredTaskHandler> m_deferredTaskHandler; 351 RefPtr<DeferredTaskHandler> m_deferredTaskHandler;
343 352
344 // The state of the AbstractAudioContext. 353 // The state of the AbstractAudioContext.
345 AudioContextState m_contextState; 354 AudioContextState m_contextState;
346 355
347 AsyncAudioDecoder m_audioDecoder; 356 AsyncAudioDecoder m_audioDecoder;
348 357
(...skipping 15 matching lines...) Expand all
364 Member<PeriodicWave> m_periodicWaveTriangle; 373 Member<PeriodicWave> m_periodicWaveTriangle;
365 374
366 // This is considering 32 is large enough for multiple channels audio. 375 // This is considering 32 is large enough for multiple channels audio.
367 // It is somewhat arbitrary and could be increased if necessary. 376 // It is somewhat arbitrary and could be increased if necessary.
368 enum { MaxNumberOfChannels = 32 }; 377 enum { MaxNumberOfChannels = 32 };
369 }; 378 };
370 379
371 } // namespace blink 380 } // namespace blink
372 381
373 #endif // AbstractAudioContext_h 382 #endif // AbstractAudioContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698