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 <utility> | 10 #include <utility> |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 // The ChildResourceMessageFilter and the ResourceDispatcher need to use the | 1170 // The ChildResourceMessageFilter and the ResourceDispatcher need to use the |
1171 // same queue to ensure tasks are executed in the expected order. | 1171 // same queue to ensure tasks are executed in the expected order. |
1172 child_resource_message_filter()->SetMainThreadTaskRunner(resource_task_queue); | 1172 child_resource_message_filter()->SetMainThreadTaskRunner(resource_task_queue); |
1173 resource_dispatcher()->SetMainThreadTaskRunner(resource_task_queue); | 1173 resource_dispatcher()->SetMainThreadTaskRunner(resource_task_queue); |
1174 } | 1174 } |
1175 | 1175 |
1176 void RenderThreadImpl::InitializeCompositorThread() { | 1176 void RenderThreadImpl::InitializeCompositorThread() { |
1177 #if defined(OS_ANDROID) | 1177 #if defined(OS_ANDROID) |
1178 SynchronousCompositorFactory* sync_compositor_factory = | 1178 SynchronousCompositorFactory* sync_compositor_factory = |
1179 SynchronousCompositorFactory::GetInstance(); | 1179 SynchronousCompositorFactory::GetInstance(); |
| 1180 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
1180 bool using_ipc_sync_compositing = | 1181 bool using_ipc_sync_compositing = |
1181 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1182 cmd_line->HasSwitch(switches::kIPCSyncCompositing); |
1182 switches::kIPCSyncCompositing); | 1183 bool sync_input_for_sync_compositing = |
| 1184 cmd_line->HasSwitch(switches::kSyncInputForSyncCompositor); |
1183 DCHECK(!sync_compositor_factory || !using_ipc_sync_compositing); | 1185 DCHECK(!sync_compositor_factory || !using_ipc_sync_compositing); |
| 1186 DCHECK(!sync_input_for_sync_compositing || using_ipc_sync_compositing); |
1184 | 1187 |
1185 if (sync_compositor_factory) { | 1188 if (sync_compositor_factory) { |
1186 compositor_task_runner_ = | 1189 compositor_task_runner_ = |
1187 sync_compositor_factory->GetCompositorTaskRunner(); | 1190 sync_compositor_factory->GetCompositorTaskRunner(); |
1188 } | 1191 } |
1189 #endif | 1192 #endif |
1190 if (!compositor_task_runner_.get()) { | 1193 if (!compositor_task_runner_.get()) { |
1191 base::Thread::Options options; | 1194 base::Thread::Options options; |
1192 #if defined(OS_ANDROID) | 1195 #if defined(OS_ANDROID) |
1193 options.priority = base::ThreadPriority::DISPLAY; | 1196 options.priority = base::ThreadPriority::DISPLAY; |
1194 #endif | 1197 #endif |
1195 compositor_thread_.reset(new WebThreadForCompositor(options)); | 1198 compositor_thread_.reset(new WebThreadForCompositor(options)); |
1196 blink_platform_impl_->SetCompositorThread(compositor_thread_.get()); | 1199 blink_platform_impl_->SetCompositorThread(compositor_thread_.get()); |
1197 compositor_task_runner_ = compositor_thread_->GetTaskRunner(); | 1200 compositor_task_runner_ = compositor_thread_->GetTaskRunner(); |
1198 compositor_task_runner_->PostTask( | 1201 compositor_task_runner_->PostTask( |
1199 FROM_HERE, | 1202 FROM_HERE, |
1200 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), | 1203 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), |
1201 false)); | 1204 false)); |
1202 } | 1205 } |
1203 | 1206 |
1204 InputHandlerManagerClient* input_handler_manager_client = NULL; | 1207 InputHandlerManagerClient* input_handler_manager_client = nullptr; |
| 1208 SynchronousInputHandlerProxyClient* synchronous_input_handler_proxy_client = |
| 1209 nullptr; |
1205 #if defined(OS_ANDROID) | 1210 #if defined(OS_ANDROID) |
1206 if (using_ipc_sync_compositing) { | 1211 if (using_ipc_sync_compositing) { |
1207 sync_compositor_message_filter_ = | 1212 sync_compositor_message_filter_ = |
1208 new SynchronousCompositorFilter(compositor_task_runner_); | 1213 new SynchronousCompositorFilter(compositor_task_runner_); |
1209 AddFilter(sync_compositor_message_filter_.get()); | 1214 AddFilter(sync_compositor_message_filter_.get()); |
1210 input_handler_manager_client = sync_compositor_message_filter_.get(); | 1215 if (sync_input_for_sync_compositing) |
| 1216 input_handler_manager_client = sync_compositor_message_filter_.get(); |
| 1217 synchronous_input_handler_proxy_client = |
| 1218 sync_compositor_message_filter_.get(); |
1211 } else if (sync_compositor_factory) { | 1219 } else if (sync_compositor_factory) { |
1212 input_handler_manager_client = | 1220 input_handler_manager_client = |
1213 sync_compositor_factory->GetInputHandlerManagerClient(); | 1221 sync_compositor_factory->GetInputHandlerManagerClient(); |
| 1222 synchronous_input_handler_proxy_client = |
| 1223 sync_compositor_factory->GetSynchronousInputHandlerProxyClient(); |
1214 } | 1224 } |
1215 #endif | 1225 #endif |
1216 if (!input_handler_manager_client) { | 1226 if (!input_handler_manager_client) { |
1217 scoped_refptr<InputEventFilter> compositor_input_event_filter( | 1227 scoped_refptr<InputEventFilter> compositor_input_event_filter( |
1218 new InputEventFilter(main_input_callback_.callback(), | 1228 new InputEventFilter(main_input_callback_.callback(), |
1219 main_thread_compositor_task_runner_, | 1229 main_thread_compositor_task_runner_, |
1220 compositor_task_runner_)); | 1230 compositor_task_runner_)); |
1221 input_handler_manager_client = compositor_input_event_filter.get(); | 1231 input_handler_manager_client = compositor_input_event_filter.get(); |
1222 input_event_filter_ = compositor_input_event_filter; | 1232 input_event_filter_ = compositor_input_event_filter; |
1223 } | 1233 } |
1224 input_handler_manager_.reset(new InputHandlerManager( | 1234 input_handler_manager_.reset(new InputHandlerManager( |
1225 compositor_task_runner_, input_handler_manager_client, | 1235 compositor_task_runner_, input_handler_manager_client, |
1226 renderer_scheduler_.get())); | 1236 synchronous_input_handler_proxy_client, renderer_scheduler_.get())); |
1227 } | 1237 } |
1228 | 1238 |
1229 void RenderThreadImpl::EnsureWebKitInitialized() { | 1239 void RenderThreadImpl::EnsureWebKitInitialized() { |
1230 if (blink_platform_impl_) | 1240 if (blink_platform_impl_) |
1231 return; | 1241 return; |
1232 | 1242 |
1233 const base::CommandLine& command_line = | 1243 const base::CommandLine& command_line = |
1234 *base::CommandLine::ForCurrentProcess(); | 1244 *base::CommandLine::ForCurrentProcess(); |
1235 | 1245 |
1236 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1246 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 } | 2181 } |
2172 | 2182 |
2173 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2183 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
2174 size_t erased = | 2184 size_t erased = |
2175 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2185 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
2176 routing_id_); | 2186 routing_id_); |
2177 DCHECK_EQ(1u, erased); | 2187 DCHECK_EQ(1u, erased); |
2178 } | 2188 } |
2179 | 2189 |
2180 } // namespace content | 2190 } // namespace content |
OLD | NEW |