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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
625 { | 625 { |
626 base::SetRecordActionTaskRunner( | 626 base::SetRecordActionTaskRunner( |
627 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)); | 627 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)); |
628 } | 628 } |
629 | 629 |
630 #if defined(OS_WIN) | 630 #if defined(OS_WIN) |
631 if (base::win::GetVersion() >= base::win::VERSION_WIN8) | 631 if (base::win::GetVersion() >= base::win::VERSION_WIN8) |
632 screen_orientation_delegate_.reset(new ScreenOrientationDelegateWin()); | 632 screen_orientation_delegate_.reset(new ScreenOrientationDelegateWin()); |
633 #endif | 633 #endif |
634 | 634 |
635 // Initialize the singleton discardable_memory::DiscardableSharedMemoryManager | |
636 // here to avoid initialization happening in IO thread. | |
637 auto discardable_shared_memory_manager = | |
638 discardable_memory::DiscardableSharedMemoryManager::current(); | |
reveman
2016/11/18 21:55:25
Why would it be initialize on the IO thread? Ideal
Peng
2016/11/21 15:56:38
I just tried your suggestion. The content_browsert
| |
639 | |
635 // TODO(boliu): kSingleProcess check is a temporary workaround for | 640 // TODO(boliu): kSingleProcess check is a temporary workaround for |
636 // in-process Android WebView. crbug.com/503724 tracks proper fix. | 641 // in-process Android WebView. crbug.com/503724 tracks proper fix. |
637 if (!parsed_command_line_.HasSwitch(switches::kSingleProcess)) { | 642 if (!parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
638 base::DiscardableMemoryAllocator::SetInstance( | 643 base::DiscardableMemoryAllocator::SetInstance( |
639 discardable_memory::DiscardableSharedMemoryManager::current()); | 644 discardable_shared_memory_manager); |
640 } | 645 } |
641 | 646 |
642 if (parts_) | 647 if (parts_) |
643 parts_->PostMainMessageLoopStart(); | 648 parts_->PostMainMessageLoopStart(); |
644 | 649 |
645 // Start startup tracing through TracingController's interface. TraceLog has | 650 // Start startup tracing through TracingController's interface. TraceLog has |
646 // been enabled in content_main_runner where threads are not available. Now We | 651 // been enabled in content_main_runner where threads are not available. Now We |
647 // need to start tracing for all other tracing agents, which require threads. | 652 // need to start tracing for all other tracing agents, which require threads. |
648 if (parsed_command_line_.HasSwitch(switches::kTraceStartup)) { | 653 if (parsed_command_line_.HasSwitch(switches::kTraceStartup)) { |
649 base::trace_event::TraceConfig trace_config( | 654 base::trace_event::TraceConfig trace_config( |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1619 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1624 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
1620 audio_thread_->task_runner(); | 1625 audio_thread_->task_runner(); |
1621 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1626 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
1622 std::move(worker_task_runner), | 1627 std::move(worker_task_runner), |
1623 MediaInternals::GetInstance()); | 1628 MediaInternals::GetInstance()); |
1624 } | 1629 } |
1625 CHECK(audio_manager_); | 1630 CHECK(audio_manager_); |
1626 } | 1631 } |
1627 | 1632 |
1628 } // namespace content | 1633 } // namespace content |
OLD | NEW |