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

Side by Side Diff: content/browser/audio_manager_thread.h

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: rebase Created 3 years, 7 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 | « content/browser/BUILD.gn ('k') | content/browser/audio_manager_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_AUDIO_MANAGER_THREAD_H_
6 #define CONTENT_BROWSER_AUDIO_MANAGER_THREAD_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/threading/thread.h"
10 #include "content/common/content_export.h"
11
12 namespace content {
13
14 // This class encapulates the logic for the thread and task runners that the
15 // AudioManager and related classes run on. audio_task_runner and
16 // worker_task_runner should be called on the same thread as the
17 // AudioManagerThread was constructed on.
18 class CONTENT_EXPORT AudioManagerThread {
19 public:
20 // Constructs and starts a thread. On all platforms except for Mac, the
21 // started thread becomes the audio task runner. However, on Mac, the task
22 // runner this object is constructed on will become the audio thread and the
23 // thread is only used for high complexity tasks which can't be run on the
24 // main thread (typically the UI thread).
25 AudioManagerThread();
26 ~AudioManagerThread();
27
28 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const {
29 return task_runner_;
30 };
31
32 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner() const {
33 return thread_.task_runner();
34 }
35
36 private:
37 base::Thread thread_;
38
39 // Task runner to run audio control calls on.
40 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
41
42 DISALLOW_COPY_AND_ASSIGN(AudioManagerThread);
43 };
44
45 } // namespace content
46
47 #endif // CONTENT_BROWSER_AUDIO_MANAGER_THREAD_H_
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/audio_manager_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698