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

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

Issue 1878253003: Allow explicit conversion operators and implement WTF::OwnPtr::operator bool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 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) 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Start the asynchronous database loading process. 94 // Start the asynchronous database loading process.
95 m_thread = adoptPtr(Platform::current()->createThread("HRTF database loa der")); 95 m_thread = adoptPtr(Platform::current()->createThread("HRTF database loa der"));
96 // TODO(alexclarke): Should this be posted as a loading task? 96 // TODO(alexclarke): Should this be posted as a loading task?
97 m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(& HRTFDatabaseLoader::loadTask, AllowCrossThreadAccess(this))); 97 m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(& HRTFDatabaseLoader::loadTask, AllowCrossThreadAccess(this)));
98 } 98 }
99 } 99 }
100 100
101 bool HRTFDatabaseLoader::isLoaded() 101 bool HRTFDatabaseLoader::isLoaded()
102 { 102 {
103 MutexLocker locker(m_lock); 103 MutexLocker locker(m_lock);
104 return m_hrtfDatabase; 104 return m_hrtfDatabase.get();
105 } 105 }
106 106
107 // This cleanup task is needed just to make sure that the loader thread finishes 107 // This cleanup task is needed just to make sure that the loader thread finishes
108 // the load task and thus the loader thread doesn't touch m_thread any more. 108 // the load task and thus the loader thread doesn't touch m_thread any more.
109 void HRTFDatabaseLoader::cleanupTask(TaskSynchronizer* sync) 109 void HRTFDatabaseLoader::cleanupTask(TaskSynchronizer* sync)
110 { 110 {
111 sync->taskCompleted(); 111 sync->taskCompleted();
112 } 112 }
113 113
114 void HRTFDatabaseLoader::waitForLoaderThreadCompletion() 114 void HRTFDatabaseLoader::waitForLoaderThreadCompletion()
115 { 115 {
116 if (!m_thread) 116 if (!m_thread)
117 return; 117 return;
118 118
119 TaskSynchronizer sync; 119 TaskSynchronizer sync;
120 // TODO(alexclarke): Should this be posted as a loading task? 120 // TODO(alexclarke): Should this be posted as a loading task?
121 m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&HRTF DatabaseLoader::cleanupTask, AllowCrossThreadAccess(this), AllowCrossThreadAcces s(&sync))); 121 m_thread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&HRTF DatabaseLoader::cleanupTask, AllowCrossThreadAccess(this), AllowCrossThreadAcces s(&sync)));
122 sync.waitForTaskCompletion(); 122 sync.waitForTaskCompletion();
123 m_thread.clear(); 123 m_thread.clear();
124 } 124 }
125 125
126 } // namespace blink 126 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698