| 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> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 #endif | 111 #endif |
| 112 | 112 |
| 113 #if defined(OS_POSIX) | 113 #if defined(OS_POSIX) |
| 114 #include "ipc/ipc_channel_posix.h" | 114 #include "ipc/ipc_channel_posix.h" |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 #if defined(ENABLE_WEBRTC) | 117 #if defined(ENABLE_WEBRTC) |
| 118 #include "third_party/webrtc/system_wrappers/interface/event_tracer.h" | 118 #include "third_party/webrtc/system_wrappers/interface/event_tracer.h" |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 #if defined(OS_ANDROID) |
| 122 #include "content/renderer/android/synchronous_compositor_factory.h" |
| 123 #endif |
| 124 |
| 121 using base::ThreadRestrictions; | 125 using base::ThreadRestrictions; |
| 122 using WebKit::WebDocument; | 126 using WebKit::WebDocument; |
| 123 using WebKit::WebFrame; | 127 using WebKit::WebFrame; |
| 124 using WebKit::WebNetworkStateNotifier; | 128 using WebKit::WebNetworkStateNotifier; |
| 125 using WebKit::WebRuntimeFeatures; | 129 using WebKit::WebRuntimeFeatures; |
| 126 using WebKit::WebScriptController; | 130 using WebKit::WebScriptController; |
| 127 using WebKit::WebSecurityPolicy; | 131 using WebKit::WebSecurityPolicy; |
| 128 using WebKit::WebString; | 132 using WebKit::WebString; |
| 129 using WebKit::WebView; | 133 using WebKit::WebView; |
| 130 | 134 |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 WebKit::initialize(webkit_platform_support_.get()); | 741 WebKit::initialize(webkit_platform_support_.get()); |
| 738 WebKit::setSharedWorkerRepository( | 742 WebKit::setSharedWorkerRepository( |
| 739 webkit_platform_support_.get()->sharedWorkerRepository()); | 743 webkit_platform_support_.get()->sharedWorkerRepository()); |
| 740 WebKit::setIDBFactory( | 744 WebKit::setIDBFactory( |
| 741 webkit_platform_support_.get()->idbFactory()); | 745 webkit_platform_support_.get()->idbFactory()); |
| 742 | 746 |
| 743 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 747 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 744 | 748 |
| 745 bool enable = command_line.HasSwitch(switches::kEnableThreadedCompositing); | 749 bool enable = command_line.HasSwitch(switches::kEnableThreadedCompositing); |
| 746 if (enable) { | 750 if (enable) { |
| 747 base::MessageLoop* override_loop = | 751 #if defined(OS_ANDROID) |
| 748 GetContentClient()->renderer()->OverrideCompositorMessageLoop(); | 752 if (SynchronousCompositorFactory* factory = |
| 749 if (override_loop) { | 753 SynchronousCompositorFactory::GetInstance()) |
| 750 compositor_message_loop_proxy_ = override_loop->message_loop_proxy(); | 754 compositor_message_loop_proxy_ = |
| 751 } else { | 755 factory->GetCompositorMessageLoop(); |
| 756 #endif |
| 757 if (!compositor_message_loop_proxy_) { |
| 752 compositor_thread_.reset(new base::Thread("Compositor")); | 758 compositor_thread_.reset(new base::Thread("Compositor")); |
| 753 compositor_thread_->Start(); | 759 compositor_thread_->Start(); |
| 754 #if defined(OS_ANDROID) | 760 #if defined(OS_ANDROID) |
| 755 compositor_thread_->SetPriority(base::kThreadPriority_Display); | 761 compositor_thread_->SetPriority(base::kThreadPriority_Display); |
| 756 #endif | 762 #endif |
| 757 compositor_message_loop_proxy_ = | 763 compositor_message_loop_proxy_ = |
| 758 compositor_thread_->message_loop_proxy(); | 764 compositor_thread_->message_loop_proxy(); |
| 759 compositor_message_loop_proxy_->PostTask( | 765 compositor_message_loop_proxy_->PostTask( |
| 760 FROM_HERE, | 766 FROM_HERE, |
| 761 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), | 767 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), |
| 762 false)); | 768 false)); |
| 763 } | 769 } |
| 764 | 770 |
| 765 if (GetContentClient()->renderer()->ShouldCreateCompositorInputHandler()) { | 771 input_handler_manager_.reset( |
| 766 input_handler_manager_.reset( | 772 new InputHandlerManager(this, compositor_message_loop_proxy_)); |
| 767 new InputHandlerManager(this, compositor_message_loop_proxy_)); | 773 AddFilter(input_handler_manager_->GetMessageFilter()); |
| 768 AddFilter(input_handler_manager_->GetMessageFilter()); | |
| 769 } | |
| 770 } | 774 } |
| 771 | 775 |
| 772 scoped_refptr<base::MessageLoopProxy> output_surface_loop; | 776 scoped_refptr<base::MessageLoopProxy> output_surface_loop; |
| 773 if (enable) | 777 if (enable) |
| 774 output_surface_loop = compositor_message_loop_proxy_; | 778 output_surface_loop = compositor_message_loop_proxy_; |
| 775 else | 779 else |
| 776 output_surface_loop = base::MessageLoopProxy::current(); | 780 output_surface_loop = base::MessageLoopProxy::current(); |
| 777 | 781 |
| 778 compositor_output_surface_filter_ = | 782 compositor_output_surface_filter_ = |
| 779 CompositorOutputSurface::CreateFilter(output_surface_loop); | 783 CompositorOutputSurface::CreateFilter(output_surface_loop); |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 | 1331 |
| 1328 void RenderThreadImpl::SetFlingCurveParameters( | 1332 void RenderThreadImpl::SetFlingCurveParameters( |
| 1329 const std::vector<float>& new_touchpad, | 1333 const std::vector<float>& new_touchpad, |
| 1330 const std::vector<float>& new_touchscreen) { | 1334 const std::vector<float>& new_touchscreen) { |
| 1331 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, | 1335 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, |
| 1332 new_touchscreen); | 1336 new_touchscreen); |
| 1333 | 1337 |
| 1334 } | 1338 } |
| 1335 | 1339 |
| 1336 } // namespace content | 1340 } // namespace content |
| OLD | NEW |