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

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

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: fixes content_browsertests and content_unittests Created 3 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ 5 #ifndef CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_
6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ 6 #define CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/browser/browser_process_sub_thread.h" 15 #include "content/browser/browser_process_sub_thread.h"
16 #include "content/public/browser/browser_main_runner.h" 16 #include "content/public/browser/browser_main_runner.h"
17 #include "media/audio/audio_manager.h"
18 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h" 17 #include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
19 18
20 #if defined(USE_AURA) 19 #if defined(USE_AURA)
21 namespace aura { 20 namespace aura {
22 class Env; 21 class Env;
23 } 22 }
24 #endif 23 #endif
25 24
26 namespace base { 25 namespace base {
27 class CommandLine; 26 class CommandLine;
28 class FilePath; 27 class FilePath;
29 class HighResolutionTimerManager; 28 class HighResolutionTimerManager;
30 class MemoryPressureMonitor; 29 class MemoryPressureMonitor;
31 class MessageLoop; 30 class MessageLoop;
32 class PowerMonitor; 31 class PowerMonitor;
33 class SystemMonitor; 32 class SystemMonitor;
34 namespace trace_event { 33 namespace trace_event {
35 class TraceEventSystemStatsMonitor; 34 class TraceEventSystemStatsMonitor;
36 } // namespace trace_event 35 } // namespace trace_event
37 } // namespace base 36 } // namespace base
38 37
39 namespace discardable_memory { 38 namespace discardable_memory {
40 class DiscardableSharedMemoryManager; 39 class DiscardableSharedMemoryManager;
41 } 40 }
42 41
43 namespace media { 42 namespace media {
43 class AudioManager;
44 class AudioSystem; 44 class AudioSystem;
45 #if defined(OS_WIN) 45 #if defined(OS_WIN)
46 class SystemMessageWindowWin; 46 class SystemMessageWindowWin;
47 #elif defined(OS_LINUX) && defined(USE_UDEV) 47 #elif defined(OS_LINUX) && defined(USE_UDEV)
48 class DeviceMonitorLinux; 48 class DeviceMonitorLinux;
49 #endif 49 #endif
50 class UserInputMonitor; 50 class UserInputMonitor;
51 #if defined(OS_MACOSX) 51 #if defined(OS_MACOSX)
52 class DeviceMonitorMac; 52 class DeviceMonitorMac;
53 #endif 53 #endif
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 void MainMessageLoopRun(); 188 void MainMessageLoopRun();
189 189
190 void InitializeMojo(); 190 void InitializeMojo();
191 base::FilePath GetStartupTraceFileName( 191 base::FilePath GetStartupTraceFileName(
192 const base::CommandLine& command_line) const; 192 const base::CommandLine& command_line) const;
193 void InitStartupTracingForDuration(const base::CommandLine& command_line); 193 void InitStartupTracingForDuration(const base::CommandLine& command_line);
194 void EndStartupTracing(); 194 void EndStartupTracing();
195 195
196 void CreateAudioManager(); 196 void CreateAudioManager();
197 void DestroyAudioManager();
198
197 bool UsingInProcessGpu() const; 199 bool UsingInProcessGpu() const;
198 200
199 void InitializeMemoryManagementComponent(); 201 void InitializeMemoryManagementComponent();
200 202
201 // Quick reference for initialization order: 203 // Quick reference for initialization order:
202 // Constructor 204 // Constructor
203 // Init() 205 // Init()
204 // EarlyInitialization() 206 // EarlyInitialization()
205 // InitializeToolkit() 207 // InitializeToolkit()
206 // PreMainMessageLoopStart() 208 // PreMainMessageLoopStart()
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 std::unique_ptr<BrowserProcessSubThread> cache_thread_; 290 std::unique_ptr<BrowserProcessSubThread> cache_thread_;
289 std::unique_ptr<BrowserProcessSubThread> io_thread_; 291 std::unique_ptr<BrowserProcessSubThread> io_thread_;
290 292
291 // Members initialized in |BrowserThreadsStarted()| -------------------------- 293 // Members initialized in |BrowserThreadsStarted()| --------------------------
292 std::unique_ptr<base::Thread> indexed_db_thread_; 294 std::unique_ptr<base::Thread> indexed_db_thread_;
293 std::unique_ptr<ServiceManagerContext> service_manager_context_; 295 std::unique_ptr<ServiceManagerContext> service_manager_context_;
294 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_; 296 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_;
295 297
296 // |user_input_monitor_| has to outlive |audio_manager_|, so declared first. 298 // |user_input_monitor_| has to outlive |audio_manager_|, so declared first.
297 std::unique_ptr<media::UserInputMonitor> user_input_monitor_; 299 std::unique_ptr<media::UserInputMonitor> user_input_monitor_;
298 // AudioThread needs to outlive |audio_manager_|. 300 std::unique_ptr<media::AudioManager> audio_manager_;
301 // |audio_thread_| must be stopped before |audio_manager_| is deleted so
302 // that tasks referering to the |audio_manager_| cannot be posted.
299 std::unique_ptr<AudioManagerThread> audio_thread_; 303 std::unique_ptr<AudioManagerThread> audio_thread_;
300 media::ScopedAudioManagerPtr audio_manager_;
301 // Calls to |audio_system_| must not be posted to the audio thread if it 304 // Calls to |audio_system_| must not be posted to the audio thread if it
302 // differs from the UI one. 305 // differs from the UI one.
303 std::unique_ptr<media::AudioSystem> audio_system_; 306 std::unique_ptr<media::AudioSystem> audio_system_;
304 307
305 std::unique_ptr<midi::MidiService> midi_service_; 308 std::unique_ptr<midi::MidiService> midi_service_;
306 309
307 #if defined(OS_WIN) 310 #if defined(OS_WIN)
308 std::unique_ptr<media::SystemMessageWindowWin> system_message_window_; 311 std::unique_ptr<media::SystemMessageWindowWin> system_message_window_;
309 #elif defined(OS_LINUX) && defined(USE_UDEV) 312 #elif defined(OS_LINUX) && defined(USE_UDEV)
310 std::unique_ptr<media::DeviceMonitorLinux> device_monitor_linux_; 313 std::unique_ptr<media::DeviceMonitorLinux> device_monitor_linux_;
(...skipping 15 matching lines...) Expand all
326 memory_instrumentation_coordinator_; 329 memory_instrumentation_coordinator_;
327 330
328 // DO NOT add members here. Add them to the right categories above. 331 // DO NOT add members here. Add them to the right categories above.
329 332
330 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop); 333 DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop);
331 }; 334 };
332 335
333 } // namespace content 336 } // namespace content
334 337
335 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_ 338 #endif // CONTENT_BROWSER_BROWSER_MAIN_LOOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698