Chromium Code Reviews| 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); | |
|
no sievers
2016/03/10 20:37:06
nit: DCHECK_IMPLIES(sync_input_for_sync_compositin
boliu
2016/03/10 21:04:28
Done. DCHECK_IMPLIES isn't a thing anymore, so it'
| |
| 1183 DCHECK(!sync_compositor_factory || !using_ipc_sync_compositing); | 1185 DCHECK(!sync_compositor_factory || !using_ipc_sync_compositing); |
| 1184 | 1186 |
| 1185 if (sync_compositor_factory) { | 1187 if (sync_compositor_factory) { |
| 1186 compositor_task_runner_ = | 1188 compositor_task_runner_ = |
| 1187 sync_compositor_factory->GetCompositorTaskRunner(); | 1189 sync_compositor_factory->GetCompositorTaskRunner(); |
| 1188 } | 1190 } |
| 1189 #endif | 1191 #endif |
| 1190 if (!compositor_task_runner_.get()) { | 1192 if (!compositor_task_runner_.get()) { |
| 1191 base::Thread::Options options; | 1193 base::Thread::Options options; |
| 1192 #if defined(OS_ANDROID) | 1194 #if defined(OS_ANDROID) |
| 1193 options.priority = base::ThreadPriority::DISPLAY; | 1195 options.priority = base::ThreadPriority::DISPLAY; |
| 1194 #endif | 1196 #endif |
| 1195 compositor_thread_.reset(new WebThreadForCompositor(options)); | 1197 compositor_thread_.reset(new WebThreadForCompositor(options)); |
| 1196 blink_platform_impl_->SetCompositorThread(compositor_thread_.get()); | 1198 blink_platform_impl_->SetCompositorThread(compositor_thread_.get()); |
| 1197 compositor_task_runner_ = compositor_thread_->GetTaskRunner(); | 1199 compositor_task_runner_ = compositor_thread_->GetTaskRunner(); |
| 1198 compositor_task_runner_->PostTask( | 1200 compositor_task_runner_->PostTask( |
| 1199 FROM_HERE, | 1201 FROM_HERE, |
| 1200 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), | 1202 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), |
| 1201 false)); | 1203 false)); |
| 1202 } | 1204 } |
| 1203 | 1205 |
| 1204 InputHandlerManagerClient* input_handler_manager_client = NULL; | 1206 InputHandlerManagerClient* input_handler_manager_client = nullptr; |
| 1207 SynchronousInputHandlerProxyClient* synchronous_input_handler_proxy_client = | |
| 1208 nullptr; | |
| 1205 #if defined(OS_ANDROID) | 1209 #if defined(OS_ANDROID) |
| 1206 if (using_ipc_sync_compositing) { | 1210 if (using_ipc_sync_compositing) { |
| 1207 sync_compositor_message_filter_ = | 1211 sync_compositor_message_filter_ = |
| 1208 new SynchronousCompositorFilter(compositor_task_runner_); | 1212 new SynchronousCompositorFilter(compositor_task_runner_); |
| 1209 AddFilter(sync_compositor_message_filter_.get()); | 1213 AddFilter(sync_compositor_message_filter_.get()); |
| 1210 input_handler_manager_client = sync_compositor_message_filter_.get(); | 1214 if (sync_input_for_sync_compositing) |
| 1215 input_handler_manager_client = sync_compositor_message_filter_.get(); | |
| 1216 synchronous_input_handler_proxy_client = | |
| 1217 sync_compositor_message_filter_.get(); | |
| 1211 } else if (sync_compositor_factory) { | 1218 } else if (sync_compositor_factory) { |
| 1212 input_handler_manager_client = | 1219 input_handler_manager_client = |
| 1213 sync_compositor_factory->GetInputHandlerManagerClient(); | 1220 sync_compositor_factory->GetInputHandlerManagerClient(); |
| 1221 synchronous_input_handler_proxy_client = | |
| 1222 sync_compositor_factory->GetSynchronousInputHandlerProxyClient(); | |
| 1214 } | 1223 } |
| 1215 #endif | 1224 #endif |
| 1216 if (!input_handler_manager_client) { | 1225 if (!input_handler_manager_client) { |
| 1217 scoped_refptr<InputEventFilter> compositor_input_event_filter( | 1226 scoped_refptr<InputEventFilter> compositor_input_event_filter( |
| 1218 new InputEventFilter(main_input_callback_.callback(), | 1227 new InputEventFilter(main_input_callback_.callback(), |
| 1219 main_thread_compositor_task_runner_, | 1228 main_thread_compositor_task_runner_, |
| 1220 compositor_task_runner_)); | 1229 compositor_task_runner_)); |
| 1221 input_handler_manager_client = compositor_input_event_filter.get(); | 1230 input_handler_manager_client = compositor_input_event_filter.get(); |
| 1222 input_event_filter_ = compositor_input_event_filter; | 1231 input_event_filter_ = compositor_input_event_filter; |
| 1223 } | 1232 } |
| 1224 input_handler_manager_.reset(new InputHandlerManager( | 1233 input_handler_manager_.reset(new InputHandlerManager( |
| 1225 compositor_task_runner_, input_handler_manager_client, | 1234 compositor_task_runner_, input_handler_manager_client, |
| 1226 renderer_scheduler_.get())); | 1235 synchronous_input_handler_proxy_client, renderer_scheduler_.get())); |
| 1227 } | 1236 } |
| 1228 | 1237 |
| 1229 void RenderThreadImpl::EnsureWebKitInitialized() { | 1238 void RenderThreadImpl::EnsureWebKitInitialized() { |
| 1230 if (blink_platform_impl_) | 1239 if (blink_platform_impl_) |
| 1231 return; | 1240 return; |
| 1232 | 1241 |
| 1233 const base::CommandLine& command_line = | 1242 const base::CommandLine& command_line = |
| 1234 *base::CommandLine::ForCurrentProcess(); | 1243 *base::CommandLine::ForCurrentProcess(); |
| 1235 | 1244 |
| 1236 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1245 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2171 } | 2180 } |
| 2172 | 2181 |
| 2173 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2182 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 2174 size_t erased = | 2183 size_t erased = |
| 2175 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2184 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 2176 routing_id_); | 2185 routing_id_); |
| 2177 DCHECK_EQ(1u, erased); | 2186 DCHECK_EQ(1u, erased); |
| 2178 } | 2187 } |
| 2179 | 2188 |
| 2180 } // namespace content | 2189 } // namespace content |
| OLD | NEW |