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

Side by Side Diff: Source/platform/audio/HRTFDatabaseLoader.cpp

Issue 176683003: HRTFDatabaseLoader is not an absolute condition to run audioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/modules/webaudio/RealtimeAnalyser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 27 matching lines...) Expand all
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 // Singleton 41 // Singleton
42 HRTFDatabaseLoader::LoaderMap* HRTFDatabaseLoader::s_loaderMap = 0; 42 HRTFDatabaseLoader::LoaderMap* HRTFDatabaseLoader::s_loaderMap = 0;
43 43
44 PassRefPtr<HRTFDatabaseLoader> HRTFDatabaseLoader::createAndLoadAsynchronouslyIf Necessary(float sampleRate) 44 PassRefPtr<HRTFDatabaseLoader> HRTFDatabaseLoader::createAndLoadAsynchronouslyIf Necessary(float sampleRate)
45 { 45 {
46 ASSERT(isMainThread()); 46 ASSERT(isMainThread());
47 47
48 RefPtr<HRTFDatabaseLoader> loader;
49
50 if (!s_loaderMap) 48 if (!s_loaderMap)
51 s_loaderMap = adoptPtr(new LoaderMap()).leakPtr(); 49 s_loaderMap = adoptPtr(new LoaderMap()).leakPtr();
52 50
53 loader = s_loaderMap->get(sampleRate); 51 RefPtr<HRTFDatabaseLoader> loader = s_loaderMap->get(sampleRate);
54 if (loader) { 52 if (loader) {
55 ASSERT(sampleRate == loader->databaseSampleRate()); 53 ASSERT(sampleRate == loader->databaseSampleRate());
56 return loader; 54 return loader;
57 } 55 }
58 56
59 loader = adoptRef(new HRTFDatabaseLoader(sampleRate)); 57 loader = adoptRef(new HRTFDatabaseLoader(sampleRate));
60 s_loaderMap->add(sampleRate, loader.get()); 58 s_loaderMap->add(sampleRate, loader.get());
61 59
62 loader->loadAsynchronously(); 60 loader->loadAsynchronously();
63 61
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 109
112 void HRTFDatabaseLoader::waitForLoaderThreadCompletion() 110 void HRTFDatabaseLoader::waitForLoaderThreadCompletion()
113 { 111 {
114 MutexLocker locker(m_threadLock); 112 MutexLocker locker(m_threadLock);
115 m_databaseLoaderThread.clear(); 113 m_databaseLoaderThread.clear();
116 } 114 }
117 115
118 } // namespace WebCore 116 } // namespace WebCore
119 117
120 #endif // ENABLE(WEB_AUDIO) 118 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/RealtimeAnalyser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698