| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 #include "ui/gl/gl_switches.h" | 181 #include "ui/gl/gl_switches.h" |
| 182 #include "ui/gl/gpu_switching_manager.h" | 182 #include "ui/gl/gpu_switching_manager.h" |
| 183 #include "ui/native_theme/native_theme_switches.h" | 183 #include "ui/native_theme/native_theme_switches.h" |
| 184 | 184 |
| 185 #if defined(OS_ANDROID) | 185 #if defined(OS_ANDROID) |
| 186 #include "content/browser/android/child_process_launcher_android.h" | 186 #include "content/browser/android/child_process_launcher_android.h" |
| 187 #include "content/browser/media/android/browser_demuxer_android.h" | 187 #include "content/browser/media/android/browser_demuxer_android.h" |
| 188 #include "content/browser/mojo/service_registrar_android.h" | 188 #include "content/browser/mojo/service_registrar_android.h" |
| 189 #include "content/browser/screen_orientation/screen_orientation_message_filter_a
ndroid.h" | 189 #include "content/browser/screen_orientation/screen_orientation_message_filter_a
ndroid.h" |
| 190 #include "ipc/ipc_sync_channel.h" | 190 #include "ipc/ipc_sync_channel.h" |
| 191 #include "media/audio/android/audio_manager_android.h" |
| 191 #endif | 192 #endif |
| 192 | 193 |
| 193 #if defined(OS_WIN) | 194 #if defined(OS_WIN) |
| 194 #include "base/win/scoped_com_initializer.h" | 195 #include "base/win/scoped_com_initializer.h" |
| 195 #include "base/win/windows_version.h" | 196 #include "base/win/windows_version.h" |
| 196 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" | 197 #include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h" |
| 197 #include "content/common/font_cache_dispatcher_win.h" | 198 #include "content/common/font_cache_dispatcher_win.h" |
| 198 #include "content/common/sandbox_win.h" | 199 #include "content/common/sandbox_win.h" |
| 199 #include "sandbox/win/src/sandbox_policy.h" | 200 #include "sandbox/win/src/sandbox_policy.h" |
| 200 #include "ui/display/win/dpi.h" | 201 #include "ui/display/win/dpi.h" |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 sent_render_process_ready_ = false; | 727 sent_render_process_ready_ = false; |
| 727 | 728 |
| 728 // Setup the IPC channel. | 729 // Setup the IPC channel. |
| 729 const std::string channel_id = | 730 const std::string channel_id = |
| 730 IPC::Channel::GenerateVerifiedChannelID(std::string()); | 731 IPC::Channel::GenerateVerifiedChannelID(std::string()); |
| 731 channel_ = CreateChannelProxy(channel_id); | 732 channel_ = CreateChannelProxy(channel_id); |
| 732 | 733 |
| 733 // Call the embedder first so that their IPC filters have priority. | 734 // Call the embedder first so that their IPC filters have priority. |
| 734 GetContentClient()->browser()->RenderProcessWillLaunch(this); | 735 GetContentClient()->browser()->RenderProcessWillLaunch(this); |
| 735 | 736 |
| 737 #if !defined(OS_MACOSX) |
| 738 // Intentionally delay the hang monitor creation after the first renderer |
| 739 // is created. On Mac audio thread is the UI thread, a hang monitor is not |
| 740 // necessary or recommended. |
| 741 media::AudioManager::StartHangMonitorIfNeeded( |
| 742 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 743 #endif // !defined(OS_MACOSX) |
| 744 |
| 745 #if defined(OS_ANDROID) |
| 746 // Initialize the java audio manager so that media session tests will pass. |
| 747 // See internal b/29872494. |
| 748 static_cast<media::AudioManagerAndroid*>(media::AudioManager::Get())-> |
| 749 InitializeIfNeeded(); |
| 750 #endif // defined(OS_ANDROID) |
| 751 |
| 736 CreateMessageFilters(); | 752 CreateMessageFilters(); |
| 737 RegisterMojoInterfaces(); | 753 RegisterMojoInterfaces(); |
| 738 | 754 |
| 739 if (run_renderer_in_process()) { | 755 if (run_renderer_in_process()) { |
| 740 DCHECK(g_renderer_main_thread_factory); | 756 DCHECK(g_renderer_main_thread_factory); |
| 741 // Crank up a thread and run the initialization there. With the way that | 757 // Crank up a thread and run the initialization there. With the way that |
| 742 // messages flow between the browser and renderer, this thread is required | 758 // messages flow between the browser and renderer, this thread is required |
| 743 // to prevent a deadlock in single-process mode. Since the primordial | 759 // to prevent a deadlock in single-process mode. Since the primordial |
| 744 // thread in the renderer process runs the WebKit code and can sometimes | 760 // thread in the renderer process runs the WebKit code and can sometimes |
| 745 // make blocking calls to the UI thread (i.e. this thread), they need to run | 761 // make blocking calls to the UI thread (i.e. this thread), they need to run |
| (...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2826 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2842 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 2827 | 2843 |
| 2828 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2844 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 2829 // enough information here so that we can determine what the bad message was. | 2845 // enough information here so that we can determine what the bad message was. |
| 2830 base::debug::Alias(&error); | 2846 base::debug::Alias(&error); |
| 2831 bad_message::ReceivedBadMessage(process.get(), | 2847 bad_message::ReceivedBadMessage(process.get(), |
| 2832 bad_message::RPH_MOJO_PROCESS_ERROR); | 2848 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 2833 } | 2849 } |
| 2834 | 2850 |
| 2835 } // namespace content | 2851 } // namespace content |
| OLD | NEW |