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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/metrics/stats_table.h" | 18 #include "base/metrics/stats_table.h" |
| 19 #include "base/path_service.h" |
19 #include "base/shared_memory.h" | 20 #include "base/shared_memory.h" |
20 #include "base/string_number_conversions.h" // Temporary | 21 #include "base/string_number_conversions.h" // Temporary |
21 #include "base/threading/thread_local.h" | 22 #include "base/threading/thread_local.h" |
22 #include "base/values.h" | 23 #include "base/values.h" |
23 #include "base/win/scoped_com_initializer.h" | 24 #include "base/win/scoped_com_initializer.h" |
24 #include "content/common/appcache/appcache_dispatcher.h" | 25 #include "content/common/appcache/appcache_dispatcher.h" |
25 #include "content/common/child_process_messages.h" | 26 #include "content/common/child_process_messages.h" |
26 #include "content/common/database_messages.h" | 27 #include "content/common/database_messages.h" |
27 #include "content/common/db_message_filter.h" | 28 #include "content/common/db_message_filter.h" |
28 #include "content/common/dom_storage_messages.h" | 29 #include "content/common/dom_storage_messages.h" |
29 #include "content/common/gpu/client/gpu_channel_host.h" | 30 #include "content/common/gpu/client/gpu_channel_host.h" |
30 #include "content/common/gpu/gpu_messages.h" | 31 #include "content/common/gpu/gpu_messages.h" |
31 #include "content/common/indexed_db/indexed_db_dispatcher.h" | 32 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
32 #include "content/common/indexed_db/indexed_db_message_filter.h" | 33 #include "content/common/indexed_db/indexed_db_message_filter.h" |
33 #include "content/common/indexed_db/proxy_webidbfactory_impl.h" | 34 #include "content/common/indexed_db/proxy_webidbfactory_impl.h" |
34 #include "content/common/npobject_util.h" | 35 #include "content/common/npobject_util.h" |
35 #include "content/common/plugin_messages.h" | 36 #include "content/common/plugin_messages.h" |
36 #include "content/common/resource_dispatcher.h" | 37 #include "content/common/resource_dispatcher.h" |
37 #include "content/common/resource_messages.h" | 38 #include "content/common/resource_messages.h" |
38 #include "content/common/view_messages.h" | 39 #include "content/common/view_messages.h" |
39 #include "content/common/web_database_observer_impl.h" | 40 #include "content/common/web_database_observer_impl.h" |
| 41 #include "content/public/common/content_paths.h" |
40 #include "content/public/common/content_switches.h" | 42 #include "content/public/common/content_switches.h" |
41 #include "content/public/common/renderer_preferences.h" | 43 #include "content/public/common/renderer_preferences.h" |
42 #include "content/public/renderer/content_renderer_client.h" | 44 #include "content/public/renderer/content_renderer_client.h" |
43 #include "content/public/renderer/render_process_observer.h" | 45 #include "content/public/renderer/render_process_observer.h" |
44 #include "content/public/renderer/render_view_visitor.h" | 46 #include "content/public/renderer/render_view_visitor.h" |
45 #include "content/renderer/devtools_agent_filter.h" | 47 #include "content/renderer/devtools_agent_filter.h" |
46 #include "content/renderer/gpu/compositor_thread.h" | 48 #include "content/renderer/gpu/compositor_thread.h" |
47 #include "content/renderer/media/audio_input_message_filter.h" | 49 #include "content/renderer/media/audio_input_message_filter.h" |
48 #include "content/renderer/media/audio_message_filter.h" | 50 #include "content/renderer/media/audio_message_filter.h" |
49 #include "content/renderer/media/video_capture_impl_manager.h" | 51 #include "content/renderer/media/video_capture_impl_manager.h" |
50 #include "content/renderer/media/video_capture_message_filter.h" | 52 #include "content/renderer/media/video_capture_message_filter.h" |
51 #include "content/renderer/plugin_channel_host.h" | 53 #include "content/renderer/plugin_channel_host.h" |
52 #include "content/renderer/render_process_impl.h" | 54 #include "content/renderer/render_process_impl.h" |
53 #include "content/renderer/render_view_impl.h" | 55 #include "content/renderer/render_view_impl.h" |
54 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 56 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
55 #include "grit/content_resources.h" | 57 #include "grit/content_resources.h" |
56 #include "ipc/ipc_channel_handle.h" | 58 #include "ipc/ipc_channel_handle.h" |
57 #include "ipc/ipc_platform_file.h" | 59 #include "ipc/ipc_platform_file.h" |
| 60 #include "media/base/media.h" |
58 #include "net/base/net_errors.h" | 61 #include "net/base/net_errors.h" |
59 #include "net/base/net_util.h" | 62 #include "net/base/net_util.h" |
60 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" | 63 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" |
61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebColorName.h" | 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebColorName.h" |
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" | 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" |
64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 69 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi
er.h" | 70 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifi
er.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 audio_message_filter_ = new AudioMessageFilter(); | 221 audio_message_filter_ = new AudioMessageFilter(); |
219 AddFilter(audio_message_filter_.get()); | 222 AddFilter(audio_message_filter_.get()); |
220 | 223 |
221 devtools_agent_message_filter_ = new DevToolsAgentFilter(); | 224 devtools_agent_message_filter_ = new DevToolsAgentFilter(); |
222 AddFilter(devtools_agent_message_filter_.get()); | 225 AddFilter(devtools_agent_message_filter_.get()); |
223 | 226 |
224 AddFilter(new IndexedDBMessageFilter); | 227 AddFilter(new IndexedDBMessageFilter); |
225 | 228 |
226 content::GetContentClient()->renderer()->RenderThreadStarted(); | 229 content::GetContentClient()->renderer()->RenderThreadStarted(); |
227 | 230 |
| 231 // Note that under Linux, the media library will normally already have |
| 232 // been initialized by the Zygote before this instance became a Renderer. |
| 233 FilePath media_path; |
| 234 PathService::Get(content::DIR_MEDIA_LIBS, &media_path); |
| 235 if (!media_path.empty()) |
| 236 media::InitializeMediaLibrary(media_path); |
| 237 |
228 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); | 238 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); |
229 } | 239 } |
230 | 240 |
231 RenderThreadImpl::~RenderThreadImpl() { | 241 RenderThreadImpl::~RenderThreadImpl() { |
232 FOR_EACH_OBSERVER( | 242 FOR_EACH_OBSERVER( |
233 RenderProcessObserver, observers_, OnRenderProcessShutdown()); | 243 RenderProcessObserver, observers_, OnRenderProcessShutdown()); |
234 | 244 |
235 // Wait for all databases to be closed. | 245 // Wait for all databases to be closed. |
236 if (web_database_observer_impl_.get()) | 246 if (web_database_observer_impl_.get()) |
237 web_database_observer_impl_->WaitForAllDatabasesToClose(); | 247 web_database_observer_impl_->WaitForAllDatabasesToClose(); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 !command_line.HasSwitch(switches::kDisableSessionStorage)); | 521 !command_line.HasSwitch(switches::kDisableSessionStorage)); |
512 | 522 |
513 WebRuntimeFeatures::enableIndexedDatabase(true); | 523 WebRuntimeFeatures::enableIndexedDatabase(true); |
514 | 524 |
515 WebRuntimeFeatures::enableGeolocation( | 525 WebRuntimeFeatures::enableGeolocation( |
516 !command_line.HasSwitch(switches::kDisableGeolocation)); | 526 !command_line.HasSwitch(switches::kDisableGeolocation)); |
517 | 527 |
518 WebKit::WebRuntimeFeatures::enableMediaSource( | 528 WebKit::WebRuntimeFeatures::enableMediaSource( |
519 command_line.HasSwitch(switches::kEnableMediaSource)); | 529 command_line.HasSwitch(switches::kEnableMediaSource)); |
520 | 530 |
| 531 WebRuntimeFeatures::enableMediaPlayer( |
| 532 media::IsMediaLibraryInitialized()); |
| 533 |
521 WebKit::WebRuntimeFeatures::enableMediaStream( | 534 WebKit::WebRuntimeFeatures::enableMediaStream( |
522 command_line.HasSwitch(switches::kEnableMediaStream)); | 535 command_line.HasSwitch(switches::kEnableMediaStream)); |
523 | 536 |
524 WebKit::WebRuntimeFeatures::enableFullScreenAPI( | 537 WebKit::WebRuntimeFeatures::enableFullScreenAPI( |
525 !command_line.HasSwitch(switches::kDisableFullScreen)); | 538 !command_line.HasSwitch(switches::kDisableFullScreen)); |
526 | 539 |
527 WebKit::WebRuntimeFeatures::enablePointerLock( | 540 WebKit::WebRuntimeFeatures::enablePointerLock( |
528 command_line.HasSwitch(switches::kEnablePointerLock)); | 541 command_line.HasSwitch(switches::kEnablePointerLock)); |
529 | 542 |
530 WebKit::WebRuntimeFeatures::enableVideoTrack( | 543 WebKit::WebRuntimeFeatures::enableVideoTrack( |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 | 954 |
942 scoped_refptr<base::MessageLoopProxy> | 955 scoped_refptr<base::MessageLoopProxy> |
943 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 956 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
944 DCHECK(message_loop() == MessageLoop::current()); | 957 DCHECK(message_loop() == MessageLoop::current()); |
945 if (!file_thread_.get()) { | 958 if (!file_thread_.get()) { |
946 file_thread_.reset(new base::Thread("Renderer::FILE")); | 959 file_thread_.reset(new base::Thread("Renderer::FILE")); |
947 file_thread_->Start(); | 960 file_thread_->Start(); |
948 } | 961 } |
949 return file_thread_->message_loop_proxy(); | 962 return file_thread_->message_loop_proxy(); |
950 } | 963 } |
OLD | NEW |