Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 1620053002: sync compositor: Merge input path with chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 // The ChildResourceMessageFilter and the ResourceDispatcher need to use the 1178 // The ChildResourceMessageFilter and the ResourceDispatcher need to use the
1179 // same queue to ensure tasks are executed in the expected order. 1179 // same queue to ensure tasks are executed in the expected order.
1180 child_resource_message_filter()->SetMainThreadTaskRunner(resource_task_queue); 1180 child_resource_message_filter()->SetMainThreadTaskRunner(resource_task_queue);
1181 resource_dispatcher()->SetMainThreadTaskRunner(resource_task_queue); 1181 resource_dispatcher()->SetMainThreadTaskRunner(resource_task_queue);
1182 } 1182 }
1183 1183
1184 void RenderThreadImpl::InitializeCompositorThread() { 1184 void RenderThreadImpl::InitializeCompositorThread() {
1185 #if defined(OS_ANDROID) 1185 #if defined(OS_ANDROID)
1186 SynchronousCompositorFactory* sync_compositor_factory = 1186 SynchronousCompositorFactory* sync_compositor_factory =
1187 SynchronousCompositorFactory::GetInstance(); 1187 SynchronousCompositorFactory::GetInstance();
1188 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
1188 bool using_ipc_sync_compositing = 1189 bool using_ipc_sync_compositing =
1189 base::CommandLine::ForCurrentProcess()->HasSwitch( 1190 cmd_line->HasSwitch(switches::kIPCSyncCompositing);
1190 switches::kIPCSyncCompositing); 1191 bool async_input_for_sync_compositing =
1192 cmd_line->HasSwitch(switches::kAsyncInputForSyncCompositor);
1191 DCHECK(!sync_compositor_factory || !using_ipc_sync_compositing); 1193 DCHECK(!sync_compositor_factory || !using_ipc_sync_compositing);
1192 1194
1193 if (sync_compositor_factory) { 1195 if (sync_compositor_factory) {
1194 compositor_task_runner_ = 1196 compositor_task_runner_ =
1195 sync_compositor_factory->GetCompositorTaskRunner(); 1197 sync_compositor_factory->GetCompositorTaskRunner();
1196 } 1198 }
1197 #endif 1199 #endif
1198 if (!compositor_task_runner_.get()) { 1200 if (!compositor_task_runner_.get()) {
1199 base::Thread::Options options; 1201 base::Thread::Options options;
1200 #if defined(OS_ANDROID) 1202 #if defined(OS_ANDROID)
1201 options.priority = base::ThreadPriority::DISPLAY; 1203 options.priority = base::ThreadPriority::DISPLAY;
1202 #endif 1204 #endif
1203 compositor_thread_.reset(new WebThreadForCompositor(options)); 1205 compositor_thread_.reset(new WebThreadForCompositor(options));
1204 blink_platform_impl_->SetCompositorThread(compositor_thread_.get()); 1206 blink_platform_impl_->SetCompositorThread(compositor_thread_.get());
1205 compositor_task_runner_ = compositor_thread_->TaskRunner(); 1207 compositor_task_runner_ = compositor_thread_->TaskRunner();
1206 compositor_task_runner_->PostTask( 1208 compositor_task_runner_->PostTask(
1207 FROM_HERE, 1209 FROM_HERE,
1208 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), 1210 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed),
1209 false)); 1211 false));
1210 } 1212 }
1211 1213
1212 InputHandlerManagerClient* input_handler_manager_client = NULL; 1214 InputHandlerManagerClient* input_handler_manager_client = nullptr;
1215 InputHandlerManagerSyncHandlerProxyClient*
1216 input_handler_manager_sync_handler_proxy_client = nullptr;
1213 #if defined(OS_ANDROID) 1217 #if defined(OS_ANDROID)
1214 if (using_ipc_sync_compositing) { 1218 if (using_ipc_sync_compositing) {
1215 sync_compositor_message_filter_ = 1219 sync_compositor_message_filter_ =
1216 new SynchronousCompositorFilter(compositor_task_runner_); 1220 new SynchronousCompositorFilter(compositor_task_runner_);
1217 AddFilter(sync_compositor_message_filter_.get()); 1221 AddFilter(sync_compositor_message_filter_.get());
1218 input_handler_manager_client = sync_compositor_message_filter_.get(); 1222 if (!async_input_for_sync_compositing)
1223 input_handler_manager_client = sync_compositor_message_filter_.get();
1224 input_handler_manager_sync_handler_proxy_client =
1225 sync_compositor_message_filter_.get();
1219 } else if (sync_compositor_factory) { 1226 } else if (sync_compositor_factory) {
1220 input_handler_manager_client = 1227 input_handler_manager_client =
1221 sync_compositor_factory->GetInputHandlerManagerClient(); 1228 sync_compositor_factory->GetInputHandlerManagerClient();
1229 input_handler_manager_sync_handler_proxy_client =
1230 sync_compositor_factory->GetInputHandlerManagerSyncHandlerProxyClient();
1222 } 1231 }
1223 #endif 1232 #endif
1224 if (!input_handler_manager_client) { 1233 if (!input_handler_manager_client) {
1225 scoped_refptr<InputEventFilter> compositor_input_event_filter( 1234 scoped_refptr<InputEventFilter> compositor_input_event_filter(
1226 new InputEventFilter(main_input_callback_.callback(), 1235 new InputEventFilter(main_input_callback_.callback(),
1227 main_thread_compositor_task_runner_, 1236 main_thread_compositor_task_runner_,
1228 compositor_task_runner_)); 1237 compositor_task_runner_));
1229 input_handler_manager_client = compositor_input_event_filter.get(); 1238 input_handler_manager_client = compositor_input_event_filter.get();
1230 input_event_filter_ = compositor_input_event_filter; 1239 input_event_filter_ = compositor_input_event_filter;
1231 } 1240 }
1232 input_handler_manager_.reset(new InputHandlerManager( 1241 input_handler_manager_.reset(new InputHandlerManager(
1233 compositor_task_runner_, input_handler_manager_client, 1242 compositor_task_runner_, input_handler_manager_client,
1243 input_handler_manager_sync_handler_proxy_client,
1234 renderer_scheduler_.get())); 1244 renderer_scheduler_.get()));
1235 } 1245 }
1236 1246
1237 void RenderThreadImpl::EnsureWebKitInitialized() { 1247 void RenderThreadImpl::EnsureWebKitInitialized() {
1238 if (blink_platform_impl_) 1248 if (blink_platform_impl_)
1239 return; 1249 return;
1240 1250
1241 const base::CommandLine& command_line = 1251 const base::CommandLine& command_line =
1242 *base::CommandLine::ForCurrentProcess(); 1252 *base::CommandLine::ForCurrentProcess();
1243 1253
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 } 2188 }
2179 2189
2180 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { 2190 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() {
2181 size_t erased = 2191 size_t erased =
2182 RenderThreadImpl::current()->pending_render_frame_connects_.erase( 2192 RenderThreadImpl::current()->pending_render_frame_connects_.erase(
2183 routing_id_); 2193 routing_id_);
2184 DCHECK_EQ(1u, erased); 2194 DCHECK_EQ(1u, erased);
2185 } 2195 }
2186 2196
2187 } // namespace content 2197 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698