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

Unified Diff: content/browser/android/interface_registry_android_impl.cc

Issue 2183703005: Renderers should obtain browser InterfaceProvider by connecting to browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/android/interface_registry_android_impl.cc
diff --git a/content/browser/android/interface_registry_android_impl.cc b/content/browser/android/interface_registry_android_impl.cc
index d02169203c166f6db4ff41ec267ae9bffdad1cce..4553ad088503b2a71c9e576f533fbd69b71bd25c 100644
--- a/content/browser/android/interface_registry_android_impl.cc
+++ b/content/browser/android/interface_registry_android_impl.cc
@@ -10,6 +10,7 @@
#include "base/android/jni_string.h"
#include "base/callback.h"
#include "base/memory/ptr_util.h"
+#include "content/public/browser/browser_thread.h"
#include "jni/InterfaceRegistry_jni.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "services/shell/public/cpp/interface_provider.h"
@@ -87,10 +88,14 @@ void InterfaceRegistryAndroidImpl::AddInterface(
ScopedJavaGlobalRef<jobject> j_scoped_factory;
j_scoped_factory.Reset(env, j_factory);
+ // All Java services must be bound on the main thread.
Ken Rockot(use gerrit already) 2016/07/29 17:09:45 nit: s/services/interfaces/
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
interface_registry_->AddInterface(
- name, base::Bind(&CreateImplAndAttach, j_scoped_interface_registry,
- j_scoped_manager, j_scoped_factory),
- nullptr);
+ name,
+ base::Bind(&CreateImplAndAttach, j_scoped_interface_registry,
+ j_scoped_manager, j_scoped_factory),
+ ui_task_runner);
}
void InterfaceRegistryAndroidImpl::RemoveInterface(

Powered by Google App Engine
This is Rietveld 408576698