Remove unused MessageQueueThreadRegistry
Reviewed By: astreet Differential Revision: D5111966 fbshipit-source-id: 2d96c0fe0bb8f7e5c88e200dc09feee265c24890
This commit is contained in:
parent
047961fbf7
commit
275ba316c3
|
@ -161,14 +161,12 @@ public class MessageQueueThreadImpl implements MessageQueueThread {
|
|||
|
||||
if (UiThreadUtil.isOnUiThread()) {
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY);
|
||||
MessageQueueThreadRegistry.register(mqt);
|
||||
} else {
|
||||
UiThreadUtil.runOnUiThread(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY);
|
||||
MessageQueueThreadRegistry.register(mqt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -181,11 +179,10 @@ public class MessageQueueThreadImpl implements MessageQueueThread {
|
|||
* When this method exits, the new MessageQueueThreadImpl is ready to receive events.
|
||||
*/
|
||||
private static MessageQueueThreadImpl startNewBackgroundThread(
|
||||
final String name,
|
||||
long stackSize,
|
||||
QueueThreadExceptionHandler exceptionHandler) {
|
||||
final String name,
|
||||
long stackSize,
|
||||
QueueThreadExceptionHandler exceptionHandler) {
|
||||
final SimpleSettableFuture<Looper> looperFuture = new SimpleSettableFuture<>();
|
||||
final SimpleSettableFuture<MessageQueueThread> mqtFuture = new SimpleSettableFuture<>();
|
||||
Thread bgThread = new Thread(null,
|
||||
new Runnable() {
|
||||
@Override
|
||||
|
@ -194,17 +191,12 @@ public class MessageQueueThreadImpl implements MessageQueueThread {
|
|||
Looper.prepare();
|
||||
|
||||
looperFuture.set(Looper.myLooper());
|
||||
MessageQueueThreadRegistry.register(mqtFuture.getOrThrow());
|
||||
|
||||
Looper.loop();
|
||||
}
|
||||
}, "mqt_" + name, stackSize);
|
||||
bgThread.start();
|
||||
|
||||
Looper myLooper = looperFuture.getOrThrow();
|
||||
MessageQueueThreadImpl mqt = new MessageQueueThreadImpl(name, myLooper, exceptionHandler);
|
||||
mqtFuture.set(mqt);
|
||||
|
||||
return mqt;
|
||||
return new MessageQueueThreadImpl(name, myLooper, exceptionHandler);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.react.bridge.queue;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
/**
|
||||
* A utility for getting the MessageQueueThread for the current thread. Once there is only one
|
||||
* implementation of MessageQueueThread, this should move to that class.
|
||||
*/
|
||||
@DoNotStrip
|
||||
public class MessageQueueThreadRegistry {
|
||||
|
||||
private static ThreadLocal<MessageQueueThread> sMyMessageQueueThread = new ThreadLocal<>();
|
||||
|
||||
/*package*/ static void register(MessageQueueThread mqt) {
|
||||
mqt.assertIsOnThread();
|
||||
sMyMessageQueueThread.set(mqt);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the MessageQueueThread that owns the current Thread.
|
||||
*/
|
||||
@DoNotStrip
|
||||
public static MessageQueueThread myMessageQueueThread() {
|
||||
return Assertions.assertNotNull(
|
||||
sMyMessageQueueThread.get(),
|
||||
"This thread doesn't have a MessageQueueThread registered to it!");
|
||||
}
|
||||
}
|
||||
|
|
@ -85,11 +85,4 @@ void JMessageQueueThread::quitSynchronous() {
|
|||
method(m_jobj);
|
||||
}
|
||||
|
||||
/* static */
|
||||
std::unique_ptr<JMessageQueueThread> JMessageQueueThread::currentMessageQueueThread() {
|
||||
static auto method = MessageQueueThreadRegistry::javaClassStatic()->
|
||||
getStaticMethod<JavaMessageQueueThread::javaobject()>("myMessageQueueThread");
|
||||
return folly::make_unique<JMessageQueueThread>(method(MessageQueueThreadRegistry::javaClassStatic()));
|
||||
}
|
||||
|
||||
} }
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <functional>
|
||||
|
||||
#include <cxxreact/MessageQueueThread.h>
|
||||
|
||||
#include <fb/fbjni.h>
|
||||
|
||||
using namespace facebook::jni;
|
||||
|
@ -44,17 +43,8 @@ public:
|
|||
return m_jobj.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current MessageQueueThread that owns this thread.
|
||||
*/
|
||||
static std::unique_ptr<JMessageQueueThread> currentMessageQueueThread();
|
||||
private:
|
||||
global_ref<JavaMessageQueueThread::javaobject> m_jobj;
|
||||
};
|
||||
|
||||
class MessageQueueThreadRegistry : public jni::JavaClass<MessageQueueThreadRegistry> {
|
||||
public:
|
||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/react/bridge/queue/MessageQueueThreadRegistry;";
|
||||
};
|
||||
|
||||
} }
|
||||
|
|
Loading…
Reference in New Issue