| OLD | NEW |
| 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 #include "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/hi_res_timer_manager.h" | 10 #include "base/hi_res_timer_manager.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 HISTOGRAM_MEMORY_KB("Memory.BrowserUsed", private_bytes >> 10); | 258 HISTOGRAM_MEMORY_KB("Memory.BrowserUsed", private_bytes >> 10); |
| 259 #endif | 259 #endif |
| 260 } | 260 } |
| 261 private: | 261 private: |
| 262 DISALLOW_COPY_AND_ASSIGN(MemoryObserver); | 262 DISALLOW_COPY_AND_ASSIGN(MemoryObserver); |
| 263 }; | 263 }; |
| 264 | 264 |
| 265 | 265 |
| 266 // static | 266 // static |
| 267 media::AudioManager* BrowserMainLoop::GetAudioManager() { | 267 media::AudioManager* BrowserMainLoop::GetAudioManager() { |
| 268 return g_current_browser_main_loop->audio_manager_.get(); | 268 if (g_current_browser_main_loop) |
| 269 return g_current_browser_main_loop->audio_manager_.get(); |
| 270 return NULL; |
| 269 } | 271 } |
| 270 | 272 |
| 271 // static | 273 // static |
| 272 AudioMirroringManager* BrowserMainLoop::GetAudioMirroringManager() { | 274 AudioMirroringManager* BrowserMainLoop::GetAudioMirroringManager() { |
| 273 return g_current_browser_main_loop->audio_mirroring_manager_.get(); | 275 return g_current_browser_main_loop->audio_mirroring_manager_.get(); |
| 274 } | 276 } |
| 275 | 277 |
| 276 // static | 278 // static |
| 277 MediaStreamManager* BrowserMainLoop::GetMediaStreamManager() { | 279 MediaStreamManager* BrowserMainLoop::GetMediaStreamManager() { |
| 278 return g_current_browser_main_loop->media_stream_manager_.get(); | 280 if (g_current_browser_main_loop) |
| 281 return g_current_browser_main_loop->media_stream_manager_.get(); |
| 282 return NULL; |
| 279 } | 283 } |
| 280 // BrowserMainLoop construction / destruction ============================= | 284 // BrowserMainLoop construction / destruction ============================= |
| 281 | 285 |
| 282 BrowserMainLoop::BrowserMainLoop(const MainFunctionParams& parameters) | 286 BrowserMainLoop::BrowserMainLoop(const MainFunctionParams& parameters) |
| 283 : parameters_(parameters), | 287 : parameters_(parameters), |
| 284 parsed_command_line_(parameters.command_line), | 288 parsed_command_line_(parameters.command_line), |
| 285 result_code_(RESULT_CODE_NORMAL_EXIT) { | 289 result_code_(RESULT_CODE_NORMAL_EXIT) { |
| 286 DCHECK(!g_current_browser_main_loop); | 290 DCHECK(!g_current_browser_main_loop); |
| 287 g_current_browser_main_loop = this; | 291 g_current_browser_main_loop = this; |
| 288 } | 292 } |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 if (parameters_.ui_task) | 910 if (parameters_.ui_task) |
| 907 base::MessageLoopForUI::current()->PostTask(FROM_HERE, | 911 base::MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 908 *parameters_.ui_task); | 912 *parameters_.ui_task); |
| 909 | 913 |
| 910 base::RunLoop run_loop; | 914 base::RunLoop run_loop; |
| 911 run_loop.Run(); | 915 run_loop.Run(); |
| 912 #endif | 916 #endif |
| 913 } | 917 } |
| 914 | 918 |
| 915 } // namespace content | 919 } // namespace content |
| OLD | NEW |