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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2416123003: [Device Sensors] Move Mojo communication to UI thread on Android (Closed)
Patch Set: Fix browsertest Created 4 years, 1 month 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 1272
1273 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = 1273 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner =
1274 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE); 1274 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE);
1275 registry->AddInterface(base::Bind(&MimeRegistryImpl::Create), 1275 registry->AddInterface(base::Bind(&MimeRegistryImpl::Create),
1276 file_task_runner); 1276 file_task_runner);
1277 #if defined(USE_MINIKIN_HYPHENATION) 1277 #if defined(USE_MINIKIN_HYPHENATION)
1278 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create), 1278 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create),
1279 file_task_runner); 1279 file_task_runner);
1280 #endif 1280 #endif
1281 1281
1282 // These callbacks will be run immediately on the IO thread. 1282 #if defined(OS_ANDROID)
1283 // On Android the device sensors implementations need to run on the UI thread
1284 // to communicate to Java.
1285 AddUIThreadInterface(registry.get(), base::Bind(&DeviceLightHost::Create));
1286 AddUIThreadInterface(registry.get(), base::Bind(&DeviceMotionHost::Create));
1287 AddUIThreadInterface(registry.get(),
1288 base::Bind(&DeviceOrientationHost::Create));
1289 AddUIThreadInterface(registry.get(),
1290 base::Bind(&DeviceOrientationAbsoluteHost::Create));
1291 #else
1292 // On platforms other than Android the device sensors implementations run on
1293 // the IO thread.
1283 registry->AddInterface(base::Bind(&DeviceLightHost::Create)); 1294 registry->AddInterface(base::Bind(&DeviceLightHost::Create));
1284 registry->AddInterface(base::Bind(&DeviceMotionHost::Create)); 1295 registry->AddInterface(base::Bind(&DeviceMotionHost::Create));
1285 registry->AddInterface(base::Bind(&DeviceOrientationHost::Create)); 1296 registry->AddInterface(base::Bind(&DeviceOrientationHost::Create));
1286 registry->AddInterface(base::Bind(&DeviceOrientationAbsoluteHost::Create)); 1297 registry->AddInterface(base::Bind(&DeviceOrientationAbsoluteHost::Create));
1298 #endif // defined(OS_ANDROID)
1299
1287 registry->AddInterface( 1300 registry->AddInterface(
1288 base::Bind(&URLLoaderFactoryImpl::Create, resource_message_filter_)); 1301 base::Bind(&URLLoaderFactoryImpl::Create, resource_message_filter_));
1289 1302
1290 registry->AddInterface( 1303 registry->AddInterface(
1291 base::Bind(&VideoCaptureHost::Create, 1304 base::Bind(&VideoCaptureHost::Create,
1292 BrowserMainLoop::GetInstance()->media_stream_manager())); 1305 BrowserMainLoop::GetInstance()->media_stream_manager()));
1293 1306
1294 // This is to support usage of WebSockets in cases in which there is no 1307 // This is to support usage of WebSockets in cases in which there is no
1295 // associated RenderFrame (e.g., Shared Workers). 1308 // associated RenderFrame (e.g., Shared Workers).
1296 AddUIThreadInterface( 1309 AddUIThreadInterface(
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 bad_message::ReceivedBadMessage(render_process_id, 3018 bad_message::ReceivedBadMessage(render_process_id,
3006 bad_message::RPH_MOJO_PROCESS_ERROR); 3019 bad_message::RPH_MOJO_PROCESS_ERROR);
3007 } 3020 }
3008 3021
3009 void RenderProcessHostImpl::CreateURLLoaderFactory( 3022 void RenderProcessHostImpl::CreateURLLoaderFactory(
3010 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { 3023 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) {
3011 URLLoaderFactoryImpl::Create(resource_message_filter_, std::move(request)); 3024 URLLoaderFactoryImpl::Create(resource_message_filter_, std::move(request));
3012 } 3025 }
3013 3026
3014 } // namespace content 3027 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698