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

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

Issue 670113002: Oilpan: A thread that is not attached to Oilpan shouldn't create a CrossThreadPersistent Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/CrossThreadCopier.h ('k') | Source/platform/heap/Handle.h » ('j') | 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 17 matching lines...) Expand all
28 28
29 #include "config.h" 29 #include "config.h"
30 30
31 #if ENABLE(WEB_AUDIO) 31 #if ENABLE(WEB_AUDIO)
32 32
33 #include "platform/audio/HRTFDatabaseLoader.h" 33 #include "platform/audio/HRTFDatabaseLoader.h"
34 34
35 #include "platform/Task.h" 35 #include "platform/Task.h"
36 #include "public/platform/Platform.h" 36 #include "public/platform/Platform.h"
37 #include "wtf/MainThread.h" 37 #include "wtf/MainThread.h"
38 #include "wtf/UnretainedPtr.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 typedef HeapHashMap<double, WeakMember<HRTFDatabaseLoader> > LoaderMap; 42 typedef HeapHashMap<double, WeakMember<HRTFDatabaseLoader> > LoaderMap;
42 43
43 static LoaderMap& loaderMap() 44 static LoaderMap& loaderMap()
44 { 45 {
45 DEFINE_STATIC_LOCAL(Persistent<LoaderMap>, map, (new LoaderMap)); 46 DEFINE_STATIC_LOCAL(Persistent<LoaderMap>, map, (new LoaderMap));
46 return *map; 47 return *map;
47 } 48 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 88
88 void HRTFDatabaseLoader::loadAsynchronously() 89 void HRTFDatabaseLoader::loadAsynchronously()
89 { 90 {
90 ASSERT(isMainThread()); 91 ASSERT(isMainThread());
91 92
92 MutexLocker locker(m_threadLock); 93 MutexLocker locker(m_threadLock);
93 94
94 if (!m_hrtfDatabase && !m_databaseLoaderThread) { 95 if (!m_hrtfDatabase && !m_databaseLoaderThread) {
95 // Start the asynchronous database loading process. 96 // Start the asynchronous database loading process.
96 m_databaseLoaderThread = adoptPtr(Platform::current()->createThread("HRT F database loader")); 97 m_databaseLoaderThread = adoptPtr(Platform::current()->createThread("HRT F database loader"));
97 m_databaseLoaderThread->postTask(new Task(WTF::bind(&HRTFDatabaseLoader: :load, this))); 98 m_databaseLoaderThread->postTask(new Task(WTF::bind(&HRTFDatabaseLoader: :load, UnretainedPtr<HRTFDatabaseLoader>(this))));
98 } 99 }
99 } 100 }
100 101
101 bool HRTFDatabaseLoader::isLoaded() const 102 bool HRTFDatabaseLoader::isLoaded() const
102 { 103 {
103 return m_hrtfDatabase; 104 return m_hrtfDatabase;
104 } 105 }
105 106
106 void HRTFDatabaseLoader::waitForLoaderThreadCompletion() 107 void HRTFDatabaseLoader::waitForLoaderThreadCompletion()
107 { 108 {
108 MutexLocker locker(m_threadLock); 109 MutexLocker locker(m_threadLock);
109 m_databaseLoaderThread.clear(); 110 m_databaseLoaderThread.clear();
110 } 111 }
111 112
112 } // namespace blink 113 } // namespace blink
113 114
114 #endif // ENABLE(WEB_AUDIO) 115 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/platform/CrossThreadCopier.h ('k') | Source/platform/heap/Handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698